diff -Nru spice-gtk-0.9/ABOUT-NLS spice-gtk-0.12/ABOUT-NLS --- spice-gtk-0.9/ABOUT-NLS 2011-09-02 14:56:48.000000000 +0000 +++ spice-gtk-0.12/ABOUT-NLS 1970-01-01 00:00:00.000000000 +0000 @@ -1,1068 +0,0 @@ -1 Notes on the Free Translation Project -*************************************** - -Free software is going international! The Free Translation Project is -a way to get maintainers of free software, translators, and users all -together, so that free software will gradually become able to speak many -languages. A few packages already provide translations for their -messages. - - If you found this `ABOUT-NLS' file inside a distribution, you may -assume that the distributed package does use GNU `gettext' internally, -itself available at your nearest GNU archive site. But you do _not_ -need to install GNU `gettext' prior to configuring, installing or using -this package with messages translated. - - Installers will find here some useful hints. These notes also -explain how users should proceed for getting the programs to use the -available translations. They tell how people wanting to contribute and -work on translations can contact the appropriate team. - - When reporting bugs in the `intl/' directory or bugs which may be -related to internationalization, you should tell about the version of -`gettext' which is used. The information can be found in the -`intl/VERSION' file, in internationalized packages. - -1.1 Quick configuration advice -============================== - -If you want to exploit the full power of internationalization, you -should configure it using - - ./configure --with-included-gettext - -to force usage of internationalizing routines provided within this -package, despite the existence of internationalizing capabilities in the -operating system where this package is being installed. So far, only -the `gettext' implementation in the GNU C library version 2 provides as -many features (such as locale alias, message inheritance, automatic -charset conversion or plural form handling) as the implementation here. -It is also not possible to offer this additional functionality on top -of a `catgets' implementation. Future versions of GNU `gettext' will -very likely convey even more functionality. So it might be a good idea -to change to GNU `gettext' as soon as possible. - - So you need _not_ provide this option if you are using GNU libc 2 or -you have installed a recent copy of the GNU gettext package with the -included `libintl'. - -1.2 INSTALL Matters -=================== - -Some packages are "localizable" when properly installed; the programs -they contain can be made to speak your own native language. Most such -packages use GNU `gettext'. Other packages have their own ways to -internationalization, predating GNU `gettext'. - - By default, this package will be installed to allow translation of -messages. It will automatically detect whether the system already -provides the GNU `gettext' functions. If not, the included GNU -`gettext' library will be used. This library is wholly contained -within this package, usually in the `intl/' subdirectory, so prior -installation of the GNU `gettext' package is _not_ required. -Installers may use special options at configuration time for changing -the default behaviour. The commands: - - ./configure --with-included-gettext - ./configure --disable-nls - -will, respectively, bypass any pre-existing `gettext' to use the -internationalizing routines provided within this package, or else, -_totally_ disable translation of messages. - - When you already have GNU `gettext' installed on your system and run -configure without an option for your new package, `configure' will -probably detect the previously built and installed `libintl.a' file and -will decide to use this. This might not be desirable. You should use -the more recent version of the GNU `gettext' library. I.e. if the file -`intl/VERSION' shows that the library which comes with this package is -more recent, you should use - - ./configure --with-included-gettext - -to prevent auto-detection. - - The configuration process will not test for the `catgets' function -and therefore it will not be used. The reason is that even an -emulation of `gettext' on top of `catgets' could not provide all the -extensions of the GNU `gettext' library. - - Internationalized packages usually have many `po/LL.po' files, where -LL gives an ISO 639 two-letter code identifying the language. Unless -translations have been forbidden at `configure' time by using the -`--disable-nls' switch, all available translations are installed -together with the package. However, the environment variable `LINGUAS' -may be set, prior to configuration, to limit the installed set. -`LINGUAS' should then contain a space separated list of two-letter -codes, stating which languages are allowed. - -1.3 Using This Package -====================== - -As a user, if your language has been installed for this package, you -only have to set the `LANG' environment variable to the appropriate -`LL_CC' combination. If you happen to have the `LC_ALL' or some other -`LC_xxx' environment variables set, you should unset them before -setting `LANG', otherwise the setting of `LANG' will not have the -desired effect. Here `LL' is an ISO 639 two-letter language code, and -`CC' is an ISO 3166 two-letter country code. For example, let's -suppose that you speak German and live in Germany. At the shell -prompt, merely execute `setenv LANG de_DE' (in `csh'), -`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). -This can be done from your `.login' or `.profile' file, once and for -all. - - You might think that the country code specification is redundant. -But in fact, some languages have dialects in different countries. For -example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The -country code serves to distinguish the dialects. - - The locale naming convention of `LL_CC', with `LL' denoting the -language and `CC' denoting the country, is the one use on systems based -on GNU libc. On other systems, some variations of this scheme are -used, such as `LL' or `LL_CC.ENCODING'. You can get the list of -locales supported by your system for your language by running the -command `locale -a | grep '^LL''. - - Not all programs have translations for all languages. By default, an -English message is shown in place of a nonexistent translation. If you -understand other languages, you can set up a priority list of languages. -This is done through a different environment variable, called -`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' -for the purpose of message handling, but you still need to have `LANG' -set to the primary language; this is required by other parts of the -system libraries. For example, some Swedish users who would rather -read translations in German than English for when Swedish is not -available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. - - Special advice for Norwegian users: The language code for Norwegian -bokma*l changed from `no' to `nb' recently (in 2003). During the -transition period, while some message catalogs for this language are -installed under `nb' and some older ones under `no', it's recommended -for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and -older translations are used. - - In the `LANGUAGE' environment variable, but not in the `LANG' -environment variable, `LL_CC' combinations can be abbreviated as `LL' -to denote the language's main dialect. For example, `de' is equivalent -to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' -(Portuguese as spoken in Portugal) in this context. - -1.4 Translating Teams -===================== - -For the Free Translation Project to be a success, we need interested -people who like their own language and write it well, and who are also -able to synergize with other translators speaking the same language. -Each translation team has its own mailing list. The up-to-date list of -teams can be found at the Free Translation Project's homepage, -`http://translationproject.org/', in the "Teams" area. - - If you'd like to volunteer to _work_ at translating messages, you -should become a member of the translating team for your own language. -The subscribing address is _not_ the same as the list itself, it has -`-request' appended. For example, speakers of Swedish can send a -message to `sv-request@li.org', having this message body: - - subscribe - - Keep in mind that team members are expected to participate -_actively_ in translations, or at solving translational difficulties, -rather than merely lurking around. If your team does not exist yet and -you want to start one, or if you are unsure about what to do or how to -get started, please write to `coordinator@translationproject.org' to -reach the coordinator for all translator teams. - - The English team is special. It works at improving and uniformizing -the terminology in use. Proven linguistic skills are praised more than -programming skills, here. - -1.5 Available Packages -====================== - -Languages are not equally supported in all packages. The following -matrix shows the current state of internationalization, as of November -2007. The matrix shows, in regard of each package, for which languages -PO files have been submitted to translation coordination, with a -translation percentage of at least 50%. - - Ready PO files af am ar az be bg bs ca cs cy da de el en en_GB eo - +----------------------------------------------------+ - Compendium | [] [] [] [] | - a2ps | [] [] [] [] [] | - aegis | () | - ant-phone | () | - anubis | [] | - ap-utils | | - aspell | [] [] [] [] [] | - bash | [] | - bfd | | - bibshelf | [] | - binutils | | - bison | [] [] | - bison-runtime | [] | - bluez-pin | [] [] [] [] [] | - cflow | [] | - clisp | [] [] [] | - console-tools | [] [] | - coreutils | [] [] [] [] | - cpio | | - cpplib | [] [] [] | - cryptonit | [] | - dialog | | - diffutils | [] [] [] [] [] [] | - doodle | [] | - e2fsprogs | [] [] | - enscript | [] [] [] [] | - fetchmail | [] [] () [] [] | - findutils | [] | - findutils_stable | [] [] [] | - flex | [] [] [] | - fslint | | - gas | | - gawk | [] [] [] | - gcal | [] | - gcc | [] | - gettext-examples | [] [] [] [] [] | - gettext-runtime | [] [] [] [] [] | - gettext-tools | [] [] | - gip | [] | - gliv | [] [] | - glunarclock | [] | - gmult | [] [] | - gnubiff | () | - gnucash | [] [] () () [] | - gnuedu | | - gnulib | [] | - gnunet | | - gnunet-gtk | | - gnutls | [] | - gpe-aerial | [] [] | - gpe-beam | [] [] | - gpe-calendar | | - gpe-clock | [] [] | - gpe-conf | [] [] | - gpe-contacts | | - gpe-edit | [] | - gpe-filemanager | | - gpe-go | [] | - gpe-login | [] [] | - gpe-ownerinfo | [] [] | - gpe-package | | - gpe-sketchbook | [] [] | - gpe-su | [] [] | - gpe-taskmanager | [] [] | - gpe-timesheet | [] | - gpe-today | [] [] | - gpe-todo | | - gphoto2 | [] [] [] [] | - gprof | [] [] | - gpsdrive | | - gramadoir | [] [] | - grep | [] [] | - gretl | () | - gsasl | | - gss | | - gst-plugins-bad | [] [] | - gst-plugins-base | [] [] | - gst-plugins-good | [] [] [] | - gst-plugins-ugly | [] [] | - gstreamer | [] [] [] [] [] [] [] | - gtick | () | - gtkam | [] [] [] [] | - gtkorphan | [] [] | - gtkspell | [] [] [] [] | - gutenprint | [] | - hello | [] [] [] [] [] | - herrie | [] | - hylafax | | - idutils | [] [] | - indent | [] [] [] [] | - iso_15924 | | - iso_3166 | [] [] [] [] [] [] [] [] [] [] [] | - iso_3166_2 | | - iso_4217 | [] [] [] | - iso_639 | [] [] [] [] | - jpilot | [] | - jtag | | - jwhois | | - kbd | [] [] [] [] | - keytouch | [] [] | - keytouch-editor | [] | - keytouch-keyboa... | [] | - latrine | () | - ld | [] | - leafpad | [] [] [] [] [] | - libc | [] [] [] [] | - libexif | [] | - libextractor | [] | - libgpewidget | [] [] [] | - libgpg-error | [] | - libgphoto2 | [] [] | - libgphoto2_port | [] [] | - libgsasl | | - libiconv | [] [] | - libidn | [] [] [] | - lifelines | [] () | - lilypond | [] | - lingoteach | | - lprng | | - lynx | [] [] [] [] | - m4 | [] [] [] [] | - mailfromd | | - mailutils | [] | - make | [] [] | - man-db | [] [] [] | - minicom | [] [] [] | - nano | [] [] [] | - opcodes | [] | - parted | [] [] | - pilot-qof | | - popt | [] [] [] | - psmisc | [] | - pwdutils | | - qof | | - radius | [] | - recode | [] [] [] [] [] [] | - rpm | [] | - screem | | - scrollkeeper | [] [] [] [] [] [] [] [] | - sed | [] [] [] | - shared-mime-info | [] [] [] [] () [] [] [] | - sharutils | [] [] [] [] [] [] | - shishi | | - skencil | [] () | - solfege | | - soundtracker | [] [] | - sp | [] | - system-tools-ba... | [] [] [] [] [] [] [] [] [] | - tar | [] [] | - texinfo | [] [] [] | - tin | () () | - tuxpaint | [] [] [] [] [] [] | - unicode-han-tra... | | - unicode-transla... | | - util-linux | [] [] [] [] | - util-linux-ng | [] [] [] [] | - vorbis-tools | [] | - wastesedge | () | - wdiff | [] [] [] [] | - wget | [] [] [] | - xchat | [] [] [] [] [] [] [] | - xkeyboard-config | [] | - xpad | [] [] [] | - +----------------------------------------------------+ - af am ar az be bg bs ca cs cy da de el en en_GB eo - 6 0 2 1 8 26 2 40 48 2 56 88 15 1 15 18 - - es et eu fa fi fr ga gl gu he hi hr hu id is it - +--------------------------------------------------+ - Compendium | [] [] [] [] [] | - a2ps | [] [] [] () | - aegis | | - ant-phone | [] | - anubis | [] | - ap-utils | [] [] | - aspell | [] [] [] | - bash | [] | - bfd | [] [] | - bibshelf | [] [] [] | - binutils | [] [] [] | - bison | [] [] [] [] [] [] | - bison-runtime | [] [] [] [] [] | - bluez-pin | [] [] [] [] [] | - cflow | [] | - clisp | [] [] | - console-tools | | - coreutils | [] [] [] [] [] [] | - cpio | [] [] [] | - cpplib | [] [] | - cryptonit | [] | - dialog | [] [] [] | - diffutils | [] [] [] [] [] [] [] [] [] | - doodle | [] [] | - e2fsprogs | [] [] [] | - enscript | [] [] [] | - fetchmail | [] | - findutils | [] [] [] | - findutils_stable | [] [] [] [] | - flex | [] [] [] | - fslint | | - gas | [] [] | - gawk | [] [] [] [] () | - gcal | [] [] | - gcc | [] | - gettext-examples | [] [] [] [] [] [] [] | - gettext-runtime | [] [] [] [] [] [] | - gettext-tools | [] [] [] [] | - gip | [] [] [] [] | - gliv | () | - glunarclock | [] [] [] | - gmult | [] [] [] | - gnubiff | () () | - gnucash | () () () | - gnuedu | [] | - gnulib | [] [] [] | - gnunet | | - gnunet-gtk | | - gnutls | | - gpe-aerial | [] [] | - gpe-beam | [] [] | - gpe-calendar | | - gpe-clock | [] [] [] [] | - gpe-conf | [] | - gpe-contacts | [] [] | - gpe-edit | [] [] [] [] | - gpe-filemanager | [] | - gpe-go | [] [] [] | - gpe-login | [] [] [] | - gpe-ownerinfo | [] [] [] [] [] | - gpe-package | [] | - gpe-sketchbook | [] [] | - gpe-su | [] [] [] [] | - gpe-taskmanager | [] [] [] | - gpe-timesheet | [] [] [] [] | - gpe-today | [] [] [] [] | - gpe-todo | [] | - gphoto2 | [] [] [] [] [] | - gprof | [] [] [] [] [] | - gpsdrive | [] | - gramadoir | [] [] | - grep | [] [] [] | - gretl | [] [] [] () | - gsasl | [] [] | - gss | [] [] | - gst-plugins-bad | [] [] [] [] | - gst-plugins-base | [] [] [] [] | - gst-plugins-good | [] [] [] [] [] | - gst-plugins-ugly | [] [] [] [] | - gstreamer | [] [] [] | - gtick | [] [] [] | - gtkam | [] [] [] [] | - gtkorphan | [] [] | - gtkspell | [] [] [] [] [] [] [] | - gutenprint | [] | - hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | - herrie | [] | - hylafax | | - idutils | [] [] [] [] [] | - indent | [] [] [] [] [] [] [] [] [] [] | - iso_15924 | [] | - iso_3166 | [] [] [] [] [] [] [] [] [] [] [] [] [] | - iso_3166_2 | [] | - iso_4217 | [] [] [] [] [] [] | - iso_639 | [] [] [] [] [] [] | - jpilot | [] [] | - jtag | [] | - jwhois | [] [] [] [] [] | - kbd | [] [] | - keytouch | [] [] [] | - keytouch-editor | [] | - keytouch-keyboa... | [] [] | - latrine | [] [] | - ld | [] [] [] [] | - leafpad | [] [] [] [] [] [] | - libc | [] [] [] [] [] | - libexif | [] | - libextractor | [] | - libgpewidget | [] [] [] [] [] | - libgpg-error | [] | - libgphoto2 | [] [] [] | - libgphoto2_port | [] [] | - libgsasl | [] [] | - libiconv | [] [] [] | - libidn | [] [] | - lifelines | () | - lilypond | [] [] [] | - lingoteach | [] [] [] | - lprng | | - lynx | [] [] [] | - m4 | [] [] [] [] | - mailfromd | | - mailutils | [] [] | - make | [] [] [] [] [] [] [] [] | - man-db | [] | - minicom | [] [] [] [] | - nano | [] [] [] [] [] [] [] | - opcodes | [] [] [] [] | - parted | [] [] [] | - pilot-qof | | - popt | [] [] [] [] | - psmisc | [] [] | - pwdutils | | - qof | [] | - radius | [] [] | - recode | [] [] [] [] [] [] [] [] | - rpm | [] [] | - screem | | - scrollkeeper | [] [] [] | - sed | [] [] [] [] [] | - shared-mime-info | [] [] [] [] [] [] | - sharutils | [] [] [] [] [] [] [] [] | - shishi | [] | - skencil | [] [] | - solfege | [] | - soundtracker | [] [] [] | - sp | [] | - system-tools-ba... | [] [] [] [] [] [] [] [] [] | - tar | [] [] [] [] [] | - texinfo | [] [] [] | - tin | [] () | - tuxpaint | [] [] | - unicode-han-tra... | | - unicode-transla... | [] [] | - util-linux | [] [] [] [] [] [] [] | - util-linux-ng | [] [] [] [] [] [] [] | - vorbis-tools | | - wastesedge | () | - wdiff | [] [] [] [] [] [] [] [] | - wget | [] [] [] [] [] [] [] [] | - xchat | [] [] [] [] [] [] [] | - xkeyboard-config | [] [] [] [] | - xpad | [] [] [] | - +--------------------------------------------------+ - es et eu fa fi fr ga gl gu he hi hr hu id is it - 85 22 14 2 48 101 61 12 2 8 2 6 53 29 1 52 - - ja ka ko ku ky lg lt lv mk mn ms mt nb ne nl nn - +--------------------------------------------------+ - Compendium | [] | - a2ps | () [] [] | - aegis | () | - ant-phone | [] | - anubis | [] [] [] | - ap-utils | [] | - aspell | [] [] | - bash | [] | - bfd | | - bibshelf | [] | - binutils | | - bison | [] [] [] | - bison-runtime | [] [] [] | - bluez-pin | [] [] [] | - cflow | | - clisp | [] | - console-tools | | - coreutils | [] | - cpio | [] | - cpplib | [] | - cryptonit | [] | - dialog | [] [] | - diffutils | [] [] [] | - doodle | | - e2fsprogs | [] | - enscript | [] | - fetchmail | [] [] | - findutils | [] | - findutils_stable | [] | - flex | [] [] | - fslint | | - gas | | - gawk | [] [] | - gcal | | - gcc | | - gettext-examples | [] [] [] | - gettext-runtime | [] [] [] | - gettext-tools | [] [] | - gip | [] [] | - gliv | [] | - glunarclock | [] [] | - gmult | [] [] [] | - gnubiff | | - gnucash | () () () | - gnuedu | | - gnulib | [] [] | - gnunet | | - gnunet-gtk | | - gnutls | [] | - gpe-aerial | [] | - gpe-beam | [] | - gpe-calendar | [] | - gpe-clock | [] [] [] | - gpe-conf | [] [] [] | - gpe-contacts | [] | - gpe-edit | [] [] [] | - gpe-filemanager | [] [] | - gpe-go | [] [] [] | - gpe-login | [] [] [] | - gpe-ownerinfo | [] [] | - gpe-package | [] [] | - gpe-sketchbook | [] [] | - gpe-su | [] [] [] | - gpe-taskmanager | [] [] [] [] | - gpe-timesheet | [] | - gpe-today | [] [] | - gpe-todo | [] | - gphoto2 | [] [] | - gprof | [] | - gpsdrive | [] | - gramadoir | () | - grep | [] [] | - gretl | | - gsasl | [] | - gss | | - gst-plugins-bad | [] | - gst-plugins-base | [] | - gst-plugins-good | [] | - gst-plugins-ugly | [] | - gstreamer | [] | - gtick | [] | - gtkam | [] [] | - gtkorphan | [] | - gtkspell | [] [] | - gutenprint | [] | - hello | [] [] [] [] [] [] [] | - herrie | [] | - hylafax | | - idutils | [] | - indent | [] [] | - iso_15924 | [] | - iso_3166 | [] [] [] [] [] [] [] [] | - iso_3166_2 | [] | - iso_4217 | [] [] [] | - iso_639 | [] [] [] [] | - jpilot | () () | - jtag | | - jwhois | [] | - kbd | [] | - keytouch | [] | - keytouch-editor | [] | - keytouch-keyboa... | | - latrine | [] | - ld | | - leafpad | [] [] | - libc | [] [] [] | - libexif | | - libextractor | | - libgpewidget | [] | - libgpg-error | | - libgphoto2 | [] | - libgphoto2_port | [] | - libgsasl | [] | - libiconv | [] | - libidn | [] [] | - lifelines | [] | - lilypond | [] | - lingoteach | [] | - lprng | | - lynx | [] [] | - m4 | [] [] | - mailfromd | | - mailutils | | - make | [] [] [] | - man-db | | - minicom | [] | - nano | [] [] [] | - opcodes | [] | - parted | [] [] | - pilot-qof | | - popt | [] [] [] | - psmisc | [] [] [] | - pwdutils | | - qof | | - radius | | - recode | [] | - rpm | [] [] | - screem | [] | - scrollkeeper | [] [] [] [] | - sed | [] [] | - shared-mime-info | [] [] [] [] [] [] [] | - sharutils | [] [] | - shishi | | - skencil | | - solfege | () () | - soundtracker | | - sp | () | - system-tools-ba... | [] [] [] [] | - tar | [] [] [] | - texinfo | [] [] | - tin | | - tuxpaint | () [] [] | - unicode-han-tra... | | - unicode-transla... | | - util-linux | [] [] | - util-linux-ng | [] [] | - vorbis-tools | | - wastesedge | [] | - wdiff | [] [] | - wget | [] [] | - xchat | [] [] [] [] | - xkeyboard-config | [] [] [] | - xpad | [] [] [] | - +--------------------------------------------------+ - ja ka ko ku ky lg lt lv mk mn ms mt nb ne nl nn - 51 2 25 3 2 0 6 0 2 2 20 0 11 1 103 6 - - or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta - +--------------------------------------------------+ - Compendium | [] [] [] [] [] | - a2ps | () [] [] [] [] [] [] | - aegis | () () | - ant-phone | [] [] | - anubis | [] [] [] | - ap-utils | () | - aspell | [] [] [] | - bash | [] [] | - bfd | | - bibshelf | [] | - binutils | [] [] | - bison | [] [] [] [] [] | - bison-runtime | [] [] [] [] [] | - bluez-pin | [] [] [] [] [] [] [] [] [] | - cflow | [] | - clisp | [] | - console-tools | [] | - coreutils | [] [] [] [] | - cpio | [] [] [] | - cpplib | [] | - cryptonit | [] [] | - dialog | [] | - diffutils | [] [] [] [] [] [] | - doodle | [] [] | - e2fsprogs | [] [] | - enscript | [] [] [] [] [] | - fetchmail | [] [] [] | - findutils | [] [] [] | - findutils_stable | [] [] [] [] [] [] | - flex | [] [] [] [] [] | - fslint | [] | - gas | | - gawk | [] [] [] [] | - gcal | [] | - gcc | [] [] | - gettext-examples | [] [] [] [] [] [] [] [] | - gettext-runtime | [] [] [] [] [] [] [] [] | - gettext-tools | [] [] [] [] [] [] [] | - gip | [] [] [] [] | - gliv | [] [] [] [] [] [] | - glunarclock | [] [] [] [] [] [] | - gmult | [] [] [] [] | - gnubiff | () [] | - gnucash | () [] | - gnuedu | | - gnulib | [] [] [] | - gnunet | | - gnunet-gtk | [] | - gnutls | [] [] | - gpe-aerial | [] [] [] [] [] [] [] | - gpe-beam | [] [] [] [] [] [] [] | - gpe-calendar | [] [] [] [] | - gpe-clock | [] [] [] [] [] [] [] [] | - gpe-conf | [] [] [] [] [] [] [] | - gpe-contacts | [] [] [] [] [] | - gpe-edit | [] [] [] [] [] [] [] [] [] | - gpe-filemanager | [] [] | - gpe-go | [] [] [] [] [] [] [] [] | - gpe-login | [] [] [] [] [] [] [] [] | - gpe-ownerinfo | [] [] [] [] [] [] [] [] | - gpe-package | [] [] | - gpe-sketchbook | [] [] [] [] [] [] [] [] | - gpe-su | [] [] [] [] [] [] [] [] | - gpe-taskmanager | [] [] [] [] [] [] [] [] | - gpe-timesheet | [] [] [] [] [] [] [] [] | - gpe-today | [] [] [] [] [] [] [] [] | - gpe-todo | [] [] [] [] | - gphoto2 | [] [] [] [] [] [] | - gprof | [] [] [] | - gpsdrive | [] [] | - gramadoir | [] [] | - grep | [] [] [] [] | - gretl | [] [] [] | - gsasl | [] [] [] | - gss | [] [] [] [] | - gst-plugins-bad | [] [] [] | - gst-plugins-base | [] [] | - gst-plugins-good | [] [] | - gst-plugins-ugly | [] [] [] | - gstreamer | [] [] [] [] | - gtick | [] | - gtkam | [] [] [] [] [] | - gtkorphan | [] | - gtkspell | [] [] [] [] [] [] [] [] | - gutenprint | [] | - hello | [] [] [] [] [] [] [] [] | - herrie | [] [] [] | - hylafax | | - idutils | [] [] [] [] [] | - indent | [] [] [] [] [] [] [] | - iso_15924 | | - iso_3166 | [] [] [] [] [] [] [] [] [] [] [] [] [] | - iso_3166_2 | | - iso_4217 | [] [] [] [] [] [] [] | - iso_639 | [] [] [] [] [] [] [] | - jpilot | | - jtag | [] | - jwhois | [] [] [] [] | - kbd | [] [] [] | - keytouch | [] | - keytouch-editor | [] | - keytouch-keyboa... | [] | - latrine | | - ld | [] | - leafpad | [] [] [] [] [] [] | - libc | [] [] [] [] | - libexif | [] [] | - libextractor | [] [] | - libgpewidget | [] [] [] [] [] [] [] [] | - libgpg-error | [] [] [] | - libgphoto2 | [] | - libgphoto2_port | [] [] [] | - libgsasl | [] [] [] [] | - libiconv | [] [] [] | - libidn | [] [] () | - lifelines | [] [] | - lilypond | | - lingoteach | [] | - lprng | [] | - lynx | [] [] [] | - m4 | [] [] [] [] [] | - mailfromd | [] | - mailutils | [] [] [] | - make | [] [] [] [] | - man-db | [] [] [] [] | - minicom | [] [] [] [] [] | - nano | [] [] [] [] | - opcodes | [] [] | - parted | [] | - pilot-qof | | - popt | [] [] [] [] | - psmisc | [] [] | - pwdutils | [] [] | - qof | [] [] | - radius | [] [] | - recode | [] [] [] [] [] [] [] | - rpm | [] [] [] [] | - screem | | - scrollkeeper | [] [] [] [] [] [] [] | - sed | [] [] [] [] [] [] [] [] [] | - shared-mime-info | [] [] [] [] [] [] | - sharutils | [] [] [] [] | - shishi | [] | - skencil | [] [] [] | - solfege | [] | - soundtracker | [] [] | - sp | | - system-tools-ba... | [] [] [] [] [] [] [] [] [] | - tar | [] [] [] [] | - texinfo | [] [] [] [] | - tin | () | - tuxpaint | [] [] [] [] [] [] | - unicode-han-tra... | | - unicode-transla... | | - util-linux | [] [] [] [] | - util-linux-ng | [] [] [] [] | - vorbis-tools | [] | - wastesedge | | - wdiff | [] [] [] [] [] [] [] | - wget | [] [] [] [] | - xchat | [] [] [] [] [] [] [] | - xkeyboard-config | [] [] [] | - xpad | [] [] [] | - +--------------------------------------------------+ - or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta - 0 5 77 31 53 4 58 72 3 45 46 9 45 122 3 - - tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu - +---------------------------------------------------+ - Compendium | [] [] [] [] | 19 - a2ps | [] [] [] | 19 - aegis | [] | 1 - ant-phone | [] [] | 6 - anubis | [] [] [] | 11 - ap-utils | () [] | 4 - aspell | [] [] [] | 16 - bash | [] | 6 - bfd | | 2 - bibshelf | [] | 7 - binutils | [] [] [] [] | 9 - bison | [] [] [] [] | 20 - bison-runtime | [] [] [] [] | 18 - bluez-pin | [] [] [] [] [] [] | 28 - cflow | [] [] | 5 - clisp | | 9 - console-tools | [] [] | 5 - coreutils | [] [] [] | 18 - cpio | [] [] [] [] | 11 - cpplib | [] [] [] [] [] | 12 - cryptonit | [] | 6 - dialog | [] [] [] | 9 - diffutils | [] [] [] [] [] | 29 - doodle | [] | 6 - e2fsprogs | [] [] | 10 - enscript | [] [] [] | 16 - fetchmail | [] [] | 12 - findutils | [] [] [] | 11 - findutils_stable | [] [] [] [] | 18 - flex | [] [] | 15 - fslint | [] | 2 - gas | [] | 3 - gawk | [] [] [] | 16 - gcal | [] | 5 - gcc | [] [] [] | 7 - gettext-examples | [] [] [] [] [] [] | 29 - gettext-runtime | [] [] [] [] [] [] | 28 - gettext-tools | [] [] [] [] [] | 20 - gip | [] [] | 13 - gliv | [] [] | 11 - glunarclock | [] [] [] | 15 - gmult | [] [] [] [] | 16 - gnubiff | [] | 2 - gnucash | () [] | 5 - gnuedu | [] | 2 - gnulib | [] | 10 - gnunet | | 0 - gnunet-gtk | [] [] | 3 - gnutls | | 4 - gpe-aerial | [] [] | 14 - gpe-beam | [] [] | 14 - gpe-calendar | [] [] | 7 - gpe-clock | [] [] [] [] | 21 - gpe-conf | [] [] [] | 16 - gpe-contacts | [] [] | 10 - gpe-edit | [] [] [] [] [] | 22 - gpe-filemanager | [] [] | 7 - gpe-go | [] [] [] [] | 19 - gpe-login | [] [] [] [] [] | 21 - gpe-ownerinfo | [] [] [] [] | 21 - gpe-package | [] | 6 - gpe-sketchbook | [] [] | 16 - gpe-su | [] [] [] [] | 21 - gpe-taskmanager | [] [] [] [] | 21 - gpe-timesheet | [] [] [] [] | 18 - gpe-today | [] [] [] [] [] | 21 - gpe-todo | [] [] | 8 - gphoto2 | [] [] [] [] | 21 - gprof | [] [] | 13 - gpsdrive | [] | 5 - gramadoir | [] | 7 - grep | [] | 12 - gretl | | 6 - gsasl | [] [] [] | 9 - gss | [] | 7 - gst-plugins-bad | [] [] [] | 13 - gst-plugins-base | [] [] | 11 - gst-plugins-good | [] [] [] [] [] | 16 - gst-plugins-ugly | [] [] [] | 13 - gstreamer | [] [] [] | 18 - gtick | [] [] | 7 - gtkam | [] | 16 - gtkorphan | [] | 7 - gtkspell | [] [] [] [] [] [] | 27 - gutenprint | | 4 - hello | [] [] [] [] [] | 38 - herrie | [] [] | 8 - hylafax | | 0 - idutils | [] [] | 15 - indent | [] [] [] [] [] | 28 - iso_15924 | [] [] | 4 - iso_3166 | [] [] [] [] [] [] [] [] [] | 54 - iso_3166_2 | [] [] | 4 - iso_4217 | [] [] [] [] [] | 24 - iso_639 | [] [] [] [] [] | 26 - jpilot | [] [] [] [] | 7 - jtag | [] | 3 - jwhois | [] [] [] | 13 - kbd | [] [] [] | 13 - keytouch | [] | 8 - keytouch-editor | [] | 5 - keytouch-keyboa... | [] | 5 - latrine | [] [] | 5 - ld | [] [] [] [] | 10 - leafpad | [] [] [] [] [] | 24 - libc | [] [] [] | 19 - libexif | [] | 5 - libextractor | [] | 5 - libgpewidget | [] [] [] | 20 - libgpg-error | [] | 6 - libgphoto2 | [] [] | 9 - libgphoto2_port | [] [] [] | 11 - libgsasl | [] | 8 - libiconv | [] [] | 11 - libidn | [] [] | 11 - lifelines | | 4 - lilypond | [] | 6 - lingoteach | [] | 6 - lprng | [] | 2 - lynx | [] [] [] | 15 - m4 | [] [] [] | 18 - mailfromd | [] [] | 3 - mailutils | [] [] | 8 - make | [] [] [] | 20 - man-db | [] | 9 - minicom | [] | 14 - nano | [] [] [] | 20 - opcodes | [] [] | 10 - parted | [] [] [] | 11 - pilot-qof | [] | 1 - popt | [] [] [] [] | 18 - psmisc | [] [] | 10 - pwdutils | [] | 3 - qof | [] | 4 - radius | [] [] | 7 - recode | [] [] [] | 25 - rpm | [] [] [] [] | 13 - screem | [] | 2 - scrollkeeper | [] [] [] [] | 26 - sed | [] [] [] [] | 23 - shared-mime-info | [] [] [] | 29 - sharutils | [] [] [] | 23 - shishi | [] | 3 - skencil | [] | 7 - solfege | [] | 3 - soundtracker | [] [] | 9 - sp | [] | 3 - system-tools-ba... | [] [] [] [] [] [] [] | 38 - tar | [] [] [] | 17 - texinfo | [] [] [] | 15 - tin | | 1 - tuxpaint | [] [] [] | 19 - unicode-han-tra... | | 0 - unicode-transla... | | 2 - util-linux | [] [] [] | 20 - util-linux-ng | [] [] [] | 20 - vorbis-tools | [] [] | 4 - wastesedge | | 1 - wdiff | [] [] | 23 - wget | [] [] [] | 20 - xchat | [] [] [] [] | 29 - xkeyboard-config | [] [] [] | 14 - xpad | [] [] [] | 15 - +---------------------------------------------------+ - 76 teams tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu - 163 domains 0 3 1 74 51 0 143 21 1 57 7 45 0 2036 - - Some counters in the preceding matrix are higher than the number of -visible blocks let us expect. This is because a few extra PO files are -used for implementing regional variants of languages, or language -dialects. - - For a PO file in the matrix above to be effective, the package to -which it applies should also have been internationalized and -distributed as such by its maintainer. There might be an observable -lag between the mere existence a PO file and its wide availability in a -distribution. - - If November 2007 seems to be old, you may fetch a more recent copy -of this `ABOUT-NLS' file on most GNU archive sites. The most -up-to-date matrix with full percentage details can be found at -`http://translationproject.org/extra/matrix.html'. - -1.6 Using `gettext' in new packages -=================================== - -If you are writing a freely available program and want to -internationalize it you are welcome to use GNU `gettext' in your -package. Of course you have to respect the GNU Library General Public -License which covers the use of the GNU `gettext' library. This means -in particular that even non-free programs can use `libintl' as a shared -library, whereas only free software can use `libintl' as a static -library or use modified versions of `libintl'. - - Once the sources are changed appropriately and the setup can handle -the use of `gettext' the only thing missing are the translations. The -Free Translation Project is also available for packages which are not -developed inside the GNU project. Therefore the information given above -applies also for every other Free Software Project. Contact -`coordinator@translationproject.org' to make the `.pot' files available -to the translation teams. - diff -Nru spice-gtk-0.9/aclocal.m4 spice-gtk-0.12/aclocal.m4 --- spice-gtk-0.9/aclocal.m4 2012-01-31 10:22:57.000000000 +0000 +++ spice-gtk-0.12/aclocal.m4 2012-04-24 11:20:59.000000000 +0000 @@ -1,7 +1,8 @@ -# generated automatically by aclocal 1.11.1 -*- Autoconf -*- +# generated automatically by aclocal 1.11.3 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, +# Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -456,6 +457,221 @@ fi]) + +dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml]) +# serial 42 IT_PROG_INTLTOOL +AC_DEFUN([IT_PROG_INTLTOOL], [ +AC_PREREQ([2.50])dnl +AC_REQUIRE([AM_NLS])dnl + +case "$am__api_version" in + 1.[01234]) + AC_MSG_ERROR([Automake 1.5 or newer is required to use intltool]) + ;; + *) + ;; +esac + +INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` +INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3` +INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` +if test -n "$1"; then + AC_MSG_CHECKING([for intltool >= $1]) + AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found]) + test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || + AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.]) +fi + +AC_PATH_PROG(INTLTOOL_UPDATE, [intltool-update]) +AC_PATH_PROG(INTLTOOL_MERGE, [intltool-merge]) +AC_PATH_PROG(INTLTOOL_EXTRACT, [intltool-extract]) +if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then + AC_MSG_ERROR([The intltool scripts were not found. Please install intltool.]) +fi + +if test -z "$AM_DEFAULT_VERBOSITY"; then + AM_DEFAULT_VERBOSITY=1 +fi +AC_SUBST([AM_DEFAULT_VERBOSITY]) + +INTLTOOL_V_MERGE='$(INTLTOOL__v_MERGE_$(V))' +INTLTOOL__v_MERGE_='$(INTLTOOL__v_MERGE_$(AM_DEFAULT_VERBOSITY))' +INTLTOOL__v_MERGE_0='@echo " ITMRG " [$]@;' +AC_SUBST(INTLTOOL_V_MERGE) +AC_SUBST(INTLTOOL__v_MERGE_) +AC_SUBST(INTLTOOL__v_MERGE_0) + +INTLTOOL_V_MERGE_OPTIONS='$(intltool__v_merge_options_$(V))' +intltool__v_merge_options_='$(intltool__v_merge_options_$(AM_DEFAULT_VERBOSITY))' +intltool__v_merge_options_0='-q' +AC_SUBST(INTLTOOL_V_MERGE_OPTIONS) +AC_SUBST(intltool__v_merge_options_) +AC_SUBST(intltool__v_merge_options_0) + + INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -p $(top_srcdir)/po $< [$]@' + INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge 5000; then + INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u --no-translations $< [$]@' +else + INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)_it_tmp_dir=tmp.intltool.[$][$]RANDOM && mkdir [$][$]_it_tmp_dir && LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u [$][$]_it_tmp_dir $< [$]@ && rmdir [$][$]_it_tmp_dir' +fi + INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + +_IT_SUBST(INTLTOOL_DESKTOP_RULE) +_IT_SUBST(INTLTOOL_DIRECTORY_RULE) +_IT_SUBST(INTLTOOL_KEYS_RULE) +_IT_SUBST(INTLTOOL_PROP_RULE) +_IT_SUBST(INTLTOOL_OAF_RULE) +_IT_SUBST(INTLTOOL_PONG_RULE) +_IT_SUBST(INTLTOOL_SERVER_RULE) +_IT_SUBST(INTLTOOL_SHEET_RULE) +_IT_SUBST(INTLTOOL_SOUNDLIST_RULE) +_IT_SUBST(INTLTOOL_UI_RULE) +_IT_SUBST(INTLTOOL_XAM_RULE) +_IT_SUBST(INTLTOOL_KBD_RULE) +_IT_SUBST(INTLTOOL_XML_RULE) +_IT_SUBST(INTLTOOL_XML_NOMERGE_RULE) +_IT_SUBST(INTLTOOL_CAVES_RULE) +_IT_SUBST(INTLTOOL_SCHEMAS_RULE) +_IT_SUBST(INTLTOOL_THEME_RULE) +_IT_SUBST(INTLTOOL_SERVICE_RULE) +_IT_SUBST(INTLTOOL_POLICY_RULE) + +# Check the gettext tools to make sure they are GNU +AC_PATH_PROG(XGETTEXT, xgettext) +AC_PATH_PROG(MSGMERGE, msgmerge) +AC_PATH_PROG(MSGFMT, msgfmt) +AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) +if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then + AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) +fi +xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`" +mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`" +mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`" +if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then + AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) +fi + +AC_PATH_PROG(INTLTOOL_PERL, perl) +if test -z "$INTLTOOL_PERL"; then + AC_MSG_ERROR([perl not found]) +fi +AC_MSG_CHECKING([for perl >= 5.8.1]) +$INTLTOOL_PERL -e "use 5.8.1;" > /dev/null 2>&1 +if test $? -ne 0; then + AC_MSG_ERROR([perl 5.8.1 is required for intltool]) +else + IT_PERL_VERSION=`$INTLTOOL_PERL -e "printf '%vd', $^V"` + AC_MSG_RESULT([$IT_PERL_VERSION]) +fi +if test "x$2" != "xno-xml"; then + AC_MSG_CHECKING([for XML::Parser]) + if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then + AC_MSG_RESULT([ok]) + else + AC_MSG_ERROR([XML::Parser perl module is required for intltool]) + fi +fi + +# Substitute ALL_LINGUAS so we can use it in po/Makefile +AC_SUBST(ALL_LINGUAS) + +# Set DATADIRNAME correctly if it is not set yet +# (copied from glib-gettext.m4) +if test -z "$DATADIRNAME"; then + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[]], + [[extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr]])], + [DATADIRNAME=share], + [case $host in + *-*-solaris*) + dnl On Solaris, if bind_textdomain_codeset is in libc, + dnl GNU format message catalog is always supported, + dnl since both are added to the libc all together. + dnl Hence, we'd like to go with DATADIRNAME=share + dnl in this case. + AC_CHECK_FUNC(bind_textdomain_codeset, + [DATADIRNAME=share], [DATADIRNAME=lib]) + ;; + *) + [DATADIRNAME=lib] + ;; + esac]) +fi +AC_SUBST(DATADIRNAME) + +IT_PO_SUBDIR([po]) + +]) + + +# IT_PO_SUBDIR(DIRNAME) +# --------------------- +# All po subdirs have to be declared with this macro; the subdir "po" is +# declared by IT_PROG_INTLTOOL. +# +AC_DEFUN([IT_PO_SUBDIR], +[AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS. +dnl +dnl The following CONFIG_COMMANDS should be executed at the very end +dnl of config.status. +AC_CONFIG_COMMANDS_PRE([ + AC_CONFIG_COMMANDS([$1/stamp-it], [ + if [ ! grep "^# INTLTOOL_MAKEFILE$" "$1/Makefile.in" > /dev/null ]; then + AC_MSG_ERROR([$1/Makefile.in.in was not created by intltoolize.]) + fi + rm -f "$1/stamp-it" "$1/stamp-it.tmp" "$1/POTFILES" "$1/Makefile.tmp" + >"$1/stamp-it.tmp" + [sed '/^#/d + s/^[[].*] *// + /^[ ]*$/d + '"s|^| $ac_top_srcdir/|" \ + "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES" + ] + [sed '/^POTFILES =/,/[^\\]$/ { + /^POTFILES =/!d + r $1/POTFILES + } + ' "$1/Makefile.in" >"$1/Makefile"] + rm -f "$1/Makefile.tmp" + mv "$1/stamp-it.tmp" "$1/stamp-it" + ]) +])dnl +]) + +# _IT_SUBST(VARIABLE) +# ------------------- +# Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST +# +AC_DEFUN([_IT_SUBST], +[ +AC_SUBST([$1]) +m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])]) +] +) + +# deprecated macros +AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL]) +# A hint is needed for aclocal from Automake <= 1.9.4: +# AC_DEFUN([AC_PROG_INTLTOOL], ...) + + dnl -*- mode: autoconf -*- dnl Copyright 2009 Johan Dahlin dnl @@ -499,6 +715,8 @@ ],dnl [auto],[dnl PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no) + dnl Canonicalize enable_introspection + enable_introspection=$found_introspection ],dnl [dnl AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@]) @@ -551,6 +769,39 @@ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require]) ]) +# nls.m4 serial 5 (gettext-0.18) +dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_PREREQ([2.50]) + +AC_DEFUN([AM_NLS], +[ + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE([nls], + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT([$USE_NLS]) + AC_SUBST([USE_NLS]) +]) + # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # @@ -709,12 +960,15 @@ fi[]dnl ])# PKG_CHECK_MODULES -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software +# Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been @@ -724,7 +978,7 @@ [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.1], [], +m4_if([$1], [1.11.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -740,19 +994,21 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.1])dnl +[AM_AUTOMAKE_VERSION([1.11.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. @@ -834,14 +1090,14 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 -# Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, +# 2010, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 10 +# serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, @@ -881,6 +1137,7 @@ # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -945,7 +1202,7 @@ break fi ;; - msvisualcpp | msvcmsys) + msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. @@ -1010,10 +1267,13 @@ if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' + am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- @@ -1247,12 +1507,15 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, +# Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. @@ -1292,8 +1555,8 @@ # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, +# 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1313,7 +1576,7 @@ [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) -AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful @@ -1459,12 +1722,15 @@ fi ]) -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, +# Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. @@ -1487,13 +1753,14 @@ # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software +# Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 4 +# serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -1501,13 +1768,13 @@ [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) -# ------------------------------ +# -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- +# ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) @@ -1518,13 +1785,15 @@ AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 -# Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, +# 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 2 + # AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # --------------------------------------------------------------------------- # Adds support for distributing Python modules and packages. To @@ -1552,8 +1821,10 @@ dnl Find a Python interpreter. Python versions prior to 2.0 are not dnl supported. (2.0 was released on October 16, 2000). m4_define_default([_AM_PYTHON_INTERPRETER_LIST], - [python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 dnl -python2.1 python2.0]) +[python python2 python3 python3.2 python3.1 python3.0 python2.7 dnl + python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0]) + + AC_ARG_VAR([PYTHON], [the Python interpreter]) m4_if([$1],[],[ dnl No version check is needed. @@ -1625,9 +1896,7 @@ dnl site-packages directory, not the python standard library dnl directory like in previous automake betas. This behavior dnl is more consistent with lispdir.m4 for example. - dnl Query distutils for this directory. distutils does not exist in - dnl Python 1.5, so we fall back to the hardcoded directory if it - dnl doesn't work. + dnl Query distutils for this directory. AC_CACHE_CHECK([for $am_display_PYTHON script directory], [am_cv_python_pythondir], [if test "x$prefix" = xNONE @@ -1636,8 +1905,7 @@ else am_py_prefix=$prefix fi - am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null || - echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null` case $am_cv_python_pythondir in $am_py_prefix*) am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` @@ -1663,9 +1931,7 @@ dnl pyexecdir -- directory for installing python extension modules dnl (shared libraries) - dnl Query distutils for this directory. distutils does not exist in - dnl Python 1.5, so we fall back to the hardcoded directory if it - dnl doesn't work. + dnl Query distutils for this directory. AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], [am_cv_python_pyexecdir], [if test "x$exec_prefix" = xNONE @@ -1674,8 +1940,7 @@ else am_py_exec_prefix=$exec_prefix fi - am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null || - echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null` case $am_cv_python_pyexecdir in $am_py_exec_prefix*) am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` @@ -1723,12 +1988,14 @@ sys.exit(sys.hexversion < minverhex)" AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. @@ -1805,13 +2072,13 @@ fi AC_MSG_RESULT(yes)]) -# Copyright (C) 2009 Free Software Foundation, Inc. +# Copyright (C) 2009, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 +# serial 2 # AM_SILENT_RULES([DEFAULT]) # -------------------------- @@ -1826,18 +2093,50 @@ no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac +dnl +dnl A few `make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using `$V' instead of `$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't @@ -1860,13 +2159,13 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 2 +# serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- @@ -1875,13 +2174,13 @@ AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- +# -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1903,10 +2202,11 @@ # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) @@ -2007,11 +2307,12 @@ m4_include([m4/check_python.m4]) m4_include([m4/gtk-doc.m4]) -m4_include([m4/intltool.m4]) m4_include([m4/ld-version.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) -m4_include([m4/nls.m4]) +m4_include([m4/manywarnings.m4]) +m4_include([m4/spice-compile-warnings.m4]) +m4_include([m4/warnings.m4]) diff -Nru spice-gtk-0.9/build-aux/compile spice-gtk-0.12/build-aux/compile --- spice-gtk-0.9/build-aux/compile 2012-01-31 10:22:59.000000000 +0000 +++ spice-gtk-0.12/build-aux/compile 2012-04-24 11:21:03.000000000 +0000 @@ -1,10 +1,10 @@ #! /bin/sh -# Wrapper for compilers which do not understand `-c -o'. +# Wrapper for compilers which do not understand '-c -o'. -scriptversion=2009-10-06.20; # UTC +scriptversion=2012-01-04.17; # UTC -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software -# Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free +# Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -29,21 +29,186 @@ # bugs to or send patches to # . +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l*) + lib=${1#-l} + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + set x "$@" "$dir/$lib.dll.lib" + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + set x "$@" "$dir/$lib.lib" + break + fi + done + IFS=$save_IFS + + test "$found" != yes && set x "$@" "$lib.lib" + shift + ;; + -L*) + func_file_conv "${1#-L}" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + case $1 in '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] -Wrapper for compilers which do not understand `-c -o'. -Remove `-o dest.o' from ARGS, run PROGRAM with the remaining +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the -right script to run: please start by reading the file `INSTALL'. +right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF @@ -53,11 +218,13 @@ echo "compile $scriptversion" exit $? ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; esac ofile= cfile= -eat= for arg do @@ -66,8 +233,8 @@ else case $1 in -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we strip `-o arg' only if arg is an object. + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) @@ -94,10 +261,10 @@ done if test -z "$ofile" || test -z "$cfile"; then - # If no `-o' option was seen then we might have been invoked from a + # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no - # `.c' file was seen then we are probably linking. That is also + # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi @@ -106,7 +273,7 @@ cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. -# Note: use `[/\\:.-]' here to ensure that we don't use the same name +# Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d diff -Nru spice-gtk-0.9/build-aux/config.guess spice-gtk-0.12/build-aux/config.guess --- spice-gtk-0.9/build-aux/config.guess 2012-01-31 10:22:59.000000000 +0000 +++ spice-gtk-0.12/build-aux/config.guess 2012-04-24 11:21:03.000000000 +0000 @@ -1,10 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 -# Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. -timestamp='2009-11-20' +timestamp='2012-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -56,8 +56,9 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -144,7 +145,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -180,7 +181,7 @@ fi ;; *) - os=netbsd + os=netbsd ;; esac # The OS release @@ -223,7 +224,7 @@ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on @@ -269,7 +270,10 @@ # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -295,7 +299,7 @@ echo s390-ibm-zvmoe exit ;; *:OS400:*:*) - echo powerpc-ibm-os400 + echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} @@ -394,23 +398,23 @@ # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; @@ -480,8 +484,8 @@ echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ @@ -494,7 +498,7 @@ else echo i586-dg-dgux${UNAME_RELEASE} fi - exit ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; @@ -551,7 +555,7 @@ echo rs6000-ibm-aix3.2 fi exit ;; - *:AIX:*:[456]) + *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 @@ -594,52 +598,52 @@ 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + esac ;; + esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa @@ -730,22 +734,22 @@ exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; @@ -769,14 +773,14 @@ exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} @@ -788,13 +792,12 @@ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) @@ -803,15 +806,18 @@ *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) - case ${UNAME_MACHINE} in + case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; @@ -866,7 +872,7 @@ EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; - esac + esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} @@ -878,20 +884,29 @@ then echo ${UNAME_MACHINE}-unknown-linux-gnu else - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu @@ -933,7 +948,7 @@ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) - echo or32-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu @@ -959,7 +974,7 @@ echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu @@ -967,14 +982,17 @@ sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -983,11 +1001,11 @@ echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. + # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) @@ -1019,7 +1037,7 @@ fi exit ;; i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; @@ -1047,13 +1065,13 @@ exit ;; pc:*:*:*) # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp - exit ;; + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; @@ -1088,8 +1106,8 @@ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ @@ -1132,10 +1150,10 @@ echo ns32k-sni-sysv fi exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm @@ -1161,11 +1179,11 @@ exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv${UNAME_RELEASE} fi - exit ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; @@ -1230,6 +1248,9 @@ *:QNX:*:4*) echo i386-pc-qnx exit ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; @@ -1275,13 +1296,13 @@ echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; @@ -1321,11 +1342,11 @@ #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" + "" #endif - ); exit (0); + ); exit (0); #endif #endif diff -Nru spice-gtk-0.9/build-aux/config.rpath spice-gtk-0.12/build-aux/config.rpath --- spice-gtk-0.9/build-aux/config.rpath 2011-09-02 14:56:48.000000000 +0000 +++ spice-gtk-0.12/build-aux/config.rpath 1970-01-01 00:00:00.000000000 +0000 @@ -1,666 +0,0 @@ -#! /bin/sh -# Output a system dependent set of variables, describing how to set the -# run time search path of shared libraries in an executable. -# -# Copyright 1996-2007 Free Software Foundation, Inc. -# Taken from GNU libtool, 2001 -# Originally by Gordon Matzigkeit , 1996 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# The first argument passed to this file is the canonical host specification, -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld -# should be set by the caller. -# -# The set of defined variables is at the end of this script. - -# Known limitations: -# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer -# than 256 bytes, otherwise the compiler driver will dump core. The only -# known workaround is to choose shorter directory names for the build -# directory and/or the installation directory. - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a -shrext=.so - -host="$1" -host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - -# Code taken from libtool.m4's _LT_CC_BASENAME. - -for cc_temp in $CC""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` - -# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. - -wl= -if test "$GCC" = yes; then - wl='-Wl,' -else - case "$host_os" in - aix*) - wl='-Wl,' - ;; - darwin*) - case $cc_basename in - xlc*) - wl='-Wl,' - ;; - esac - ;; - mingw* | cygwin* | pw32* | os2*) - ;; - hpux9* | hpux10* | hpux11*) - wl='-Wl,' - ;; - irix5* | irix6* | nonstopux*) - wl='-Wl,' - ;; - newsos6) - ;; - linux* | k*bsd*-gnu) - case $cc_basename in - icc* | ecc*) - wl='-Wl,' - ;; - pgcc | pgf77 | pgf90) - wl='-Wl,' - ;; - ccc*) - wl='-Wl,' - ;; - como) - wl='-lopt=' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - wl='-Wl,' - ;; - esac - ;; - esac - ;; - osf3* | osf4* | osf5*) - wl='-Wl,' - ;; - rdos*) - ;; - solaris*) - wl='-Wl,' - ;; - sunos4*) - wl='-Qoption ld ' - ;; - sysv4 | sysv4.2uw2* | sysv4.3*) - wl='-Wl,' - ;; - sysv4*MP*) - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - wl='-Wl,' - ;; - unicos*) - wl='-Wl,' - ;; - uts4*) - ;; - esac -fi - -# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. - -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no - -case "$host_os" in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - # Unlike libtool, we use -rpath here, not --rpath, since the documented - # option of GNU ld is called -rpath, not --rpath. - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - case "$host_os" in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - fi - ;; - amigaos*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we cannot use - # them. - ld_shlibs=no - ;; - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - interix[3-9]*) - hardcode_direct=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - gnu* | linux* | k*bsd*-gnu) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - netbsd*) - ;; - solaris*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' - else - ld_shlibs=no - fi - ;; - esac - ;; - sunos4*) - hardcode_direct=yes - ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - esac - if test "$ld_shlibs" = no; then - hardcode_libdir_flag_spec= - fi -else - case "$host_os" in - aix3*) - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - else - aix_use_runtimelinking=no - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - fi - hardcode_direct=yes - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - fi - # Begin _LT_AC_SYS_LIBPATH_AIX. - echo 'int main () { return 0; }' > conftest.c - ${CC} ${LDFLAGS} conftest.c -o conftest - aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` - if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` - fi - if test -z "$aix_libpath"; then - aix_libpath="/usr/lib:/lib" - fi - rm -f conftest.c conftest - # End _LT_AC_SYS_LIBPATH_AIX. - if test "$aix_use_runtimelinking" = yes; then - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - else - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - fi - fi - ;; - amigaos*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - bsdi[45]*) - ;; - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - libext=lib - ;; - darwin* | rhapsody*) - hardcode_direct=no - if test "$GCC" = yes ; then - : - else - case $cc_basename in - xlc*) - ;; - *) - ld_shlibs=no - ;; - esac - fi - ;; - dgux*) - hardcode_libdir_flag_spec='-L$libdir' - ;; - freebsd1*) - ld_shlibs=no - ;; - freebsd2.2*) - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - ;; - freebsd2*) - hardcode_direct=yes - hardcode_minus_L=yes - ;; - freebsd* | dragonfly*) - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - ;; - hpux9*) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - hpux10*) - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - hpux11*) - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - ;; - *) - hardcode_direct=yes - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - irix5* | irix6* | nonstopux*) - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - netbsd*) - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - ;; - newsos6) - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - else - case "$host_os" in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs=no - fi - ;; - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - osf3*) - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - osf4* | osf5*) - if test "$GCC" = yes; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - # Both cc and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - solaris*) - hardcode_libdir_flag_spec='-R$libdir' - ;; - sunos4*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - ;; - sysv4) - case $host_vendor in - sni) - hardcode_direct=yes # is this really true??? - ;; - siemens) - hardcode_direct=no - ;; - motorola) - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - ;; - sysv4.3*) - ;; - sysv4*MP*) - if test -d /usr/nec; then - ld_shlibs=yes - fi - ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - ;; - sysv5* | sco3.2v5* | sco5v6*) - hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' - hardcode_libdir_separator=':' - ;; - uts4*) - hardcode_libdir_flag_spec='-L$libdir' - ;; - *) - ld_shlibs=no - ;; - esac -fi - -# Check dynamic linker characteristics -# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. -# Unlike libtool.m4, here we don't care about _all_ names of the library, but -# only about the one the linker finds when passed -lNAME. This is the last -# element of library_names_spec in libtool.m4, or possibly two of them if the -# linker has special search rules. -library_names_spec= # the last element of library_names_spec in libtool.m4 -libname_spec='lib$name' -case "$host_os" in - aix3*) - library_names_spec='$libname.a' - ;; - aix4* | aix5*) - library_names_spec='$libname$shrext' - ;; - amigaos*) - library_names_spec='$libname.a' - ;; - beos*) - library_names_spec='$libname$shrext' - ;; - bsdi[45]*) - library_names_spec='$libname$shrext' - ;; - cygwin* | mingw* | pw32*) - shrext=.dll - library_names_spec='$libname.dll.a $libname.lib' - ;; - darwin* | rhapsody*) - shrext=.dylib - library_names_spec='$libname$shrext' - ;; - dgux*) - library_names_spec='$libname$shrext' - ;; - freebsd1*) - ;; - freebsd* | dragonfly*) - case "$host_os" in - freebsd[123]*) - library_names_spec='$libname$shrext$versuffix' ;; - *) - library_names_spec='$libname$shrext' ;; - esac - ;; - gnu*) - library_names_spec='$libname$shrext' - ;; - hpux9* | hpux10* | hpux11*) - case $host_cpu in - ia64*) - shrext=.so - ;; - hppa*64*) - shrext=.sl - ;; - *) - shrext=.sl - ;; - esac - library_names_spec='$libname$shrext' - ;; - interix[3-9]*) - library_names_spec='$libname$shrext' - ;; - irix5* | irix6* | nonstopux*) - library_names_spec='$libname$shrext' - case "$host_os" in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; - *) libsuff= shlibsuff= ;; - esac - ;; - esac - ;; - linux*oldld* | linux*aout* | linux*coff*) - ;; - linux* | k*bsd*-gnu) - library_names_spec='$libname$shrext' - ;; - knetbsd*-gnu) - library_names_spec='$libname$shrext' - ;; - netbsd*) - library_names_spec='$libname$shrext' - ;; - newsos6) - library_names_spec='$libname$shrext' - ;; - nto-qnx*) - library_names_spec='$libname$shrext' - ;; - openbsd*) - library_names_spec='$libname$shrext$versuffix' - ;; - os2*) - libname_spec='$name' - shrext=.dll - library_names_spec='$libname.a' - ;; - osf3* | osf4* | osf5*) - library_names_spec='$libname$shrext' - ;; - rdos*) - ;; - solaris*) - library_names_spec='$libname$shrext' - ;; - sunos4*) - library_names_spec='$libname$shrext$versuffix' - ;; - sysv4 | sysv4.3*) - library_names_spec='$libname$shrext' - ;; - sysv4*MP*) - library_names_spec='$libname$shrext' - ;; - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - library_names_spec='$libname$shrext' - ;; - uts4*) - library_names_spec='$libname$shrext' - ;; -esac - -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' -escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` -shlibext=`echo "$shrext" | sed -e 's,^\.,,'` -escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` -escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` -escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` - -LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. @@ -90,10 +90,18 @@ # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 - cygpath_u="sed s,\\\\\\\\,/,g" + cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what @@ -158,10 +166,12 @@ ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as -## well. +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; @@ -405,6 +415,52 @@ rm -f "$tmpdepfile" ;; +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test "$stat" = 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/ \1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/ / + G + p +}' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. @@ -503,7 +559,9 @@ touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation diff -Nru spice-gtk-0.9/build-aux/install-sh spice-gtk-0.12/build-aux/install-sh --- spice-gtk-0.9/build-aux/install-sh 2012-01-31 10:22:59.000000000 +0000 +++ spice-gtk-0.12/build-aux/install-sh 2012-04-24 11:21:03.000000000 +0000 @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2009-04-28.21; # UTC +scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -156,6 +156,10 @@ -s) stripcmd=$stripprog;; -t) dst_arg=$2 + # Protect names problematic for `test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac shift;; -T) no_target_directory=true;; @@ -186,6 +190,10 @@ fi shift # arg dst_arg=$arg + # Protect names problematic for `test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac done fi @@ -200,7 +208,11 @@ fi if test -z "$dir_arg"; then - trap '(exit $?); exit' 1 2 13 15 + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. @@ -228,9 +240,9 @@ for src do - # Protect names starting with `-'. + # Protect names problematic for `test' and other utilities. case $src in - -*) src=./$src;; + -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then @@ -252,12 +264,7 @@ echo "$0: no destination specified." >&2 exit 1 fi - dst=$dst_arg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst;; - esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. @@ -385,7 +392,7 @@ case $dstdir in /*) prefix='/';; - -*) prefix='./';; + [-=\(\)!]*) prefix='./';; *) prefix='';; esac @@ -403,7 +410,7 @@ for d do - test -z "$d" && continue + test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then diff -Nru spice-gtk-0.9/build-aux/missing spice-gtk-0.12/build-aux/missing --- spice-gtk-0.9/build-aux/missing 2012-01-31 10:22:59.000000000 +0000 +++ spice-gtk-0.12/build-aux/missing 2012-04-24 11:21:03.000000000 +0000 @@ -1,10 +1,10 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2009-04-28.21; # UTC +scriptversion=2012-01-06.13; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, -# 2008, 2009 Free Software Foundation, Inc. +# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -84,7 +84,6 @@ help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and @@ -122,15 +121,6 @@ # Not GNU programs, they don't have --version. ;; - tar*) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. @@ -226,7 +216,7 @@ \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then - eval LASTARG="\${$#}" + eval LASTARG=\${$#} case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` @@ -256,7 +246,7 @@ \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then - eval LASTARG="\${$#}" + eval LASTARG=\${$#} case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` @@ -318,41 +308,6 @@ touch $file ;; - tar*) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case $firstarg in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case $firstarg in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. diff -Nru spice-gtk-0.9/ChangeLog spice-gtk-0.12/ChangeLog --- spice-gtk-0.9/ChangeLog 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/ChangeLog 2012-04-24 11:26:38.000000000 +0000 @@ -1,3 +1,796 @@ +2012-04-24 Marc-André Lureau + + Release v0.12 + + Lower a few warnings when migration fails + +2012-04-24 Daniel P. Berrange + + Fix multiple problems with URI parsing + The URI parsing was not correctly skipping over the path component + if a port number was specified using the traditional URI scheme, + + eg + + spice://somehost:5900/ + + would result in failed parse due to the trailing '/' + + The URI parsing was also not considering that the authority + component is allowed to contain '[' and ']' around the hostname. + This is used when specifying raw IPv6 addresses to remove the + parsing ambiguity wrt ':'. + + eg + + spice://[::1]:5900/ + + Various stages of parsing also failed to report errors. + +2012-04-23 Uri Lublin + + setsockopt: check for ENOTSUP only if defined + For windows (mingw32) ENOTSUP is not defined. + + Related to 3bfadb8587f59a74d373e26385d348a105c2e425 + +2012-04-21 Marc-André Lureau + + Allow to disable CELT at runtime + We might want to make it a property, but having an environemnt variable + is useful too, to override behaviour. + + build-sys: pyparsing req. moved to spice-common + +2012-04-19 Daniel P. Berrange + + Fix callback signature for --spice-debug option handling + The callback for option handling should return TRUE otherwise the + option parser will think parsing failed. The current 'void' return + type meant it was non-deterministic whether --spice-debug actually + worked or not + +2012-04-16 Marc-André Lureau + + Clear cache and glz dictionnary on switch-host + If we don't clear the glz dictionnary, this might lead to + corrupted/invalid dictionnary and invalid memory allocation due + unbounded increase of dictionnary size + + Set new cert-subject when switching host + https://bugzilla.redhat.com/show_bug.cgi?id=802574 + + gtk: scroll event are not received with recent gtk+ + Add explicit scroll event mask to make it work again. + +2012-04-10 Marc-André Lureau + + Fix cursor hide not hiding in some cases + cursor_set() didn't un-hide correctly by setting "show_cursor" to + NULL. + + The code is simplified a bit in server mode case, where the new cursor + will be invalidated and shown during cursor move only, instead of + twice (checked no regression with dual-head server mode) + +2012-04-06 Marc-André Lureau + + Fix crash when closing while recording + First notify about disconnection before resetting the channel data. + An audio recording task might expect the channel to be in a ready + state otherwise, for example. + + https://bugzilla.redhat.com/show_bug.cgi?id=810247 + +2012-04-05 Marc-André Lureau + + agent: avoid use of alloca for sending large msg + Instead of allocating unbounded memory and doing extra copy on the + stack, let's just improve our helper function to send messages in + various pieces. + + See also: https://bugzilla.redhat.com/show_bug.cgi?id=809145 + +2012-04-04 Christophe Fergeau + + autogen.sh: default to --enable-vala when building from git + People using autogen.sh are likely to be building from git, so may + get updates to vala files at any time. Checking for the presence of + controller.vala.stamp to decide whether vala should be enabled or not + is not very accurate since it doesn't reflect if a .vala file needs + to be regenerated or not. + It's better to always pass --enable-vala to configure, it's always + possible to disable it by using --disable-vala as an autogen.sh argument. + + controller: handle USB redirection messages + + autogen.sh: log configure command line + Since --enable-vala may or may not be passed to configure, seeing + the actual command line that was used is helpful. + +2012-04-03 Marc-André Lureau + + fix build with glib < 2.32 + Reported and verified by Nicolas Prochazka + +2012-04-03 Hans de Goede + + SpiceDisplay: Fix rounding of mouse motion events with GTK-3.0 + Before this patch we were assuming that the GdkEventMotion value we receive + are always whole (integer) numbers, which is not the case with GTK-3.0. + + SpiceDisplay: Don't try to scale mouse coordinates when we're not scaling + Often (when not resized by the user) even though scaling is enabled, we are + not actually scaling. In this case it is not necessary to scale the + mouse coordinates, and sometimes it is even harmful. + +2012-04-03 Yonit Halperin + + controller: add support for DISABLE_EFFECTS and COLOR_DEPTH + rhbz #787449 + +2012-03-31 Marc-André Lureau + + Handle grab-broken event + This fixes the pointer being "trapped" in the center of the screen in + server-side mouse mode. It also correctly inform the client that the + pointer/keyboard is no longer grabbed so it can adjust its UI state + accordingly (remote the "press ctrl+alt to ungrab" messages etc). + + I can reproduce only with RHEVM22 host, and a RHEL6 guest, when + switching consoles. + + widget: fix invalid memory ref after channel is distroyed + When the display channel is destroyed, we disconnect all signals + handlers, but we don't remove the reference on the primary surface + data, and that can lead to crashes in a later expose event, reusing + the canvas surface (ex, if scaling is disabled). Call + primary_destroy() when disconnecting the channel from the widget. + + We now keep the primary surface during channel reset (right after + disconnect for example), so the primary surface can be eventually + recycled, and the widget still holds a valid reference until the + signal is received. The primary surface is ultimately destroyed during + finalize, or if the new primary surface size doesn't match. + + Program received signal SIGSEGV, Segmentation fault. + __memmove_ssse3_back () at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2130 + 2130 lddqu -68(%rsi), %xmm0 + Missing separate debuginfos, use: debuginfo-install gtk2-engines-2.20.2-2.fc15.x86_64 libusb1-1.0.9-0.3.rc1.fc16.x86_64 p11-kit-0.6-1.fc16.x86_64 + (gdb) bt + at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2130 + srclen=, srcinc=4096, destinc=68, height=, + half_order=0) at /usr/include/bits/string3.h:52 + dest_bits_per_pixel=32, req_yoffset=, req_xoffset=0, + image=0x7fffffffb9a0, req=, dpy=0x64a630) at PutImage.c:821 + req_height=, req_width=, y=, + x=0, req_yoffset=, req_xoffset=0, image=0x7fffffffb9a0, + gc=0xa817e0, d=33554452, dpy=0x64a630) at PutImage.c:870 + req_xoffset=0, req_yoffset=, x=0, y=26, req_width=17, + req_height=20, dest_bits_per_pixel=32, dest_scanline_pad=32) + at PutImage.c:908 + image=0x7fffffffb9a0, req_xoffset=0, req_yoffset=0, x=0, y=26, + req_width=17, req_height=20) at PutImage.c:1027 + image=, src_x=0, src_y=0, width=17, height=20, dst_x=0, + dst_y=26) at cairo-xlib-surface.c:1357 + ---Type to continue, or q to quit---c + height=20, width=17, dst_y=26, dst_x=0, src_y=, + src_x=, pattern=0x7fffffffc6b0, op=CAIRO_OPERATOR_OVER, + surface=0xb9a650) at cairo-xlib-surface.c:2403 + dst_y=26, dst_x=0, mask_y=0, mask_x=0, src_y=26, src_x=0, + abstract_dst=0xb9a650, mask_pattern=0x0, src_pattern=0x7fffffffc6b0, + op=CAIRO_OPERATOR_OVER) at cairo-xlib-surface.c:2452 + src_pattern=0x7fffffffc6b0, mask_pattern=0x0, abstract_dst=0xb9a650, + src_x=0, src_y=26, mask_x=0, mask_y=0, dst_x=0, dst_y=26, width=17, + height=20, clip_region=0x0) at cairo-xlib-surface.c:2415 + src=0x7fffffffc6b0, mask=0x0, dst=0xb9a650, src_x=0, src_y=26, mask_x=0, + mask_y=0, dst_x=0, dst_y=26, width=17, height=20, clip_region=0x0) + at cairo-surface.c:1802 + traps=0x7fffffffbee0, src=0x7fffffffc6b0, op=CAIRO_OPERATOR_OVER, + dst=0xb9a650) at cairo-surface-fallback.c:762 + op=CAIRO_OPERATOR_OVER, dst=0xb9a650, traps=0x7fffffffbee0, + antialias=CAIRO_ANTIALIAS_DEFAULT, clip=0x0, extents=0x7fffffffc600) + at cairo-surface-fallback.c:812 + ---Type to continue, or q to quit---bt + op=CAIRO_OPERATOR_OVER, source=0x7fffffffc6b0, clip=0x0) + at cairo-surface-fallback.c:935 + source=0x7fffffffc6b0, op=CAIRO_OPERATOR_OVER, surface=0xb9a650) + at cairo-surface.c:2027 + source=0x7fffffffc6b0, clip=0x7fffffffc7b0) at cairo-surface.c:1993 + at cairo-gstate.c:1049 + at spice-widget-cairo.c:104 + expose=0x7fffffffceb0) at spice-widget-cairo.c:133 + expose=0x7fffffffceb0) at spice-widget.c:885 + return_value=0x7fffffffca60, n_param_values=, + param_values=0x7fffffffcad0, invocation_hint=, + marshal_data=) at gtkmarshalers.c:86 + return_value=0x7fffffffca60, n_param_values=2, + param_values=0x7fffffffcad0, invocation_hint=) + ---Type to continue, or q to quit---c + at gclosure.c:777 + detail=0, instance=, emission_return=0x7fffffffccb0, + instance_and_params=0x7fffffffcad0) at gsignal.c:3584 + signal_id=, detail=0, var_args=) + at gsignal.c:3305 + signal_id=, detail=) at gsignal.c:3351 + event=0x7fffffffceb0) at gtkwidget.c:4999 + + mjpeg: fix blue-tinted video stream with old server + The major == 1 uses RGB colorspace for mjpeg streams. + +2012-03-30 Marc-André Lureau + + session: take pubkey reference in setter + The session assumed it owned a reference to it. + But it didn't get it, and that lead to invalid memory access. + + Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=802574 + + Be more tolerant on NULL arrays + 2 places where we should be more carreful with NULL arrays, and we can + avoid potential crashes. + +2012-03-29 Hans de Goede + + usb-device-widget: Call set_active on the toggle_button, not the alignment + Since the gnome HIG-ifying of usb-device-widget.c, the vbox contains + alignments, which in turn contain a toggle_button, so calling + gtk_toggle_button_set_active directly on the vbox-containers childdren is + wrong. + +2012-03-29 Uri Lublin + + usb-acl-helper: add a missing "break" + +2012-03-25 Marc-André Lureau + + build-sys: move codegen & proto to spice-common + With this iteration, all the spice_codegen.py/proto/marshaller + generation has been moved to spice-common. + + The spice-common directory will ship spice-protocol, since it's needed + there too to build libspice-common. + + Again, make distcheck passes. Build with mingw & fedora linux. + +2012-03-22 Marc-André Lureau + + Always release shm of primary surfaces + Always remove shared memory segment of primary surfaces when + destroying its canvas. + +2012-03-21 Marc-André Lureau + + controllers: signal when a client is connected + + controller: handle SEND_CAD message as a property + + Fix cursor not being shown in client mode in some cases + The following seems to happen: + - cursor-hide (for all cursor/display channels) + - cursor-set (for all cursor/display channels) + + All cursor/display channels receive cursor-set events when the cursor + is changed, however, only current display cursor should be drawn in + server-mode. How to know which display? + + So it will wait until cursor-move to draw it in server-mode on the + right display. + + In the case of client-mode cursor, it doesn't matter since it will + depend on which client display the pointer is, so it can be changed + immediately. + +2012-03-20 Marc-André Lureau + + build-sys: fix make distclean going twice in vapi dir + Don't use DIST_SUBDIRS, it's not needed anyway. + + build-sys: fix compilation of bindings + Hide symbol from API to fix pygobject. + + Also vapigen chokes on "record" typename + + SpiceClientGtk-3.0.gir:32.55-32.55: error: The type name `Gtk.BoxClass' could not be found + + This seems to be a bug in symbol lookup in vapigen. Using a struct + typedef solves it. + + doc: gtk-doc cleanup + Fix all the unused symbols and a few warnings (a lot left) + + Add SPICE_DISABLE_DEPRECATED guard + + build-sys: improve maintainer clean + + build-sys: use new git.mk + +2012-03-19 Marc-André Lureau + + Hide cursor when it is on a different screen in server mode + When the cursor shape is changed, all the cursor channels are + updated. The current code assumed that the "set" of the shape should + show the cursor, but it should stay hidden instead. + + Also, when the cursor is hidden, we must invalidate its current + region to redraw display. + + Fix: https://bugzilla.redhat.com/show_bug.cgi?id=804308 + +2012-03-18 Marc-André Lureau + + Do not grab display widget + We used to gtk_grab_add() after mouse grab to limit the mouse events + to the display. But it isn't necessary if the display has its own + window, since gdk_pointer_grab() will be limited to it. + + Note the widget has the keyboard focus & is focused, so this doesn't + affect keyboard events. + + However, this allows application to keep global accelerators + functionning if they want to (like virt-viewer with custom key + bindings). + + Notify agent-connected property change + + Improve spice_main_set_display_enabled() + Check given display id is within the range of array. + Allows to be call with -1 to turn set all displays. + + Fix non-semi-seamless migration in spicy + The windows are destroyed during non-semi-seamless migrations, but the + gtk session and connected handlers remains. When a property changes + again on it, it will signal a destroyed window and lead to a crash. + + The signal handler should be disconnected when the window is + destroyed. Since we have N numbers of handlers, it's easier to use + spice_signal_connect_object() helper to handle this for us by turning + spice_window structure into a basic GObject. + + That GObject code could be improved, but that wasn't the goal of this + patch. + + Use given color depth in monitor configuration + The main channel only relied on + VD_AGENT_DISPLAY_CONFIG_FLAG_SET_COLOR_DEPTH to set color depth when + connecting to a guest. However, that doesn't seem to be + enough. Instead send given color depth with monitor configuration. + + Fix --spice-color-depth option not "apparently" working. + +2012-03-16 Marc-André Lureau + + build-sys: if stow is installed, default prefix to it + This is going to make life easier for stow users, including myself. + + build: fix build with glib < 2.32 + Using GMutex as a static mutex is only possible since 2.32. + + Add a G_GNUC_NORETURN to a function that exits + +2012-03-15 Marc-André Lureau + + use common submodule + + Fix incorrect array size check + +2012-03-14 Marc-André Lureau + + Move undef FORTIFY below config.h + It used to be below, then was moved on top of all, but now it's + defined in config.h. Hopefully below config.h is the right + place. config.h should never have direct includes anyway. + +2012-03-14 Hans de Goede + + buildsys: Disable some warnings + Mostly so that they don't turn into errors when building from source: + -Wno-missing-field-initializers: + Because this has to be close to the most stupid warning gcc has ever produced + -Wno-deprecated-declarations + Because we use some deprecated functions to avoid #ifdef hell while maintaining + compat with older gtk / glib versions + + usbredir: Check for existing usb channels after libusb init + Currently trying to view a usbredir enabled vm from virt-manager causes + virt-manager to crash. This crash is caused by the following happening: + + -virt-manager sets up the session, including connecting all the channels + -a spice-gtk internal code path calls spice_usb_device_manager_get() + -spice_usb_device_manager_get calls channel_new on all already connected + usb channels + -channel_new does: + spice_usbredir_channel_set_context(SPICE_USBREDIR_CHANNEL(channel), + self->priv->context); + -But self->priv->context has not been set yet (so is NULL) -> segfault! + + This patch fixes this by moving the iterating over already connected + usb channels to after the setting of self->priv->context. Note this means + that the channels will no longer get checked when there is no USB_REDIR + support. That is not a problem since spice_usb_device_manager_initable_init + will return FALSE in that case anyways. + +2012-03-14 Marc-André Lureau + + Use GTK_DISABLE_DEPRECATED to avoid inclusion of problematic headers + /usr/i686-w64-mingw32/sys-root/mingw/include/gtk-2.0/gtk/gtkitemfactory.h:47:1: error: function declaration isn't a prototype [-Werror=strict-prototypes] + + Fix 'libintl_printf' is an unrecognized format function + ../common/lz.h:18:5: error: 'libintl_printf' is an unrecognized format function type [-Werror=format] + + Remove deprecation warnings + +2012-03-14 Daniel P. Berrange + + Disable -Wwrite-strings for Python binding + The code generator for the python binding generates code which + throws away const-ness on strings. Disable the -Wwrite-strings + warning to avoid failing on this auto-generated code. + +2012-03-13 Daniel P. Berrange + + Replace %02hhx with %02x in UUID format + Use of 'hh' in the UUID format string is not required. Furthermore + it causes errors on Mingw32, where the 'hh' modifier is not supported + + Import GNULIB's GCC warning macros + GNULIB has a helpful module 'manywarnings' which makes it easy + to turn on every single GCC warning. The general goal is that + every possible GCC warning should be enabled, except for certain + blacklisted warnings. + + This imports the GNULIB m4 macros, and updates configure.ac to + use this new capability. As & when new GCC warnings are created, + the 'manywarnings.m4' can be refreshed from upstream GNULIB + + * m4/manywarnings.m4, m4/warnings.m4: GNULIB warning macros + * configure.ac: Remove custom compiler warning checks + * m4/spice-compile-warnings.m4: Decide what GCC warnings to enable + + Avoid 'goto' jumping over variable initialization + When a goto statement jumps over a variable declaration with an + initializer, the state of that variable is undefined. Move the + declaration further up, so that the goto doesn't jump over it. + This lets the compiler then warn, if the goto jump results in + use of undefined values. + + Fix no-arg functions declared () to use (void) + * common/quic.h, common/rop3.h, common/sw_canvas.h: s/()/(void)/ + + Add missing includes & make some functions static + A number of functions were used without prior declaration. In + some cases this was due to missing include files. In other cases + the functions should have just been static. + + Ideally this would allow -Wmissing-declarations to be enabled, but + the files generated by spice_codegen.py will still trip up on this. + + Ensure all no-args methods are declared (void) not () + * common/quic.c, common/rop3.c, common/sw_canvas.c, + gtk/spice-client-glib-usb-acl-helper.c: s/()/(void)/ + + Add printf format annotations to all '...' functions + To allow the compile to detect incorrect printf formats, any + var-args function should have a format annotation + + * common/macros.h: Helper to define ATTR_PRINTF for code + which can't depend on glib + * common/canvas_base.c, common/lz.h, common/macros.h: Annotate + some var-args methods + + Replace duplicated header declarations + The usb-helper-acl.h header file duplicated some declarations + already present in usb-device-manager.h + + The channel-display.c file declared the object init function + which is already done by the GObject helper macros + + * gtk/channel-display.c: Remove duplicate decl of init function + * gtk/usb-acl-helper.h: Remove duplicate decls + + Remove arithmetic on void* pointers + Arithmetic on void * pointers is undefined by the C standard. + Convert the one case of this to use guint8 instead. + + * gtk/channel-main.c: s/void */guint8 */ + + Fix some integer range checks which always evaluate false + There are some integer range checks which always evaluate false + due to use of unsigned integer types. One of these would prevent + detection of encoding errors from celt. The others are simply + no-ops. + + * gtk/channel-record.c: Make 'frame_size' signed to allow detection + of celt encoding errors + * gtk/spicy.c: nkeys is an unsigned type, so checks for nkeys < 0 are bogus + * common/pixman_utils.c: SpiceROP is an enum & thus unsigned + + Avoid warnings about empty conditional statement bodies + Add extra {} braces around if/else statements which only + call SPICE_DEBUG to avoid: + + ../common/ssl_verify.c: In function 'verify_pubkey': + ../common/ssl_verify.c:87:50: warning: suggest braces around empty body in an 'else' statement [-Wempty-body] + ../common/ssl_verify.c: In function 'verify_hostname': + ../common/ssl_verify.c:254:53: warning: suggest braces around empty body in an 'if' statement [-Wempty-body] + ../common/ssl_verify.c: In function 'verify_subject': + ../common/ssl_verify.c:381:41: warning: suggest braces around empty body in an 'else' statement [-Wempty-body] + + Fix deprecation warning handling + Various methods are deprecated by using the G_GNUC_DEPRECATED_FOR + macro. Unfortunately this macro was placed in the .c file impl, + instead of the .h file decl. Thus applications building against + SPICE-GTK would never see the deprecation warnings. At the same + time, building SPICE-GTK itself would trigger some of the warnings + preventing use of -Wdeprecated-declarations to detect use of + deprecated GTK functions. + + The fix is in multiple parts + + * Replace calls to G_GNUC_DEPRECATED_FOR with SPICE_DEPRECATED_FOR + * Move macros from .c to .h files + * Turn SPICE_DEPRECATED_FOR into a no-op if SPICE_NO_DEPRECATED + is defined + * Define SPICE_NO_DEPRECATED when building + + Fix old style declaration where 'inline' came after return type + Fix a case of 'static int inline' to be 'static inline int' + + Fix const-correctness of functions & add explicit casts + Some functions should be declared to take const char * instead + of plain char *. In other places we intentionally cast away + const-ness, so we should add explicit casts to stop compiler + warnings + + Remove non-existant include directories from CFLAGS + + Don't delete gtk-doc.make in distclean + gtk-doc.make is created by autogen.sh, therefore it should + not be deleted in distclean, only maintainerclean + +2012-03-08 Marc-André Lureau + + Release v0.11 + + Update since annotation for some session properties + +2012-03-08 Hans de Goede + + channel-usbredir: Handle some more usbredirhost_read_guest_data errors + +2012-03-07 Marc-André Lureau + + Do not warn when starting spicy if usbredir is disabled + + sasl: sasl authentication failure results in disconnection + When SASL auth failure happen, the Spice server disconnects the + client. Sadly, this is not easily distinguishable from an IO error. + However, since it happens during authentication phase it is better to + error out an authentication error. + + sasl: lower visibility of normal debug message + Those two g_critical() can happen when collecting credentials for the + first time. It is not something to be warned about, but merely useful + for debugging + + build: move @SPICE_GLIB_REQUIRES@ to Requires.private + The libraries listed in Requires aren't needed during build time, they + are library depedencies. And since this is only needed if linking + statically, we can safely move them to Requires.private. + + Succesfully tested change with compilation against virt-viewer. + + Later, this will also help fixing bug rhbz #799112. + +2012-03-06 Marc-André Lureau + + Fix semi-seamless migration handling + SPICE_MSGC_MAIN_MIGRATE_END was dropped because the main channel was + xmit_queue_blocked. When we swap the channels, we should also swap + xmit_queue. + +2012-03-05 Marc-André Lureau + + Warn if a message is dropped (before connection or after reset) + Since c2ba62666beaee526e1b4288f9bd66976ce780ef messages can be ignored + when a channel is reset. A warning can help explain why some messages + are dropped. + + Support name & uuid + Allows a client to identify the server it is connected to. + +2012-02-29 Marc-André Lureau + + Add a spice-controller-dump testing tool + By default, start a controller listener. + If ran with --menu, start a foreign-menu listener. + + Add controller foreign menu support + + Fix a few warnings on windows build + + Allow open_fd() to be called with -1 + In this case, a valid fd will be requested via the + SpiceChannel::open-fd signal. + +2012-02-24 Hans de Goede + + buildsys: Don't link glib-compat.o into libspice-client-gtk.so + glib-compat.c was added to SPICE_GTK_SOURCES_COMMON since with the + new SpiceUsbDeviceWidget libspice-client-gtk now also uses G_TYPE_ERROR + and when compiling with an older glib this gets defined in glib-compat.o + + However doing this turns out to be a very BAD idea, since having + glib-compat.o linked into 2 different libraries, each defining there + own private spice_error_get_type, leads to the "GError" type getting + registered twice with glib, which it does not like. + + So instead of linking glib-compat into 2 different libraries, put it only + in libspice-client-glib and export spice_error_get_type from + libspice-client-glib (this is ofcourse intended for libspice-client-gtk + private use only). + + Fix building with policykit < 0.101 + +2012-02-23 Marc-André Lureau + + Release v0.10 + + use :glz-window-size not :glz_window_size + + build: fix build with recent mingw64 + Christophe did similar patches for common/ directory in spice. Some + day, we should try to sync and move common/ to a spice-common + project... + +2012-02-22 Hans de Goede + + usbredir: Add awareness of host/guest side filtering + + usbredir: Add a spice_usb_device_manager_can_redirect_device function + Add a spice_usb_device_manager_can_redirect_device function and use this + in SpiceUsbDeviceWidget to check if redirection is available. + + usb-device-widget: Use an info_bar for error messages + And in general gnome-hig-ify usb-device-widget: + * Use spacing instead of padding so that there is no padding at the + outside/border of the widget, allowing the user to control the border size. + * Use multiple of 6 as spacing / indentation values + * Show the label left justified and bold, show the checkboxes (and the info + bar) 12 pixels indented from the label + + configure: Fix "USB redirection support" summary on --disable-usbredir + When running "./configure --disable-usbredir" the + "USB redirection support" line in the summary at the end of ./configure + would be empty after "support" instead of ending with yes or no. + + usbredir: Treat the user cancelling the policykit dialog as a cancel + Rather then treating it as any other error. This avoids showing an error + dialog after the user pressed cancel in the policykit dialog. + + usbredir: Add device rejected errors + +2012-02-22 Marc-André Lureau + + RFC: Use spice protocol as a submodule + Spice protocol contains only headers. We would like to be able to use + a protocol update without having to wait for the release, a git + submodule works well for this purpose. + +2012-02-20 Marc-André Lureau + + Fix make distcheck + +2012-02-20 Hans de Goede + + usbredir: Shrink the usb device selection dialog when devices are unplugged + + usbredir: make channel lifetime equal to session lifetime + + usbutil: Add support for getting strings from usb.ids + Unfortunately not all device makers go to the "trouble" of adding device + identification strings to a device's descriptors. This patch makes spice-gtk + translate vid/pid into strings if the device lacks the strings. + + usbutil: Add a spice_usb_util_get_device_strings helper function + + usb: Move various helper functions into usbutil.[c,h] + +2012-02-17 Marc-André Lureau + + Add controller ENABLE_SMARTCARD message + +2012-02-13 Marc-André Lureau + + widget: fix mouse wrapping failing when the window is outside + Use a anchor mouse position after every move, similar to spicec to + avoid reaching transparent border on the screen. + + We try to move to the center of the screen, but + gdk_display_warp_pointer () will move the cursor within the grabbed + window (so it still receives mouse events even on Windows) + + Tested with Linux and Windows clients. + + Fixes bug: https://bugs.freedesktop.org/show_bug.cgi?id=45595 + +2012-02-13 Nicolas Prochazka + + Set keepalive on channel socket + Without keepalive on each connection(channel), channel is destroyed + after ip_conntrack_tcp_timeout_established timeout. + + https://bugs.freedesktop.org/show_bug.cgi?id=45899 + +2012-02-12 Marc-André Lureau + + Use an openssl BIO stream using GSocket + Until now, the BIO object used by openssl to read & write was using + the socket fd directly. But the mainloop integration is done with + GSocket. + + On Windows, the read/write events are cleared after + g_socket_send()/receive() with private function + _win32_unset_event_mask. If the glib functions aren't cleared, glib + source will keep notifying of data available in or out. On Windows, + this causes a busy loop when doing SSL_read() for example (glib + POLL_IN data condition is reached and SSL_read() return needs data). + + Instead, openssl should read/write using GSocket methods. + +2012-02-09 Daniel P. Berrange + + Don't warn if setsockopt(TCP_NDELAY) fails with errno==ENOTSUP + If connecting to a UNIX domain socket, it is expected that the + setsockopt(TCP_NDELAY) call will fail with errno=ENOTSUP, so don't + issue a warning in that case + +2012-02-08 Christophe Fergeau + + Link with usbredirparser + spice-gtk uses usbredirfilter_string_to_rules which is defined + in usbredirparser but does not link with it. This causes link errors + on some distributions. Fixes fdo bug #45761. + +2012-02-03 Marc-André Lureau + + Lower or silence some harmless debug messages + +2012-02-01 Marc-André Lureau + + widget: allow defining a zoom-level + Add a "zoom-level" property. Maintain the given scaling ratio when + scaling is enabled. + + If scaling is disabled, this property is ignored. + + For example at 50%, this allows to fit a 640x480 desktop in a 320x240 + widget and when resizing it to 640x512 to have a 1280x1024 desktop. + + (this feature is required by virt-viewer) + + widget: factor out update_size_request() and scaling_updated() + Factor out and simplify a little the code to allow easier addition of + zoom-level property. + + The "set_display" parameter for recalc_geometry() seems to be useless, + since the code was apparently trying to set the guest to the given + d->width and d->height, but reseting it to the current value, which + cancel the effect. + + We should fix the problem of setting the guest resolution at + display-init time in a follow-up patch since it probably never worked + with spice-gtk. + +2012-01-31 Marc-André Lureau + + Report the scaling is 1.0 if the widget isn't realized yet + To avoid a few warnings in some corner cases. + + Do not grab/release the clipboard on guest without clipboard support + Add an agent capability check before calling those functions from + gtk-session. Avoid extra warnings. + 2012-01-31 Hans de Goede Release 0.9 diff -Nru spice-gtk-0.9/common/canvas_base.c spice-gtk-0.12/common/canvas_base.c --- spice-gtk-0.9/common/canvas_base.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/canvas_base.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3426 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#include -#include -#include -#include -#include - -#include -#include "quic.h" -#include "lz.h" -#include "canvas_base.h" -#include "pixman_utils.h" -#include "canvas_utils.h" -#include "rect.h" -#include "lines.h" -#include "rop3.h" -#include "mem.h" - -#include "mutex.h" - -#ifndef spice_return_if_fail -#define spice_return_if_fail(x) if (!(x)) { \ - fprintf(stderr, "(%s:%d) %s: condition %s failed\n", __FILE__, __LINE__, __FUNCTION__, #x); \ - return; \ -} -#endif - -#ifndef spice_return_val_if_fail -#define spice_return_val_if_fail(x, val) if (!(x)) { \ - fprintf(stderr, "(%s:%d) %s: condition %s failed\n", __FILE__, __LINE__, __FUNCTION__, #x); \ - return (val); \ -} -#endif - -#ifndef spice_warn_if_reached -#define spice_warn_if_reached() do { \ - fprintf(stderr, "(%s:%d) %s: should not be reached", __FILE__, __LINE__, __FUNCTION__); \ -}while(0) -#endif - -#ifndef spice_warning -#define spice_warning(x) do { \ - fprintf(stderr, "(%s:%d) %s: warning %s", __FILE__, __LINE__, __FUNCTION__, (x)); \ -} while(0) -#endif - -#ifndef spice_critical -#define spice_critical(x) do { \ - fprintf(stderr, "(%s:%d) %s: CRITICAL %s", __FILE__, __LINE__, __FUNCTION__, (x)); \ -} while(0) -#endif - -#define ROUND(_x) ((int)floor((_x) + 0.5)) - -#define IS_IMAGE_LOSSY(descriptor) \ - (((descriptor)->type == SPICE_IMAGE_TYPE_JPEG) || \ - ((descriptor)->type == SPICE_IMAGE_TYPE_JPEG_ALPHA)) - - static inline int fix_to_int(SPICE_FIXED28_4 fixed) -{ - int val, rem; - - rem = fixed & 0x0f; - val = fixed >> 4; - if (rem > 8) { - val++; - } - return val; -} - - static inline SPICE_FIXED28_4 int_to_fix(int v) -{ - return v << 4; -} - -static inline double fix_to_double(SPICE_FIXED28_4 fixed) -{ - return (double)(fixed & 0x0f) / 0x0f + (fixed >> 4); -} - -static inline uint16_t rgb_32_to_16_555(uint32_t color) -{ - return - (((color) >> 3) & 0x001f) | - (((color) >> 6) & 0x03e0) | - (((color) >> 9) & 0x7c00); -} -static inline uint16_t rgb_32_to_16_565(uint32_t color) -{ - return - (((color) >> 3) & 0x001f) | - (((color) >> 5) & 0x07e0) | - (((color) >> 8) & 0xf800); -} - -static inline uint32_t canvas_16bpp_to_32bpp(uint32_t color) -{ - uint32_t ret; - - ret = ((color & 0x001f) << 3) | ((color & 0x001c) >> 2); - ret |= ((color & 0x03e0) << 6) | ((color & 0x0380) << 1); - ret |= ((color & 0x7c00) << 9) | ((color & 0x7000) << 4); - - return ret; -} -#if defined(WIN32) && defined(GDI_CANVAS) -static HDC create_compatible_dc() -{ - HDC dc = CreateCompatibleDC(NULL); - - spice_return_val_if_fail(dc != NULL, NULL); - - return dc; -} - -#endif - -typedef struct LzData { - LzUsrContext usr; - LzContext *lz; - LzDecodeUsrData decode_data; - jmp_buf jmp_env; - char message_buf[512]; -} LzData; - -typedef struct GlzData { - SpiceGlzDecoder *decoder; - LzDecodeUsrData decode_data; -} GlzData; - -typedef struct QuicData { - QuicUsrContext usr; - QuicContext *quic; - jmp_buf jmp_env; - char message_buf[512]; - SpiceChunks *chunks; - uint32_t current_chunk; -} QuicData; - -typedef struct CanvasBase { - SpiceCanvas parent; - uint32_t color_shift; - uint32_t color_mask; - QuicData quic_data; - - uint32_t format; - int width; - int height; - pixman_region32_t canvas_region; - -#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) - SpiceImageCache *bits_cache; -#endif -#ifdef SW_CANVAS_CACHE - SpicePaletteCache *palette_cache; -#endif -#ifdef WIN32 - HDC dc; -#endif - - SpiceImageSurfaces *surfaces; - - LzData lz_data; - GlzData glz_data; - SpiceJpegDecoder* jpeg; - SpiceZlibDecoder* zlib; - - void *usr_data; - spice_destroy_fn_t usr_data_destroy; -} CanvasBase; - -typedef enum { - ROP_INPUT_SRC, - ROP_INPUT_BRUSH, - ROP_INPUT_DEST -} ROPInput; - -static SpiceROP ropd_descriptor_to_rop(int desc, - ROPInput src_input, - ROPInput dest_input) -{ - int old; - int invert_masks[] = { - SPICE_ROPD_INVERS_SRC, - SPICE_ROPD_INVERS_BRUSH, - SPICE_ROPD_INVERS_DEST - }; - - old = desc; - - desc &= ~(SPICE_ROPD_INVERS_SRC | SPICE_ROPD_INVERS_DEST); - if (old & invert_masks[src_input]) { - desc |= SPICE_ROPD_INVERS_SRC; - } - - if (old & invert_masks[dest_input]) { - desc |= SPICE_ROPD_INVERS_DEST; - } - - if (desc & SPICE_ROPD_OP_PUT) { - if (desc & SPICE_ROPD_INVERS_SRC) { - if (desc & SPICE_ROPD_INVERS_RES) { - return SPICE_ROP_COPY; - } - return SPICE_ROP_COPY_INVERTED; - } else { - if (desc & SPICE_ROPD_INVERS_RES) { - return SPICE_ROP_COPY_INVERTED; - } - return SPICE_ROP_COPY; - } - } else if (desc & SPICE_ROPD_OP_OR) { - - if (desc & SPICE_ROPD_INVERS_RES) { - if (desc & SPICE_ROPD_INVERS_SRC) { - if (desc & SPICE_ROPD_INVERS_DEST) { - /* !(!src or !dest) == src and dest*/ - return SPICE_ROP_AND; - } else { - /* ! (!src or dest) = src and !dest*/ - return SPICE_ROP_AND_REVERSE; - } - } else { - if (desc & SPICE_ROPD_INVERS_DEST) { - /* !(src or !dest) == !src and dest */ - return SPICE_ROP_AND_INVERTED; - } else { - /* !(src or dest) */ - return SPICE_ROP_NOR; - } - } - } else { - if (desc & SPICE_ROPD_INVERS_SRC) { - if (desc & SPICE_ROPD_INVERS_DEST) { - /* !src or !dest == !(src and dest)*/ - return SPICE_ROP_NAND; - } else { - /* !src or dest */ - return SPICE_ROP_OR_INVERTED; - } - } else { - if (desc & SPICE_ROPD_INVERS_DEST) { - /* src or !dest */ - return SPICE_ROP_OR_REVERSE; - } else { - /* src or dest */ - return SPICE_ROP_OR; - } - } - } - - } else if (desc & SPICE_ROPD_OP_AND) { - - if (desc & SPICE_ROPD_INVERS_RES) { - if (desc & SPICE_ROPD_INVERS_SRC) { - if (desc & SPICE_ROPD_INVERS_DEST) { - /* !(!src and !dest) == src or dest*/ - return SPICE_ROP_OR; - } else { - /* ! (!src and dest) = src or !dest*/ - return SPICE_ROP_OR_REVERSE; - } - } else { - if (desc & SPICE_ROPD_INVERS_DEST) { - /* !(src and !dest) == !src or dest */ - return SPICE_ROP_OR_INVERTED; - } else { - /* !(src and dest) */ - return SPICE_ROP_NAND; - } - } - } else { - if (desc & SPICE_ROPD_INVERS_SRC) { - if (desc & SPICE_ROPD_INVERS_DEST) { - /* !src and !dest == !(src or dest)*/ - return SPICE_ROP_NOR; - } else { - /* !src and dest */ - return SPICE_ROP_AND_INVERTED; - } - } else { - if (desc & SPICE_ROPD_INVERS_DEST) { - /* src and !dest */ - return SPICE_ROP_AND_REVERSE; - } else { - /* src and dest */ - return SPICE_ROP_AND; - } - } - } - - } else if (desc & SPICE_ROPD_OP_XOR) { - - if (desc & SPICE_ROPD_INVERS_RES) { - if (desc & SPICE_ROPD_INVERS_SRC) { - if (desc & SPICE_ROPD_INVERS_DEST) { - /* !(!src xor !dest) == !src xor dest */ - return SPICE_ROP_EQUIV; - } else { - /* ! (!src xor dest) = src xor dest*/ - return SPICE_ROP_XOR; - } - } else { - if (desc & SPICE_ROPD_INVERS_DEST) { - /* !(src xor !dest) == src xor dest */ - return SPICE_ROP_XOR; - } else { - /* !(src xor dest) */ - return SPICE_ROP_EQUIV; - } - } - } else { - if (desc & SPICE_ROPD_INVERS_SRC) { - if (desc & SPICE_ROPD_INVERS_DEST) { - /* !src xor !dest == src xor dest */ - return SPICE_ROP_XOR; - } else { - /* !src xor dest */ - return SPICE_ROP_EQUIV; - } - } else { - if (desc & SPICE_ROPD_INVERS_DEST) { - /* src xor !dest */ - return SPICE_ROP_EQUIV; - } else { - /* src xor dest */ - return SPICE_ROP_XOR; - } - } - } - - } else if (desc & SPICE_ROPD_OP_BLACKNESS) { - return SPICE_ROP_CLEAR; - } else if (desc & SPICE_ROPD_OP_WHITENESS) { - return SPICE_ROP_SET; - } else if (desc & SPICE_ROPD_OP_INVERS) { - return SPICE_ROP_INVERT; - } - return SPICE_ROP_COPY; -} - -//#define DEBUG_DUMP_COMPRESS -#ifdef DEBUG_DUMP_COMPRESS -static void dump_surface(pixman_image_t *surface, int cache); -#endif - - -static pixman_format_code_t canvas_get_target_format(CanvasBase *canvas, - int source_has_alpha) -{ - pixman_format_code_t format; - - /* Convert to target surface format */ - format = spice_surface_format_to_pixman (canvas->format); - - if (source_has_alpha) { - /* Even though the destination has no alpha, we make the source - * remember there are alpha bits instead of throwing away this - * information. The results are the same if alpha is not - * interpreted, and if need to interpret alpha, don't use - * conversion to target format. - * This is needed for instance when doing the final - * canvas_get_target_format() in canvas_get_image_internal - * as otherwise we wouldn't know if the bitmap source - * really had alpha. - */ - if (format == PIXMAN_x8r8g8b8) { - format = PIXMAN_a8r8g8b8; - } - } else { /* !source_has_alpha */ - /* If the source doesn't have alpha, but the destination has, - don't convert to alpha, since that would just do an unnecessary - copy to fill the alpha bytes with 0xff which is not expected if - we just use the raw bits, (and handled implicitly by pixman if - we're interpreting data) */ - if (format == PIXMAN_a8r8g8b8) { - format = PIXMAN_x8r8g8b8; - } - } - - return format; -} - -static pixman_image_t *canvas_get_quic(CanvasBase *canvas, SpiceImage *image, - int invers, int want_original) -{ - pixman_image_t *surface = NULL; - QuicData *quic_data = &canvas->quic_data; - QuicImageType type, as_type; - pixman_format_code_t pixman_format; - uint8_t *dest; - int stride; - int width; - int height; - - if (setjmp(quic_data->jmp_env)) { - pixman_image_unref(surface); - spice_warning(quic_data->message_buf); - return NULL; - } - - quic_data->chunks = image->u.quic.data; - quic_data->current_chunk = 0; - - if (quic_decode_begin(quic_data->quic, - (uint32_t *)image->u.quic.data->chunk[0].data, - image->u.quic.data->chunk[0].len >> 2, - &type, &width, &height) == QUIC_ERROR) { - spice_warning("quic decode begin failed"); - return NULL; - } - - switch (type) { - case QUIC_IMAGE_TYPE_RGBA: - as_type = QUIC_IMAGE_TYPE_RGBA; - pixman_format = PIXMAN_a8r8g8b8; - break; - case QUIC_IMAGE_TYPE_RGB32: - case QUIC_IMAGE_TYPE_RGB24: - as_type = QUIC_IMAGE_TYPE_RGB32; - pixman_format = PIXMAN_x8r8g8b8; - break; - case QUIC_IMAGE_TYPE_RGB16: - if (!want_original && - (canvas->format == SPICE_SURFACE_FMT_32_xRGB || - canvas->format == SPICE_SURFACE_FMT_32_ARGB)) { - as_type = QUIC_IMAGE_TYPE_RGB32; - pixman_format = PIXMAN_x8r8g8b8; - } else { - as_type = QUIC_IMAGE_TYPE_RGB16; - pixman_format = PIXMAN_x1r5g5b5; - } - break; - case QUIC_IMAGE_TYPE_INVALID: - case QUIC_IMAGE_TYPE_GRAY: - default: - spice_warn_if_reached(); - return NULL; - } - - spice_return_val_if_fail((uint32_t)width == image->descriptor.width, NULL); - spice_return_val_if_fail((uint32_t)height == image->descriptor.height, NULL); - - surface = surface_create( -#ifdef WIN32 - canvas->dc, -#endif - pixman_format, - width, height, FALSE); - - spice_return_val_if_fail(surface != NULL, NULL); - - dest = (uint8_t *)pixman_image_get_data(surface); - stride = pixman_image_get_stride(surface); - if (quic_decode(quic_data->quic, as_type, - dest, stride) == QUIC_ERROR) { - pixman_image_unref(surface); - spice_warning("quic decode failed"); - return NULL; - } - - if (invers) { - uint8_t *end = dest + height * stride; - for (; dest != end; dest += stride) { - uint32_t *pix; - uint32_t *end_pix; - - pix = (uint32_t *)dest; - end_pix = pix + width; - for (; pix < end_pix; pix++) { - *pix ^= 0xffffffff; - } - } - } - -#ifdef DEBUG_DUMP_COMPRESS - dump_surface(surface, 0); -#endif - return surface; -} - - -//#define DUMP_JPEG -#ifdef DUMP_JPEG -static int jpeg_id = 0; -static void dump_jpeg(uint8_t* data, int data_size) -{ - char file_str[200]; - uint32_t id = ++jpeg_id; - -#ifdef WIN32 - sprintf(file_str, "c:\\tmp\\spice_dump\\%u.jpg", id); -#else - sprintf(file_str, "/tmp/spice_dump/%u.jpg", id); -#endif - - FILE *f = fopen(file_str, "wb"); - if (!f) { - return; - } - - fwrite(data, 1, data_size, f); - fclose(f); -} -#endif - -static pixman_image_t *canvas_get_jpeg(CanvasBase *canvas, SpiceImage *image, int invers) -{ - pixman_image_t *surface = NULL; - int stride; - int width; - int height; - uint8_t *dest; - - spice_return_val_if_fail(image->u.jpeg.data->num_chunks == 1, NULL); - canvas->jpeg->ops->begin_decode(canvas->jpeg, image->u.jpeg.data->chunk[0].data, image->u.jpeg.data->chunk[0].len, - &width, &height); - spice_return_val_if_fail((uint32_t)width == image->descriptor.width, NULL); - spice_return_val_if_fail((uint32_t)height == image->descriptor.height, NULL); - - surface = surface_create( -#ifdef WIN32 - canvas->dc, -#endif - PIXMAN_x8r8g8b8, - width, height, FALSE); - if (surface == NULL) { - spice_warning("create surface failed"); - return NULL; - } - - dest = (uint8_t *)pixman_image_get_data(surface); - stride = pixman_image_get_stride(surface); - - canvas->jpeg->ops->decode(canvas->jpeg, dest, stride, SPICE_BITMAP_FMT_32BIT); - - if (invers) { - uint8_t *end = dest + height * stride; - for (; dest != end; dest += stride) { - uint32_t *pix; - uint32_t *end_pix; - - pix = (uint32_t *)dest; - end_pix = pix + width; - for (; pix < end_pix; pix++) { - *pix ^= 0x00ffffff; - } - } - } -#ifdef DUMP_JPEG - dump_jpeg(image->u.jpeg.data, image->u.jpeg.data_size); -#endif - return surface; -} - -static pixman_image_t *canvas_get_jpeg_alpha(CanvasBase *canvas, - SpiceImage *image, int invers) -{ - pixman_image_t *surface = NULL; - int stride; - int width; - int height; - uint8_t *dest; - int alpha_top_down = FALSE; - LzData *lz_data = &canvas->lz_data; - LzImageType lz_alpha_type; - uint8_t *comp_alpha_buf = NULL; - uint8_t *decomp_alpha_buf = NULL; - int alpha_size; - int lz_alpha_width, lz_alpha_height, n_comp_pixels, lz_alpha_top_down; - - spice_return_val_if_fail(image->u.jpeg_alpha.data->num_chunks == 1, NULL); - canvas->jpeg->ops->begin_decode(canvas->jpeg, - image->u.jpeg_alpha.data->chunk[0].data, - image->u.jpeg_alpha.jpeg_size, - &width, &height); - spice_return_val_if_fail((uint32_t)width == image->descriptor.width, NULL); - spice_return_val_if_fail((uint32_t)height == image->descriptor.height, NULL); - - if (image->u.jpeg_alpha.flags & SPICE_JPEG_ALPHA_FLAGS_TOP_DOWN) { - alpha_top_down = TRUE; - } - -#ifdef WIN32 - lz_data->decode_data.dc = canvas->dc; -#endif - surface = alloc_lz_image_surface(&lz_data->decode_data, PIXMAN_a8r8g8b8, - width, height, width*height, alpha_top_down); - - if (surface == NULL) { - spice_warning("create surface failed"); - return NULL; - } - - dest = (uint8_t *)pixman_image_get_data(surface); - stride = pixman_image_get_stride(surface); - - canvas->jpeg->ops->decode(canvas->jpeg, dest, stride, SPICE_BITMAP_FMT_32BIT); - - comp_alpha_buf = image->u.jpeg_alpha.data->chunk[0].data + image->u.jpeg_alpha.jpeg_size; - alpha_size = image->u.jpeg_alpha.data_size - image->u.jpeg_alpha.jpeg_size; - - lz_decode_begin(lz_data->lz, comp_alpha_buf, alpha_size, &lz_alpha_type, - &lz_alpha_width, &lz_alpha_height, &n_comp_pixels, - &lz_alpha_top_down, NULL); - spice_return_val_if_fail(lz_alpha_type == LZ_IMAGE_TYPE_XXXA, NULL); - spice_return_val_if_fail(!!lz_alpha_top_down == !!alpha_top_down, NULL); - spice_return_val_if_fail(lz_alpha_width == width, NULL); - spice_return_val_if_fail(lz_alpha_height == height, NULL); - spice_return_val_if_fail(n_comp_pixels == width * height, NULL); - - if (!alpha_top_down) { - decomp_alpha_buf = dest + stride * (height - 1); - } else { - decomp_alpha_buf = dest; - } - lz_decode(lz_data->lz, LZ_IMAGE_TYPE_XXXA, decomp_alpha_buf); - - if (invers) { - uint8_t *end = dest + height * stride; - for (; dest != end; dest += stride) { - uint32_t *pix; - uint32_t *end_pix; - - pix = (uint32_t *)dest; - end_pix = pix + width; - for (; pix < end_pix; pix++) { - *pix ^= 0x00ffffff; - } - } - } -#ifdef DUMP_JPEG - dump_jpeg(image->u.jpeg_alpha.data, image->u.jpeg_alpha.jpeg_size); -#endif - return surface; -} - -static pixman_image_t *canvas_bitmap_to_surface(CanvasBase *canvas, SpiceBitmap* bitmap, - SpicePalette *palette, int want_original) -{ - uint8_t* src; - pixman_image_t *image; - pixman_format_code_t format; - - spice_chunks_linearize(bitmap->data); - - src = bitmap->data->chunk[0].data; - - if (want_original) { - format = spice_bitmap_format_to_pixman(bitmap->format, canvas->format); - } else { - format = canvas_get_target_format(canvas, - bitmap->format == SPICE_BITMAP_FMT_RGBA); - } - - image = surface_create( -#ifdef WIN32 - canvas->dc, -#endif - format, - bitmap->x, bitmap->y, FALSE); - if (image == NULL) { - spice_warning("create surface failed"); - return NULL; - } - - spice_bitmap_convert_to_pixman(format, image, - bitmap->format, - bitmap->flags, - bitmap->x, bitmap->y, - src, bitmap->stride, - canvas->format, palette); - return image; -} - - -#ifdef SW_CANVAS_CACHE - -static inline SpicePalette *canvas_get_palette(CanvasBase *canvas, SpicePalette *base_palette, uint64_t palette_id, uint8_t flags) -{ - SpicePalette *palette; - - if (flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE) { - palette = canvas->palette_cache->ops->get(canvas->palette_cache, palette_id); - } else { - palette = base_palette; - if (palette != NULL && flags & SPICE_BITMAP_FLAGS_PAL_CACHE_ME) { - canvas->palette_cache->ops->put(canvas->palette_cache, palette); - } - } - return palette; -} - -static inline SpicePalette *canvas_get_localized_palette(CanvasBase *canvas, SpicePalette *base_palette, uint64_t palette_id, uint8_t flags, int *free_palette) -{ - SpicePalette *palette = canvas_get_palette(canvas, base_palette, palette_id, flags); - SpicePalette *copy; - uint32_t *now, *end; - size_t size; - - if (canvas->format == SPICE_SURFACE_FMT_32_xRGB || - canvas->format == SPICE_SURFACE_FMT_32_ARGB) { - return palette; - } - - size = sizeof(SpicePalette) + palette->num_ents * 4; - copy = (SpicePalette *)spice_malloc(size); - memcpy(copy, palette, size); - - switch (canvas->format) { - case SPICE_SURFACE_FMT_32_xRGB: - case SPICE_SURFACE_FMT_32_ARGB: - /* Won't happen */ - break; - case SPICE_SURFACE_FMT_16_555: - now = copy->ents; - end = now + copy->num_ents; - for (; now < end; now++) { - *now = canvas_16bpp_to_32bpp(*now); - } - break; - case SPICE_SURFACE_FMT_16_565: - default: - spice_warn_if_reached(); - return NULL; - } - *free_palette = TRUE; - return copy; -} - -static pixman_image_t *canvas_get_lz(CanvasBase *canvas, SpiceImage *image, int invers, - int want_original) -{ - LzData *lz_data = &canvas->lz_data; - uint8_t *comp_buf = NULL; - int comp_size; - uint8_t *decomp_buf = NULL; - uint8_t *src; - pixman_format_code_t pixman_format; - LzImageType type, as_type; - SpicePalette *palette; - int n_comp_pixels; - int width; - int height; - int top_down; - int stride; - int free_palette; - - if (setjmp(lz_data->jmp_env)) { - if (decomp_buf) { - free(decomp_buf); - } - spice_warning(lz_data->message_buf); - return NULL; - } - - free_palette = FALSE; - if (image->descriptor.type == SPICE_IMAGE_TYPE_LZ_RGB) { - spice_return_val_if_fail(image->u.lz_rgb.data->num_chunks == 1, NULL); /* TODO: Handle chunks */ - comp_buf = image->u.lz_rgb.data->chunk[0].data; - comp_size = image->u.lz_rgb.data->chunk[0].len; - palette = NULL; - } else if (image->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) { - spice_return_val_if_fail(image->u.lz_plt.data->num_chunks == 1, NULL); /* TODO: Handle chunks */ - comp_buf = image->u.lz_plt.data->chunk[0].data; - comp_size = image->u.lz_plt.data->chunk[0].len; - palette = canvas_get_localized_palette(canvas, image->u.lz_plt.palette, image->u.lz_plt.palette_id, image->u.lz_plt.flags, &free_palette); - } else { - spice_warn_if_reached(); - return NULL; - } - - lz_decode_begin(lz_data->lz, comp_buf, comp_size, &type, - &width, &height, &n_comp_pixels, &top_down, palette); - - switch (type) { - case LZ_IMAGE_TYPE_RGBA: - as_type = LZ_IMAGE_TYPE_RGBA; - pixman_format = PIXMAN_a8r8g8b8; - break; - case LZ_IMAGE_TYPE_RGB32: - case LZ_IMAGE_TYPE_RGB24: - case LZ_IMAGE_TYPE_PLT1_LE: - case LZ_IMAGE_TYPE_PLT1_BE: - case LZ_IMAGE_TYPE_PLT4_LE: - case LZ_IMAGE_TYPE_PLT4_BE: - case LZ_IMAGE_TYPE_PLT8: - as_type = LZ_IMAGE_TYPE_RGB32; - pixman_format = PIXMAN_x8r8g8b8; - break; - case LZ_IMAGE_TYPE_RGB16: - if (!want_original && - (canvas->format == SPICE_SURFACE_FMT_32_xRGB || - canvas->format == SPICE_SURFACE_FMT_32_ARGB)) { - as_type = LZ_IMAGE_TYPE_RGB32; - pixman_format = PIXMAN_x8r8g8b8; - } else { - as_type = LZ_IMAGE_TYPE_RGB16; - pixman_format = PIXMAN_x1r5g5b5; - } - break; - default: - spice_warn_if_reached(); - return NULL; - } - - spice_return_val_if_fail((unsigned)width == image->descriptor.width, NULL); - spice_return_val_if_fail((unsigned)height == image->descriptor.height, NULL); - - spice_return_val_if_fail((image->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) || (n_comp_pixels == width * height), NULL); -#ifdef WIN32 - lz_data->decode_data.dc = canvas->dc; -#endif - - - alloc_lz_image_surface(&lz_data->decode_data, pixman_format, - width, height, n_comp_pixels, top_down); - - src = (uint8_t *)pixman_image_get_data(lz_data->decode_data.out_surface); - - stride = (n_comp_pixels / height) * 4; - if (!top_down) { - stride = -stride; - decomp_buf = src + stride * (height - 1); - } else { - decomp_buf = src; - } - - lz_decode(lz_data->lz, as_type, decomp_buf); - - if (invers) { - uint8_t *line = src; - uint8_t *end = src + height * stride; - for (; line != end; line += stride) { - uint32_t *pix; - uint32_t *end_pix; - - pix = (uint32_t *)line; - end_pix = pix + width; - for (; pix < end_pix; pix++) { - *pix ^= 0xffffffff; - } - } - } - - if (free_palette) { - free(palette); - } - - return lz_data->decode_data.out_surface; -} - -static pixman_image_t *canvas_get_glz_rgb_common(CanvasBase *canvas, uint8_t *data, - int want_original) -{ - spice_return_val_if_fail(canvas->glz_data.decoder != NULL, NULL); - - canvas->glz_data.decoder->ops->decode(canvas->glz_data.decoder, - data, NULL, - &canvas->glz_data.decode_data); - - /* global_decode calls alloc_lz_image, which sets canvas->glz_data.surface */ - return (canvas->glz_data.decode_data.out_surface); -} - -// don't handle plts since bitmaps with plt can be decoded globally to RGB32 (because -// same byte sequence can be transformed to different RGB pixels by different plts) -static pixman_image_t *canvas_get_glz(CanvasBase *canvas, SpiceImage *image, - int want_original) -{ - spice_return_val_if_fail(image->descriptor.type == SPICE_IMAGE_TYPE_GLZ_RGB, NULL); -#ifdef WIN32 - canvas->glz_data.decode_data.dc = canvas->dc; -#endif - - spice_return_val_if_fail(image->u.lz_rgb.data->num_chunks == 1, NULL); /* TODO: Handle chunks */ - return canvas_get_glz_rgb_common(canvas, image->u.lz_rgb.data->chunk[0].data, want_original); -} - -static pixman_image_t *canvas_get_zlib_glz_rgb(CanvasBase *canvas, SpiceImage *image, - int want_original) -{ - uint8_t *glz_data; - pixman_image_t *surface; - - spice_return_val_if_fail(canvas->zlib != NULL, NULL); - - spice_return_val_if_fail(image->u.zlib_glz.data->num_chunks == 1, NULL); /* TODO: Handle chunks */ - glz_data = (uint8_t*)spice_malloc(image->u.zlib_glz.glz_data_size); - canvas->zlib->ops->decode(canvas->zlib, image->u.zlib_glz.data->chunk[0].data, - image->u.zlib_glz.data->chunk[0].len, - glz_data, image->u.zlib_glz.glz_data_size); - surface = canvas_get_glz_rgb_common(canvas, glz_data, want_original); - free(glz_data); - return surface; -} - -//#define DEBUG_DUMP_BITMAP - -#ifdef DEBUG_DUMP_BITMAP -static void dump_bitmap(SpiceBitmap *bitmap, SpicePalette *palette) -{ - uint8_t* data = (uint8_t *)SPICE_GET_ADDRESS(bitmap->data); - static uint32_t file_id = 0; - uint32_t i, j; - char file_str[200]; - uint32_t id = ++file_id; - -#ifdef WIN32 - sprintf(file_str, "c:\\tmp\\spice_dump\\%u.%ubpp", id, bitmap->format); -#else - sprintf(file_str, "/tmp/spice_dump/%u.%ubpp", id, bitmap->format); -#endif - FILE *f = fopen(file_str, "wb"); - if (!f) { - return; - } - - fprintf(f, "%d\n", bitmap->format); // 1_LE,1_BE,.... - fprintf(f, "%d %d\n", bitmap->x, bitmap->y); // width and height - fprintf(f, "%d\n", palette->num_ents); // #plt entries - for (i = 0; i < palette->num_ents; i++) { - fwrite(&(palette->ents[i]), 4, 1, f); - } - fprintf(f, "\n"); - - for (i = 0; i < bitmap->y; i++, data += bitmap->stride) { - uint8_t *now = data; - for (j = 0; j < bitmap->x; j++) { - fwrite(now, 1, 1, f); - now++; - } - } -} - -#endif - -static pixman_image_t *canvas_get_bits(CanvasBase *canvas, SpiceBitmap *bitmap, - int want_original) -{ - pixman_image_t* surface; - SpicePalette *palette; - - palette = canvas_get_palette(canvas, bitmap->palette, bitmap->palette_id, bitmap->flags); -#ifdef DEBUG_DUMP_BITMAP - if (palette) { - dump_bitmap(bitmap, palette); - } -#endif - - surface = canvas_bitmap_to_surface(canvas, bitmap, palette, want_original); - - if (palette && (bitmap->flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { - canvas->palette_cache->ops->release(canvas->palette_cache, palette); - } - - return surface; -} - -#else - - -static pixman_image_t *canvas_get_bits(CanvasBase *canvas, SpiceBitmap *bitmap, - int want_original) -{ - SpicePalette *palette; - - if (!bitmap->palette) { - return canvas_bitmap_to_surface(canvas, bitmap, NULL, want_original); - } - palette = (SpicePalette *)SPICE_GET_ADDRESS(bitmap->palette); - return canvas_bitmap_to_surface(canvas, bitmap, palette, want_original); -} - -#endif - - - -// caution: defining DEBUG_DUMP_SURFACE will dump both cached & non-cached -// images to disk. it will reduce performance dramatically & eat -// disk space rapidly. use it only for debugging. -//#define DEBUG_DUMP_SURFACE - -#if defined(DEBUG_DUMP_SURFACE) || defined(DEBUG_DUMP_COMPRESS) - -static void dump_surface(pixman_image_t *surface, int cache) -{ - static uint32_t file_id = 0; - int i, j; - char file_str[200]; - int depth = pixman_image_get_depth(surface); - - if (depth != 24 && depth != 32) { - return; - } - - uint8_t *data = (uint8_t *)pixman_image_get_data(surface); - int width = pixman_image_get_width(surface); - int height = pixman_image_get_height(surface); - int stride = pixman_image_surface_get_stride(surface); - - uint32_t id = ++file_id; -#ifdef WIN32 - sprintf(file_str, "c:\\tmp\\spice_dump\\%d\\%u.ppm", cache, id); -#else - sprintf(file_str, "/tmp/spice_dump/%u.ppm", id); -#endif - FILE *f = fopen(file_str, "wb"); - if (!f) { - return; - } - fprintf(f, "P6\n"); - fprintf(f, "%d %d\n", width, height); - fprintf(f, "#spicec dump\n"); - fprintf(f, "255\n"); - for (i = 0; i < height; i++, data += stride) { - uint8_t *now = data; - for (j = 0; j < width; j++) { - fwrite(&now[2], 1, 1, f); - fwrite(&now[1], 1, 1, f); - fwrite(&now[0], 1, 1, f); - now += 4; - } - } - fclose(f); -} - -#endif - -static SpiceCanvas *canvas_get_surface_internal(CanvasBase *canvas, SpiceImage *image) -{ - if (image->descriptor.type == SPICE_IMAGE_TYPE_SURFACE) { - SpiceSurface *surface = &image->u.surface; - return canvas->surfaces->ops->get(canvas->surfaces, surface->surface_id); - } - return NULL; -} - -static SpiceCanvas *canvas_get_surface_mask_internal(CanvasBase *canvas, SpiceImage *image) -{ - if (image->descriptor.type == SPICE_IMAGE_TYPE_SURFACE) { - SpiceSurface *surface = &image->u.surface; - return canvas->surfaces->ops->get(canvas->surfaces, surface->surface_id); - } - return NULL; -} - -#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) - -//#define DEBUG_LZ - -/* If real get is FALSE, then only do whatever is needed but don't return an image. For instance, - * if we need to read it to cache it we do. - * - * This generally converts the image to the right type for the canvas. - * However, if want_original is set the real source format is returned, and - * you have to be able to handle any image format. This is useful to avoid - * e.g. losing alpha when blending a argb32 image on a rgb16 surface. - */ -static pixman_image_t *canvas_get_image_internal(CanvasBase *canvas, SpiceImage *image, - int want_original, int real_get) -{ - SpiceImageDescriptor *descriptor = &image->descriptor; - pixman_image_t *surface, *converted; - pixman_format_code_t wanted_format, surface_format; - int saved_want_original; - - /* When touching, only really allocate if we need to cache, or - * if we're loading a GLZ stream (since those need inter-thread communication - * to happen which breaks if we don't. */ - if (!real_get && - !(descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME) && -#ifdef SW_CANVAS_CACHE - !(descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME) && -#endif - (descriptor->type != SPICE_IMAGE_TYPE_GLZ_RGB) && - (descriptor->type != SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB)) { - return NULL; - } - - saved_want_original = want_original; - if (descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME -#ifdef SW_CANVAS_CACHE - || descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME -#endif - ) { - want_original = TRUE; - } - - switch (descriptor->type) { - case SPICE_IMAGE_TYPE_QUIC: { - surface = canvas_get_quic(canvas, image, 0, want_original); - break; - } -#if defined(SW_CANVAS_CACHE) - case SPICE_IMAGE_TYPE_LZ_PLT: { - surface = canvas_get_lz(canvas, image, 0, want_original); - break; - } - case SPICE_IMAGE_TYPE_LZ_RGB: { - surface = canvas_get_lz(canvas, image, 0, want_original); - break; - } -#endif - case SPICE_IMAGE_TYPE_JPEG: { - surface = canvas_get_jpeg(canvas, image, 0); - break; - } - case SPICE_IMAGE_TYPE_JPEG_ALPHA: { - surface = canvas_get_jpeg_alpha(canvas, image, 0); - break; - } -#if defined(SW_CANVAS_CACHE) - case SPICE_IMAGE_TYPE_GLZ_RGB: { - surface = canvas_get_glz(canvas, image, want_original); - break; - } - case SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB: { - surface = canvas_get_zlib_glz_rgb(canvas, image, want_original); - break; - } -#endif - case SPICE_IMAGE_TYPE_FROM_CACHE: - surface = canvas->bits_cache->ops->get(canvas->bits_cache, descriptor->id); - break; -#ifdef SW_CANVAS_CACHE - case SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS: - surface = canvas->bits_cache->ops->get_lossless(canvas->bits_cache, descriptor->id); - break; -#endif - case SPICE_IMAGE_TYPE_BITMAP: { - surface = canvas_get_bits(canvas, &image->u.bitmap, want_original); - break; - } - default: - spice_warn_if_reached(); - return NULL; - } - - spice_return_val_if_fail(surface != NULL, NULL); - surface_format = spice_pixman_image_get_format(surface); - - if (descriptor->flags & SPICE_IMAGE_FLAGS_HIGH_BITS_SET && - descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE && -#ifdef SW_CANVAS_CACHE - descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS && -#endif - surface_format == PIXMAN_x8r8g8b8) { - spice_pixman_fill_rect_rop(surface, - 0, 0, - pixman_image_get_width(surface), - pixman_image_get_height(surface), - 0xff000000U, SPICE_ROP_OR); - } - - if (descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME && -#ifdef SW_CANVAS_CACHE - descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS && -#endif - descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE ) { -#ifdef SW_CANVAS_CACHE - if (!IS_IMAGE_LOSSY(descriptor)) { - canvas->bits_cache->ops->put(canvas->bits_cache, descriptor->id, surface); - } else { - canvas->bits_cache->ops->put_lossy(canvas->bits_cache, descriptor->id, surface); - } -#else - canvas->bits_cache->ops->put(canvas->bits_cache, descriptor->id, surface); -#endif -#ifdef DEBUG_DUMP_SURFACE - dump_surface(surface, 1); -#endif -#ifdef SW_CANVAS_CACHE - } else if (descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME) { - if (IS_IMAGE_LOSSY(descriptor)) { - spice_warning("invalid cache replace request: the image is lossy"); - return NULL; - } - canvas->bits_cache->ops->replace_lossy(canvas->bits_cache, descriptor->id, surface); -#ifdef DEBUG_DUMP_SURFACE - dump_surface(surface, 1); -#endif -#endif -#ifdef DEBUG_DUMP_SURFACE - } else if (descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE -#ifdef SW_CANVAS_CACHE - && descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS -#endif - ) { - - dump_surface(surface, 0); -#endif - } - - if (!real_get) { - pixman_image_unref(surface); - return NULL; - } - - if (!saved_want_original) { - /* Conversion to canvas format was requested, but maybe it didn't - happen above (due to save/load to cache for instance, or - maybe the reader didn't support conversion). - If so we convert here. */ - - wanted_format = canvas_get_target_format(canvas, - surface_format == PIXMAN_a8r8g8b8); - - if (surface_format != wanted_format) { - converted = surface_create( -#ifdef WIN32 - canvas->dc, -#endif - wanted_format, - pixman_image_get_width(surface), - pixman_image_get_height(surface), - TRUE); - pixman_image_composite32 (PIXMAN_OP_SRC, - surface, NULL, converted, - 0, 0, - 0, 0, - 0, 0, - pixman_image_get_width(surface), - pixman_image_get_height(surface)); - pixman_image_unref (surface); - surface = converted; - } - } - - return surface; -} - -#else - -static pixman_image_t *canvas_get_image_internal(CanvasBase *canvas, SpiceImage *image, - int want_original, int real_get) -{ - SpiceImageDescriptor *descriptor = &image->descriptor; - pixman_format_code_t format; - - /* When touching, never load image. */ - if (!real_get) { - return NULL; - } - - switch (descriptor->type) { - case SPICE_IMAGE_TYPE_QUIC: { - return canvas_get_quic(canvas, image, 0); - } - case SPICE_IMAGE_TYPE_BITMAP: { - return canvas_get_bits(canvas, &image->u.bitmap, want_original, &format); - } - default: - spice_warn_if_reached(); - return NULL; - } - - return NULL; -} - -#endif - -static SpiceCanvas *canvas_get_surface_mask(CanvasBase *canvas, SpiceImage *image) -{ - return canvas_get_surface_mask_internal(canvas, image); -} - -static SpiceCanvas *canvas_get_surface(CanvasBase *canvas, SpiceImage *image) -{ - return canvas_get_surface_internal(canvas, image); -} - -static pixman_image_t *canvas_get_image(CanvasBase *canvas, SpiceImage *image, - int want_original) -{ - return canvas_get_image_internal(canvas, image, want_original, TRUE); -} - -static void canvas_touch_image(CanvasBase *canvas, SpiceImage *image) -{ - canvas_get_image_internal(canvas, image, TRUE, FALSE); -} - -static pixman_image_t* canvas_get_image_from_self(SpiceCanvas *canvas, - int x, int y, - int32_t width, int32_t height) -{ - CanvasBase *canvas_base = (CanvasBase *)canvas; - pixman_image_t *surface; - uint8_t *dest; - int dest_stride; - SpiceRect area; - - surface = pixman_image_create_bits(spice_surface_format_to_pixman (canvas_base->format), - width, height, NULL, 0); - spice_return_val_if_fail(surface != NULL, NULL); - - dest = (uint8_t *)pixman_image_get_data(surface); - dest_stride = pixman_image_get_stride(surface); - - area.left = x; - area.top = y; - area.right = x + width; - area.bottom = y + height; - - canvas->ops->read_bits(canvas, dest, dest_stride, &area); - - return surface; -} - -static inline uint8_t revers_bits(uint8_t byte) -{ - uint8_t ret = 0; - int i; - - for (i = 0; i < 4; i++) { - int shift = 7 - i * 2; - ret |= (byte & (1 << i)) << shift; - ret |= (byte & (0x80 >> i)) >> shift; - } - return ret; -} - -static pixman_image_t *canvas_get_bitmap_mask(CanvasBase *canvas, SpiceBitmap* bitmap, int invers) -{ - pixman_image_t *surface; - uint8_t *src_line; - uint8_t *end_line; - uint8_t *dest_line; - int src_stride; - int line_size; - int dest_stride; - - surface = surface_create( -#ifdef WIN32 - canvas->dc, -#endif - PIXMAN_a1, bitmap->x, bitmap->y, TRUE); - spice_return_val_if_fail(surface != NULL, NULL); - - spice_chunks_linearize(bitmap->data); - src_line = bitmap->data->chunk[0].data; - src_stride = bitmap->stride; - end_line = src_line + (bitmap->y * src_stride); - line_size = SPICE_ALIGN(bitmap->x, 8) >> 3; - - dest_stride = pixman_image_get_stride(surface); - dest_line = (uint8_t *)pixman_image_get_data(surface); -#if defined(GL_CANVAS) - if ((bitmap->flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) { -#else - if (!(bitmap->flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) { -#endif - spice_return_val_if_fail(bitmap->y > 0, NULL); - dest_line += dest_stride * ((int)bitmap->y - 1); - dest_stride = -dest_stride; - } - - if (invers) { - switch (bitmap->format) { -#if defined(GL_CANVAS) || defined(GDI_CANVAS) - case SPICE_BITMAP_FMT_1BIT_BE: -#else - case SPICE_BITMAP_FMT_1BIT_LE: -#endif - for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) { - uint8_t *dest = dest_line; - uint8_t *now = src_line; - uint8_t *end = now + line_size; - while (now < end) { - *(dest++) = ~*(now++); - } - } - break; -#if defined(GL_CANVAS) || defined(GDI_CANVAS) - case SPICE_BITMAP_FMT_1BIT_LE: -#else - case SPICE_BITMAP_FMT_1BIT_BE: -#endif - for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) { - uint8_t *dest = dest_line; - uint8_t *now = src_line; - uint8_t *end = now + line_size; - - while (now < end) { - *(dest++) = ~revers_bits(*(now++)); - } - } - break; - default: - pixman_image_unref(surface); - surface = NULL; - spice_warn_if_reached(); - return NULL; - } - } else { - switch (bitmap->format) { -#if defined(GL_CANVAS) || defined(GDI_CANVAS) - case SPICE_BITMAP_FMT_1BIT_BE: -#else - case SPICE_BITMAP_FMT_1BIT_LE: -#endif - for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) { - memcpy(dest_line, src_line, line_size); - } - break; -#if defined(GL_CANVAS) || defined(GDI_CANVAS) - case SPICE_BITMAP_FMT_1BIT_LE: -#else - case SPICE_BITMAP_FMT_1BIT_BE: -#endif - for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) { - uint8_t *dest = dest_line; - uint8_t *now = src_line; - uint8_t *end = now + line_size; - - while (now < end) { - *(dest++) = revers_bits(*(now++)); - } - } - break; - default: - pixman_image_unref(surface); - surface = NULL; - spice_warn_if_reached(); - return NULL; - } - } - return surface; -} - -static inline pixman_image_t *canvas_A1_invers(pixman_image_t *src_surf) -{ - int width = pixman_image_get_width(src_surf); - int height = pixman_image_get_height(src_surf); - pixman_image_t * invers; - uint8_t *src_line, *end_line, *dest_line; - int src_stride, line_size, dest_stride; - - spice_return_val_if_fail(pixman_image_get_depth(src_surf) == 1, NULL); - - invers = pixman_image_create_bits(PIXMAN_a1, width, height, NULL, 0); - spice_return_val_if_fail(invers != NULL, NULL); - - src_line = (uint8_t *)pixman_image_get_data(src_surf); - src_stride = pixman_image_get_stride(src_surf); - end_line = src_line + (height * src_stride); - line_size = SPICE_ALIGN(width, 8) >> 3; - dest_line = (uint8_t *)pixman_image_get_data(invers); - dest_stride = pixman_image_get_stride(invers); - - for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) { - uint8_t *dest = dest_line; - uint8_t *now = src_line; - uint8_t *end = now + line_size; - while (now < end) { - *(dest++) = ~*(now++); - } - } - return invers; -} - -static pixman_image_t *canvas_get_mask(CanvasBase *canvas, SpiceQMask *mask, int *needs_invert_out) -{ - SpiceImage *image; - pixman_image_t *surface; - int need_invers; - int is_invers; - int cache_me; - - if (needs_invert_out) { - *needs_invert_out = 0; - } - - image = mask->bitmap; - need_invers = mask->flags & SPICE_MASK_FLAGS_INVERS; - -#ifdef SW_CANVAS_CACHE - cache_me = image->descriptor.flags & SPICE_IMAGE_FLAGS_CACHE_ME; -#else - cache_me = 0; -#endif - - switch (image->descriptor.type) { - case SPICE_IMAGE_TYPE_BITMAP: { - is_invers = need_invers && !cache_me; - surface = canvas_get_bitmap_mask(canvas, &image->u.bitmap, is_invers); - break; - } -#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) - case SPICE_IMAGE_TYPE_FROM_CACHE: - surface = canvas->bits_cache->ops->get(canvas->bits_cache, image->descriptor.id); - is_invers = 0; - break; -#endif -#ifdef SW_CANVAS_CACHE - case SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS: - surface = canvas->bits_cache->ops->get_lossless(canvas->bits_cache, image->descriptor.id); - is_invers = 0; - break; -#endif - default: - spice_warn_if_reached(); - return NULL; - } - -#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) - if (cache_me) { - canvas->bits_cache->ops->put(canvas->bits_cache, image->descriptor.id, surface); - } - - if (need_invers && !is_invers) { // surface is in cache - if (needs_invert_out != NULL) { - *needs_invert_out = TRUE; - } else { - pixman_image_t *inv_surf; - inv_surf = canvas_A1_invers(surface); - pixman_image_unref(surface); - surface = inv_surf; - } - } -#endif - return surface; -} - -static inline void canvas_raster_glyph_box(const SpiceRasterGlyph *glyph, SpiceRect *r) -{ - spice_return_if_fail(r != NULL); - - r->top = glyph->render_pos.y + glyph->glyph_origin.y; - r->bottom = r->top + glyph->height; - r->left = glyph->render_pos.x + glyph->glyph_origin.x; - r->right = r->left + glyph->width; -} - -#ifdef GL_CANVAS -static inline void __canvas_put_bits(uint8_t *dest, int offset, uint8_t val, int n) -{ - uint8_t mask; - int now; - - dest = dest + (offset >> 3); - offset &= 0x07; - now = MIN(8 - offset, n); - - mask = ~((1 << (8 - now)) - 1); - mask >>= offset; - *dest = ((val >> offset) & mask) | *dest; - - if ((n = n - now)) { - mask = ~((1 << (8 - n)) - 1); - dest++; - *dest = ((val << now) & mask) | *dest; - } -} - -#else -static inline void __canvas_put_bits(uint8_t *dest, int offset, uint8_t val, int n) -{ - uint8_t mask; - int now; - - dest = dest + (offset >> 3); - offset &= 0x07; - - now = MIN(8 - offset, n); - - mask = (1 << now) - 1; - mask <<= offset; - val = revers_bits(val); - *dest = ((val << offset) & mask) | *dest; - - if ((n = n - now)) { - mask = (1 << n) - 1; - dest++; - *dest = ((val >> now) & mask) | *dest; - } -} - -#endif - -static inline void canvas_put_bits(uint8_t *dest, int dest_offset, uint8_t *src, int n) -{ - while (n) { - int now = MIN(n, 8); - - n -= now; - __canvas_put_bits(dest, dest_offset, *src, now); - dest_offset += now; - src++; - } -} - -static void canvas_put_glyph_bits(SpiceRasterGlyph *glyph, int bpp, uint8_t *dest, int dest_stride, - SpiceRect *bounds) -{ - SpiceRect glyph_box; - uint8_t *src; - int lines; - int width; - - //todo: support SPICE_STRING_FLAGS_RASTER_TOP_DOWN - canvas_raster_glyph_box(glyph, &glyph_box); - spice_return_if_fail(glyph_box.top >= bounds->top && glyph_box.bottom <= bounds->bottom); - spice_return_if_fail(glyph_box.left >= bounds->left && glyph_box.right <= bounds->right); - rect_offset(&glyph_box, -bounds->left, -bounds->top); - - dest += glyph_box.top * dest_stride; - src = glyph->data; - lines = glyph_box.bottom - glyph_box.top; - width = glyph_box.right - glyph_box.left; - switch (bpp) { - case 1: { - int src_stride = SPICE_ALIGN(width, 8) >> 3; - int i; - - src += src_stride * (lines); - for (i = 0; i < lines; i++) { - src -= src_stride; - canvas_put_bits(dest, glyph_box.left, src, width); - dest += dest_stride; - } - break; - } - case 4: { - uint8_t *end; - int src_stride = SPICE_ALIGN(width * 4, 8) >> 3; - - src += src_stride * lines; - dest += glyph_box.left; - end = dest + dest_stride * lines; - for (; dest != end; dest += dest_stride) { - int i = 0; - uint8_t *now; - - src -= src_stride; - now = src; - while (i < (width & ~1)) { - dest[i] = MAX(dest[i], *now & 0xf0); - dest[i + 1] = MAX(dest[i + 1], *now << 4); - i += 2; - now++; - } - if (i < width) { - dest[i] = MAX(dest[i], *now & 0xf0); - now++; - } - } - break; - } - case 8: { - uint8_t *end; - src += width * lines; - dest += glyph_box.left; - end = dest + dest_stride * lines; - for (; dest != end; dest += dest_stride, src -= width) { - int i; - - for (i = 0; i < width; i++) { - dest[i] = MAX(dest[i], src[i]); - } - } - break; - } - default: - spice_warn_if_reached(); - return; - } -} - -static pixman_image_t *canvas_get_str_mask(CanvasBase *canvas, SpiceString *str, int bpp, SpicePoint *pos) -{ - SpiceRasterGlyph *glyph; - SpiceRect bounds; - pixman_image_t *str_mask; - uint8_t *dest; - int dest_stride; - int i; - - spice_return_val_if_fail(str->length > 0, NULL); - - glyph = str->glyphs[0]; - canvas_raster_glyph_box(glyph, &bounds); - - for (i = 1; i < str->length; i++) { - SpiceRect glyph_box; - - canvas_raster_glyph_box(str->glyphs[i], &glyph_box); - rect_union(&bounds, &glyph_box); - } - - str_mask = pixman_image_create_bits((bpp == 1) ? PIXMAN_a1 : PIXMAN_a8, - bounds.right - bounds.left, - bounds.bottom - bounds.top, NULL, 0); - spice_return_val_if_fail(str_mask != NULL, NULL); - - dest = (uint8_t *)pixman_image_get_data(str_mask); - dest_stride = pixman_image_get_stride(str_mask); - for (i = 0; i < str->length; i++) { - glyph = str->glyphs[i]; -#if defined(GL_CANVAS) - canvas_put_glyph_bits(glyph, bpp, dest + (bounds.bottom - bounds.top - 1) * dest_stride, - -dest_stride, &bounds); -#else - canvas_put_glyph_bits(glyph, bpp, dest, dest_stride, &bounds); -#endif - } - - pos->x = bounds.left; - pos->y = bounds.top; - return str_mask; -} - -static pixman_image_t *canvas_scale_surface(pixman_image_t *src, const SpiceRect *src_area, int width, - int height, int scale_mode) -{ - pixman_image_t *surface; - pixman_transform_t transform; - double sx, sy; - - surface = pixman_image_create_bits(spice_pixman_image_get_format (src), - width, height, NULL, 0); - spice_return_val_if_fail(surface != NULL, NULL); - - sx = (double)(src_area->right - src_area->left) / width; - sy = (double)(src_area->bottom - src_area->top) / height; - - pixman_transform_init_scale(&transform, pixman_double_to_fixed(sx), pixman_double_to_fixed(sy)); - - pixman_image_set_transform (src, &transform); - pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE); - spice_return_val_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE || scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST, NULL); - pixman_image_set_filter(src, - (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ?PIXMAN_FILTER_NEAREST : PIXMAN_FILTER_GOOD, - NULL, 0); - - pixman_image_composite32(PIXMAN_OP_SRC, - src, NULL, surface, - ROUND(src_area->left / sx), ROUND (src_area->top / sy), - 0, 0, /* mask */ - 0, 0, /* dst */ - width, height); - - pixman_transform_init_identity(&transform); - pixman_image_set_transform(src, &transform); - - return surface; -} - -static void quic_usr_error(QuicUsrContext *usr, const char *fmt, ...) -{ - QuicData *usr_data = (QuicData *)usr; - va_list ap; - - va_start(ap, fmt); - vsnprintf(usr_data->message_buf, sizeof(usr_data->message_buf), fmt, ap); - va_end(ap); - - longjmp(usr_data->jmp_env, 1); -} - -static void quic_usr_warn(QuicUsrContext *usr, const char *fmt, ...) -{ - QuicData *usr_data = (QuicData *)usr; - va_list ap; - - va_start(ap, fmt); - vsnprintf(usr_data->message_buf, sizeof(usr_data->message_buf), fmt, ap); - va_end(ap); -} - -static void *quic_usr_malloc(QuicUsrContext *usr, int size) -{ - return spice_malloc(size); -} - -static void quic_usr_free(QuicUsrContext *usr, void *ptr) -{ - free(ptr); -} - -static void lz_usr_warn(LzUsrContext *usr, const char *fmt, ...) -{ - LzData *usr_data = (LzData *)usr; - va_list ap; - - va_start(ap, fmt); - vsnprintf(usr_data->message_buf, sizeof(usr_data->message_buf), fmt, ap); - va_end(ap); -} - -static void lz_usr_error(LzUsrContext *usr, const char *fmt, ...) -{ - LzData *usr_data = (LzData *)usr; - va_list ap; - - va_start(ap, fmt); - vsnprintf(usr_data->message_buf, sizeof(usr_data->message_buf), fmt, ap); - va_end(ap); - - longjmp(usr_data->jmp_env, 1); -} - -static void *lz_usr_malloc(LzUsrContext *usr, int size) -{ - return spice_malloc(size); -} - -static void lz_usr_free(LzUsrContext *usr, void *ptr) -{ - free(ptr); -} - -static int lz_usr_more_space(LzUsrContext *usr, uint8_t **io_ptr) -{ - return 0; -} - -static int lz_usr_more_lines(LzUsrContext *usr, uint8_t **lines) -{ - return 0; -} - -static int quic_usr_more_space(QuicUsrContext *usr, uint32_t **io_ptr, int rows_completed) -{ - QuicData *quic_data = (QuicData *)usr; - - if (quic_data->current_chunk == quic_data->chunks->num_chunks -1) { - return 0; - } - quic_data->current_chunk++; - - *io_ptr = (uint32_t *)quic_data->chunks->chunk[quic_data->current_chunk].data; - return quic_data->chunks->chunk[quic_data->current_chunk].len >> 2; -} - - -static int quic_usr_more_lines(QuicUsrContext *usr, uint8_t **lines) -{ - return 0; -} - -static void canvas_base_destroy(CanvasBase *canvas) -{ - quic_destroy(canvas->quic_data.quic); - lz_destroy(canvas->lz_data.lz); -#ifdef GDI_CANVAS - DeleteDC(canvas->dc); -#endif - - if (canvas->usr_data && canvas->usr_data_destroy) { - canvas->usr_data_destroy (canvas->usr_data); - canvas->usr_data = NULL; - } -} - -/* This is kind of lame, but it protects against multiple - instances of these functions. We really should stop including - canvas_base.c and build it separately instead */ -#ifdef CANVAS_SINGLE_INSTANCE - -void spice_canvas_set_usr_data(SpiceCanvas *spice_canvas, - void *data, - spice_destroy_fn_t destroy_fn) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - if (canvas->usr_data && canvas->usr_data_destroy) { - canvas->usr_data_destroy (canvas->usr_data); - } - canvas->usr_data = data; - canvas->usr_data_destroy = destroy_fn; -} - -void *spice_canvas_get_usr_data(SpiceCanvas *spice_canvas) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - return canvas->usr_data; -} -#endif - - -static void canvas_clip_pixman(CanvasBase *canvas, - pixman_region32_t *dest_region, - SpiceClip *clip) -{ - pixman_region32_intersect(dest_region, dest_region, &canvas->canvas_region); - - switch (clip->type) { - case SPICE_CLIP_TYPE_NONE: - break; - case SPICE_CLIP_TYPE_RECTS: { - uint32_t n = clip->rects->num_rects; - SpiceRect *now = clip->rects->rects; - - pixman_region32_t clip; - - if (spice_pixman_region32_init_rects(&clip, now, n)) { - pixman_region32_intersect(dest_region, dest_region, &clip); - pixman_region32_fini(&clip); - } - - break; - } - default: - spice_warn_if_reached(); - return; - } -} - -static void canvas_mask_pixman(CanvasBase *canvas, - pixman_region32_t *dest_region, - SpiceQMask *mask, int x, int y) -{ - SpiceCanvas *surface_canvas; - pixman_image_t *image, *subimage; - int needs_invert; - pixman_region32_t mask_region; - uint32_t *mask_data; - int mask_x, mask_y; - int mask_width, mask_height, mask_stride; - pixman_box32_t extents; - - if (!mask->bitmap) { - return; - } - - surface_canvas = canvas_get_surface_mask(canvas, mask->bitmap); - if (surface_canvas) { - needs_invert = mask->flags & SPICE_MASK_FLAGS_INVERS; - image = surface_canvas->ops->get_image(surface_canvas); - } else { - needs_invert = FALSE; - image = canvas_get_mask(canvas, - mask, - &needs_invert); - } - - mask_data = pixman_image_get_data(image); - mask_width = pixman_image_get_width(image); - mask_height = pixman_image_get_height(image); - mask_stride = pixman_image_get_stride(image); - - mask_x = mask->pos.x; - mask_y = mask->pos.y; - - /* We need to subset the area of the mask that we turn into a region, - because a cached mask may be much larger than what is used for - the clip operation. */ - extents = *pixman_region32_extents(dest_region); - - /* convert from destination pixels to mask pixels */ - extents.x1 -= x - mask_x; - extents.y1 -= y - mask_y; - extents.x2 -= x - mask_x; - extents.y2 -= y - mask_y; - - /* clip to mask size */ - if (extents.x1 < 0) { - extents.x1 = 0; - } - if (extents.x2 >= mask_width) { - extents.x2 = mask_width; - } - if (extents.x2 < extents.x1) { - extents.x2 = extents.x1; - } - if (extents.y1 < 0) { - extents.y1 = 0; - } - if (extents.y2 >= mask_height) { - extents.y2 = mask_height; - } - if (extents.y2 < extents.y1) { - extents.y2 = extents.y1; - } - - /* round down X to even 32 pixels (i.e. uint32_t) */ - extents.x1 = extents.x1 & ~(0x1f); - - mask_data = (uint32_t *)((uint8_t *)mask_data + mask_stride * extents.y1 + extents.x1 / 32); - mask_x -= extents.x1; - mask_y -= extents.y1; - mask_width = extents.x2 - extents.x1; - mask_height = extents.y2 - extents.y1; - - subimage = pixman_image_create_bits(PIXMAN_a1, mask_width, mask_height, - mask_data, mask_stride); - pixman_region32_init_from_image(&mask_region, - subimage); - pixman_image_unref(subimage); - - if (needs_invert) { - pixman_box32_t rect; - - rect.x1 = rect.y1 = 0; - rect.x2 = mask_width; - rect.y2 = mask_height; - - pixman_region32_inverse(&mask_region, &mask_region, &rect); - } - - pixman_region32_translate(&mask_region, - -mask_x + x, -mask_y + y); - - pixman_region32_intersect(dest_region, dest_region, &mask_region); - pixman_region32_fini(&mask_region); - - pixman_image_unref(image); -} - -static void draw_brush(SpiceCanvas *canvas, - pixman_region32_t *region, - SpiceBrush *brush, - SpiceROP rop) -{ - CanvasBase *canvas_base = (CanvasBase *)canvas; - uint32_t color; - SpicePattern *pattern; - pixman_image_t *tile; - int offset_x, offset_y; - pixman_box32_t *rects; - int n_rects; - - rects = pixman_region32_rectangles(region, &n_rects); - - switch (brush->type) { - case SPICE_BRUSH_TYPE_SOLID: - color = brush->u.color; - if (rop == SPICE_ROP_COPY) { - canvas->ops->fill_solid_rects(canvas, rects, n_rects, color); - } else { - canvas->ops->fill_solid_rects_rop(canvas, rects, n_rects, color, rop); - } - break; - case SPICE_BRUSH_TYPE_PATTERN: { - SpiceCanvas *surface_canvas; - - pattern = &brush->u.pattern; - offset_x = pattern->pos.x; - offset_y = pattern->pos.y; - - surface_canvas = canvas_get_surface(canvas_base, pattern->pat); - if (surface_canvas) { - if (rop == SPICE_ROP_COPY) { - canvas->ops->fill_tiled_rects_from_surface(canvas, rects, n_rects, surface_canvas, - offset_x, offset_y); - } else { - canvas->ops->fill_tiled_rects_rop_from_surface(canvas, rects, n_rects, - surface_canvas, offset_x, offset_y, - rop); - } - } else { - tile = canvas_get_image(canvas_base, pattern->pat, FALSE); - spice_return_if_fail(tile != NULL); - - if (rop == SPICE_ROP_COPY) { - canvas->ops->fill_tiled_rects(canvas, rects, n_rects, tile, offset_x, offset_y); - } else { - canvas->ops->fill_tiled_rects_rop(canvas, rects, n_rects, - tile, offset_x, offset_y, rop); - } - pixman_image_unref(tile); - } - break; - } - case SPICE_BRUSH_TYPE_NONE: - /* Still need to do *something* here, because rop could be e.g invert dest */ - canvas->ops->fill_solid_rects_rop(canvas, rects, n_rects, 0, rop); - break; - default: - spice_warn_if_reached(); - return; - } -} - -/* If we're exiting early we may still have to load an image in case - it has to be cached or something */ -static void touch_brush(CanvasBase *canvas, SpiceBrush *brush) -{ - SpicePattern *pattern; - - if (brush->type == SPICE_BRUSH_TYPE_PATTERN) { - pattern = &brush->u.pattern; - canvas_touch_image(canvas, pattern->pat); - } -} - -static void canvas_draw_fill(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - pixman_region32_t dest_region; - SpiceROP rop; - - pixman_region32_init_rect(&dest_region, - bbox->left, bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top); - - - canvas_clip_pixman(canvas, &dest_region, clip); - canvas_mask_pixman(canvas, &dest_region, &fill->mask, - bbox->left, bbox->top); - - rop = ropd_descriptor_to_rop(fill->rop_descriptor, - ROP_INPUT_BRUSH, - ROP_INPUT_DEST); - - if (rop == SPICE_ROP_NOOP || !pixman_region32_not_empty(&dest_region)) { - touch_brush(canvas, &fill->brush); - pixman_region32_fini(&dest_region); - return; - } - - draw_brush(spice_canvas, &dest_region, &fill->brush, rop); - - pixman_region32_fini(&dest_region); -} - -static void canvas_draw_copy(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - pixman_region32_t dest_region; - SpiceCanvas *surface_canvas; - pixman_image_t *src_image; - SpiceROP rop; - - pixman_region32_init_rect(&dest_region, - bbox->left, bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top); - - canvas_clip_pixman(canvas, &dest_region, clip); - canvas_mask_pixman(canvas, &dest_region, ©->mask, - bbox->left, bbox->top); - - rop = ropd_descriptor_to_rop(copy->rop_descriptor, - ROP_INPUT_SRC, - ROP_INPUT_DEST); - - if (rop == SPICE_ROP_NOOP || !pixman_region32_not_empty(&dest_region)) { - canvas_touch_image(canvas, copy->src_bitmap); - pixman_region32_fini(&dest_region); - return; - } - - surface_canvas = canvas_get_surface(canvas, copy->src_bitmap); - if (surface_canvas) { - if (rect_is_same_size(bbox, ©->src_area)) { - if (rop == SPICE_ROP_COPY) { - spice_canvas->ops->blit_image_from_surface(spice_canvas, &dest_region, - surface_canvas, - bbox->left - copy->src_area.left, - bbox->top - copy->src_area.top); - } else { - spice_canvas->ops->blit_image_rop_from_surface(spice_canvas, &dest_region, - surface_canvas, - bbox->left - copy->src_area.left, - bbox->top - copy->src_area.top, - rop); - } - } else { - if (rop == SPICE_ROP_COPY) { - spice_canvas->ops->scale_image_from_surface(spice_canvas, &dest_region, - surface_canvas, - copy->src_area.left, - copy->src_area.top, - copy->src_area.right - copy->src_area.left, - copy->src_area.bottom - copy->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - copy->scale_mode); - } else { - spice_canvas->ops->scale_image_rop_from_surface(spice_canvas, &dest_region, - surface_canvas, - copy->src_area.left, - copy->src_area.top, - copy->src_area.right - copy->src_area.left, - copy->src_area.bottom - copy->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - copy->scale_mode, - rop); - } - } - } else { - src_image = canvas_get_image(canvas, copy->src_bitmap, FALSE); - spice_return_if_fail(src_image != NULL); - - if (rect_is_same_size(bbox, ©->src_area)) { - if (rop == SPICE_ROP_COPY) { - spice_canvas->ops->blit_image(spice_canvas, &dest_region, - src_image, - bbox->left - copy->src_area.left, - bbox->top - copy->src_area.top); - } else { - spice_canvas->ops->blit_image_rop(spice_canvas, &dest_region, - src_image, - bbox->left - copy->src_area.left, - bbox->top - copy->src_area.top, - rop); - } - } else { - if (rop == SPICE_ROP_COPY) { - spice_canvas->ops->scale_image(spice_canvas, &dest_region, - src_image, - copy->src_area.left, - copy->src_area.top, - copy->src_area.right - copy->src_area.left, - copy->src_area.bottom - copy->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - copy->scale_mode); - } else { - spice_canvas->ops->scale_image_rop(spice_canvas, &dest_region, - src_image, - copy->src_area.left, - copy->src_area.top, - copy->src_area.right - copy->src_area.left, - copy->src_area.bottom - copy->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - copy->scale_mode, - rop); - } - } - pixman_image_unref(src_image); - } - pixman_region32_fini(&dest_region); -} - -static void canvas_draw_transparent(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - SpiceCanvas *surface_canvas; - pixman_image_t *src_image; - pixman_region32_t dest_region; - uint32_t transparent_color; - - pixman_region32_init_rect(&dest_region, - bbox->left, bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top); - - canvas_clip_pixman(canvas, &dest_region, clip); - - if (pixman_region32_n_rects (&dest_region) == 0) { - canvas_touch_image(canvas, transparent->src_bitmap); - pixman_region32_fini(&dest_region); - return; - } - - switch (canvas->format) { - case SPICE_SURFACE_FMT_32_xRGB: - case SPICE_SURFACE_FMT_32_ARGB: - transparent_color = transparent->true_color; - break; - case SPICE_SURFACE_FMT_16_555: - transparent_color = rgb_32_to_16_555(transparent->true_color); - break; - case SPICE_SURFACE_FMT_16_565: - transparent_color = rgb_32_to_16_565(transparent->true_color); - break; - default: - transparent_color = 0; - } - - surface_canvas = canvas_get_surface(canvas, transparent->src_bitmap); - if (surface_canvas) { - if (rect_is_same_size(bbox, &transparent->src_area)) { - spice_canvas->ops->colorkey_image_from_surface(spice_canvas, &dest_region, - surface_canvas, - bbox->left - transparent->src_area.left, - bbox->top - transparent->src_area.top, - transparent_color); - } else { - spice_canvas->ops->colorkey_scale_image_from_surface(spice_canvas, &dest_region, - surface_canvas, - transparent->src_area.left, - transparent->src_area.top, - transparent->src_area.right - transparent->src_area.left, - transparent->src_area.bottom - transparent->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - transparent_color); - } - } else { - src_image = canvas_get_image(canvas, transparent->src_bitmap, FALSE); - spice_return_if_fail(src_image != NULL); - - if (rect_is_same_size(bbox, &transparent->src_area)) { - spice_canvas->ops->colorkey_image(spice_canvas, &dest_region, - src_image, - bbox->left - transparent->src_area.left, - bbox->top - transparent->src_area.top, - transparent_color); - } else { - spice_canvas->ops->colorkey_scale_image(spice_canvas, &dest_region, - src_image, - transparent->src_area.left, - transparent->src_area.top, - transparent->src_area.right - transparent->src_area.left, - transparent->src_area.bottom - transparent->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - transparent_color); - } - pixman_image_unref(src_image); - } - pixman_region32_fini(&dest_region); -} - -static void canvas_draw_alpha_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlend* alpha_blend) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - pixman_region32_t dest_region; - SpiceCanvas *surface_canvas; - pixman_image_t *src_image; - - pixman_region32_init_rect(&dest_region, - bbox->left, bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top); - - canvas_clip_pixman(canvas, &dest_region, clip); - - if (alpha_blend->alpha == 0 || - !pixman_region32_not_empty(&dest_region)) { - canvas_touch_image(canvas, alpha_blend->src_bitmap); - pixman_region32_fini(&dest_region); - return; - } - - surface_canvas = canvas_get_surface(canvas, alpha_blend->src_bitmap); - if (surface_canvas) { - if (rect_is_same_size(bbox, &alpha_blend->src_area)) { - spice_canvas->ops->blend_image_from_surface(spice_canvas, &dest_region, - alpha_blend->alpha_flags & SPICE_ALPHA_FLAGS_DEST_HAS_ALPHA, - surface_canvas, - alpha_blend->alpha_flags & SPICE_ALPHA_FLAGS_SRC_SURFACE_HAS_ALPHA, - alpha_blend->src_area.left, - alpha_blend->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - alpha_blend->alpha); - } else { - spice_canvas->ops->blend_scale_image_from_surface(spice_canvas, &dest_region, - alpha_blend->alpha_flags & SPICE_ALPHA_FLAGS_DEST_HAS_ALPHA, - surface_canvas, - alpha_blend->alpha_flags & SPICE_ALPHA_FLAGS_SRC_SURFACE_HAS_ALPHA, - alpha_blend->src_area.left, - alpha_blend->src_area.top, - alpha_blend->src_area.right - alpha_blend->src_area.left, - alpha_blend->src_area.bottom - alpha_blend->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - SPICE_IMAGE_SCALE_MODE_NEAREST, - alpha_blend->alpha); - } - } else { - src_image = canvas_get_image(canvas, alpha_blend->src_bitmap, TRUE); - spice_return_if_fail(src_image != NULL); - - if (rect_is_same_size(bbox, &alpha_blend->src_area)) { - spice_canvas->ops->blend_image(spice_canvas, &dest_region, - alpha_blend->alpha_flags & SPICE_ALPHA_FLAGS_DEST_HAS_ALPHA, - src_image, - alpha_blend->src_area.left, - alpha_blend->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - alpha_blend->alpha); - } else { - spice_canvas->ops->blend_scale_image(spice_canvas, &dest_region, - alpha_blend->alpha_flags & SPICE_ALPHA_FLAGS_DEST_HAS_ALPHA, - src_image, - alpha_blend->src_area.left, - alpha_blend->src_area.top, - alpha_blend->src_area.right - alpha_blend->src_area.left, - alpha_blend->src_area.bottom - alpha_blend->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - SPICE_IMAGE_SCALE_MODE_NEAREST, - alpha_blend->alpha); - } - - pixman_image_unref(src_image); - } - - pixman_region32_fini(&dest_region); -} - -static void canvas_draw_opaque(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - pixman_image_t *src_image; - pixman_region32_t dest_region; - SpiceCanvas *surface_canvas; - SpiceROP rop; - - pixman_region32_init_rect(&dest_region, - bbox->left, bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top); - - canvas_clip_pixman(canvas, &dest_region, clip); - canvas_mask_pixman(canvas, &dest_region, &opaque->mask, - bbox->left, bbox->top); - - rop = ropd_descriptor_to_rop(opaque->rop_descriptor, - ROP_INPUT_BRUSH, - ROP_INPUT_SRC); - - if (rop == SPICE_ROP_NOOP || !pixman_region32_not_empty(&dest_region)) { - canvas_touch_image(canvas, opaque->src_bitmap); - touch_brush(canvas, &opaque->brush); - pixman_region32_fini(&dest_region); - return; - } - - surface_canvas = canvas_get_surface(canvas, opaque->src_bitmap); - if (surface_canvas) { - if (rect_is_same_size(bbox, &opaque->src_area)) { - spice_canvas->ops->blit_image_from_surface(spice_canvas, &dest_region, - surface_canvas, - bbox->left - opaque->src_area.left, - bbox->top - opaque->src_area.top); - } else { - spice_canvas->ops->scale_image_from_surface(spice_canvas, &dest_region, - surface_canvas, - opaque->src_area.left, - opaque->src_area.top, - opaque->src_area.right - opaque->src_area.left, - opaque->src_area.bottom - opaque->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - opaque->scale_mode); - } - } else { - src_image = canvas_get_image(canvas, opaque->src_bitmap, FALSE); - spice_return_if_fail(src_image != NULL); - - if (rect_is_same_size(bbox, &opaque->src_area)) { - spice_canvas->ops->blit_image(spice_canvas, &dest_region, - src_image, - bbox->left - opaque->src_area.left, - bbox->top - opaque->src_area.top); - } else { - spice_canvas->ops->scale_image(spice_canvas, &dest_region, - src_image, - opaque->src_area.left, - opaque->src_area.top, - opaque->src_area.right - opaque->src_area.left, - opaque->src_area.bottom - opaque->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - opaque->scale_mode); - } - pixman_image_unref(src_image); - } - - draw_brush(spice_canvas, &dest_region, &opaque->brush, rop); - - pixman_region32_fini(&dest_region); -} - -static void canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - SpiceCanvas *surface_canvas; - pixman_image_t *src_image; - pixman_region32_t dest_region; - SpiceROP rop; - - pixman_region32_init_rect(&dest_region, - bbox->left, bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top); - - canvas_clip_pixman(canvas, &dest_region, clip); - canvas_mask_pixman(canvas, &dest_region, &blend->mask, - bbox->left, bbox->top); - - rop = ropd_descriptor_to_rop(blend->rop_descriptor, - ROP_INPUT_SRC, - ROP_INPUT_DEST); - - if (rop == SPICE_ROP_NOOP || !pixman_region32_not_empty(&dest_region)) { - canvas_touch_image(canvas, blend->src_bitmap); - pixman_region32_fini(&dest_region); - return; - } - - surface_canvas = canvas_get_surface(canvas, blend->src_bitmap); - if (surface_canvas) { - if (rect_is_same_size(bbox, &blend->src_area)) { - if (rop == SPICE_ROP_COPY) - spice_canvas->ops->blit_image_from_surface(spice_canvas, &dest_region, - surface_canvas, - bbox->left - blend->src_area.left, - bbox->top - blend->src_area.top); - else - spice_canvas->ops->blit_image_rop_from_surface(spice_canvas, &dest_region, - surface_canvas, - bbox->left - blend->src_area.left, - bbox->top - blend->src_area.top, - rop); - } else { - if (rop == SPICE_ROP_COPY) { - spice_canvas->ops->scale_image_from_surface(spice_canvas, &dest_region, - surface_canvas, - blend->src_area.left, - blend->src_area.top, - blend->src_area.right - blend->src_area.left, - blend->src_area.bottom - blend->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - blend->scale_mode); - } else { - spice_canvas->ops->scale_image_rop_from_surface(spice_canvas, &dest_region, - surface_canvas, - blend->src_area.left, - blend->src_area.top, - blend->src_area.right - blend->src_area.left, - blend->src_area.bottom - blend->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - blend->scale_mode, rop); - } - } - } else { - src_image = canvas_get_image(canvas, blend->src_bitmap, FALSE); - spice_return_if_fail(src_image != NULL); - - if (rect_is_same_size(bbox, &blend->src_area)) { - if (rop == SPICE_ROP_COPY) - spice_canvas->ops->blit_image(spice_canvas, &dest_region, - src_image, - bbox->left - blend->src_area.left, - bbox->top - blend->src_area.top); - else - spice_canvas->ops->blit_image_rop(spice_canvas, &dest_region, - src_image, - bbox->left - blend->src_area.left, - bbox->top - blend->src_area.top, - rop); - } else { - if (rop == SPICE_ROP_COPY) { - spice_canvas->ops->scale_image(spice_canvas, &dest_region, - src_image, - blend->src_area.left, - blend->src_area.top, - blend->src_area.right - blend->src_area.left, - blend->src_area.bottom - blend->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - blend->scale_mode); - } else { - spice_canvas->ops->scale_image_rop(spice_canvas, &dest_region, - src_image, - blend->src_area.left, - blend->src_area.top, - blend->src_area.right - blend->src_area.left, - blend->src_area.bottom - blend->src_area.top, - bbox->left, - bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top, - blend->scale_mode, rop); - } - } - pixman_image_unref(src_image); - } - pixman_region32_fini(&dest_region); -} - -static void canvas_draw_blackness(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - pixman_region32_t dest_region; - pixman_box32_t *rects; - int n_rects; - - pixman_region32_init_rect(&dest_region, - bbox->left, bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top); - - - canvas_clip_pixman(canvas, &dest_region, clip); - canvas_mask_pixman(canvas, &dest_region, &blackness->mask, - bbox->left, bbox->top); - - if (!pixman_region32_not_empty(&dest_region)) { - pixman_region32_fini (&dest_region); - return; - } - - rects = pixman_region32_rectangles(&dest_region, &n_rects); - - spice_canvas->ops->fill_solid_rects(spice_canvas, rects, n_rects, 0x000000); - - pixman_region32_fini(&dest_region); -} - -static void canvas_draw_whiteness(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - pixman_region32_t dest_region; - pixman_box32_t *rects; - int n_rects; - - pixman_region32_init_rect(&dest_region, - bbox->left, bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top); - - - canvas_clip_pixman(canvas, &dest_region, clip); - canvas_mask_pixman(canvas, &dest_region, &whiteness->mask, - bbox->left, bbox->top); - - if (!pixman_region32_not_empty(&dest_region)) { - pixman_region32_fini(&dest_region); - return; - } - - rects = pixman_region32_rectangles(&dest_region, &n_rects); - spice_canvas->ops->fill_solid_rects(spice_canvas, rects, n_rects, 0xffffffff); - - pixman_region32_fini(&dest_region); -} - -static void canvas_draw_invers(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - pixman_region32_t dest_region; - pixman_box32_t *rects; - int n_rects; - - pixman_region32_init_rect(&dest_region, - bbox->left, bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top); - - - canvas_clip_pixman(canvas, &dest_region, clip); - canvas_mask_pixman(canvas, &dest_region, &invers->mask, - bbox->left, bbox->top); - - if (!pixman_region32_not_empty(&dest_region)) { - pixman_region32_fini(&dest_region); - return; - } - - rects = pixman_region32_rectangles(&dest_region, &n_rects); - spice_canvas->ops->fill_solid_rects_rop(spice_canvas, rects, n_rects, 0x00000000, - SPICE_ROP_INVERT); - - pixman_region32_fini(&dest_region); -} - -typedef struct { - lineGC base; - SpiceCanvas *canvas; - pixman_region32_t dest_region; - SpiceROP fore_rop; - SpiceROP back_rop; - int solid; - uint32_t color; - int use_surface_canvas; - union { - SpiceCanvas *surface_canvas; - pixman_image_t *tile; - }; - int tile_offset_x; - int tile_offset_y; -} StrokeGC; - -static void stroke_fill_spans(lineGC * pGC, - int num_spans, - SpicePoint *points, - int *widths, - int sorted, - int foreground) -{ - SpiceCanvas *canvas; - StrokeGC *strokeGC; - int i; - SpiceROP rop; - - strokeGC = (StrokeGC *)pGC; - canvas = strokeGC->canvas; - - num_spans = spice_canvas_clip_spans(&strokeGC->dest_region, - points, widths, num_spans, - points, widths, sorted); - - if (foreground) { - rop = strokeGC->fore_rop; - } else { - rop = strokeGC->back_rop; - } - - if (strokeGC->solid) { - if (rop == SPICE_ROP_COPY) { - canvas->ops->fill_solid_spans(canvas, points, widths, num_spans, - strokeGC->color); - } else { - for (i = 0; i < num_spans; i++) { - pixman_box32_t r; - r.x1 = points[i].x; - r.y1 = points[i].y; - r.x2 = points[i].x + widths[i]; - r.y2 = r.y1 + 1; - canvas->ops->fill_solid_rects_rop(canvas, &r, 1, - strokeGC->color, rop); - } - } - } else { - if (rop == SPICE_ROP_COPY) { - for (i = 0; i < num_spans; i++) { - pixman_box32_t r; - r.x1 = points[i].x; - r.y1 = points[i].y; - r.x2 = points[i].x + widths[i]; - r.y2 = r.y1 + 1; - canvas->ops->fill_tiled_rects(canvas, &r, 1, - strokeGC->tile, - strokeGC->tile_offset_x, - strokeGC->tile_offset_y); - } - } else { - for (i = 0; i < num_spans; i++) { - pixman_box32_t r; - r.x1 = points[i].x; - r.y1 = points[i].y; - r.x2 = points[i].x + widths[i]; - r.y2 = r.y1 + 1; - canvas->ops->fill_tiled_rects_rop(canvas, &r, 1, - strokeGC->tile, - strokeGC->tile_offset_x, - strokeGC->tile_offset_y, rop); - } - } - } -} - -static void stroke_fill_rects(lineGC * pGC, - int num_rects, - pixman_rectangle32_t *rects, - int foreground) -{ - SpiceCanvas *canvas; - pixman_region32_t area; - pixman_box32_t *boxes; - StrokeGC *strokeGC; - SpiceROP rop; - int i; - pixman_box32_t *area_rects; - int n_area_rects; - - strokeGC = (StrokeGC *)pGC; - canvas = strokeGC->canvas; - - if (foreground) { - rop = strokeGC->fore_rop; - } else { - rop = strokeGC->back_rop; - } - - /* TODO: We can optimize this for more common cases where - dest is one rect */ - - boxes = spice_new(pixman_box32_t, num_rects); - for (i = 0; i < num_rects; i++) { - boxes[i].x1 = rects[i].x; - boxes[i].y1 = rects[i].y; - boxes[i].x2 = rects[i].x + rects[i].width; - boxes[i].y2 = rects[i].y + rects[i].height; - } - pixman_region32_init_rects(&area, boxes, num_rects); - pixman_region32_intersect(&area, &area, &strokeGC->dest_region); - free(boxes); - - area_rects = pixman_region32_rectangles(&area, &n_area_rects); - - if (strokeGC->solid) { - if (rop == SPICE_ROP_COPY) { - canvas->ops->fill_solid_rects(canvas, area_rects, n_area_rects, - strokeGC->color); - } else { - canvas->ops->fill_solid_rects_rop(canvas, area_rects, n_area_rects, - strokeGC->color, rop); - } - } else { - if (rop == SPICE_ROP_COPY) { - if (strokeGC->use_surface_canvas) { - canvas->ops->fill_tiled_rects_from_surface(canvas, area_rects, n_area_rects, - strokeGC->surface_canvas, - strokeGC->tile_offset_x, - strokeGC->tile_offset_y); - } else { - canvas->ops->fill_tiled_rects(canvas, area_rects, n_area_rects, - strokeGC->tile, - strokeGC->tile_offset_x, - strokeGC->tile_offset_y); - } - } else { - if (strokeGC->use_surface_canvas) { - canvas->ops->fill_tiled_rects_rop_from_surface(canvas, area_rects, n_area_rects, - strokeGC->surface_canvas, - strokeGC->tile_offset_x, - strokeGC->tile_offset_y, - rop); - } else { - canvas->ops->fill_tiled_rects_rop(canvas, area_rects, n_area_rects, - strokeGC->tile, - strokeGC->tile_offset_x, - strokeGC->tile_offset_y, - rop); - } - } - } - - pixman_region32_fini(&area); -} - -typedef struct { - SpicePoint *points; - int num_points; - int size; -} StrokeLines; - -static void stroke_lines_init(StrokeLines *lines) -{ - lines->points = spice_new(SpicePoint, 10); - lines->size = 10; - lines->num_points = 0; -} - -static void stroke_lines_free(StrokeLines *lines) -{ - free(lines->points); -} - -static void stroke_lines_append(StrokeLines *lines, - int x, int y) -{ - if (lines->num_points == lines->size) { - lines->size *= 2; - lines->points = spice_renew(SpicePoint, lines->points, lines->size); - } - lines->points[lines->num_points].x = x; - lines->points[lines->num_points].y = y; - lines->num_points++; -} - -static void stroke_lines_append_fix(StrokeLines *lines, - SpicePointFix *point) -{ - stroke_lines_append(lines, - fix_to_int(point->x), - fix_to_int(point->y)); -} - -static inline int64_t dot(SPICE_FIXED28_4 x1, - SPICE_FIXED28_4 y1, - SPICE_FIXED28_4 x2, - SPICE_FIXED28_4 y2) -{ - return (((int64_t)x1) *((int64_t)x2) + - ((int64_t)y1) *((int64_t)y2)) >> 4; -} - -static inline int64_t dot2(SPICE_FIXED28_4 x, - SPICE_FIXED28_4 y) -{ - return (((int64_t)x) *((int64_t)x) + - ((int64_t)y) *((int64_t)y)) >> 4; -} - -static void subdivide_bezier(StrokeLines *lines, - SpicePointFix point0, - SpicePointFix point1, - SpicePointFix point2, - SpicePointFix point3) -{ - int64_t A2, B2, C2, AB, CB, h1, h2; - - A2 = dot2(point1.x - point0.x, - point1.y - point0.y); - B2 = dot2(point3.x - point0.x, - point3.y - point0.y); - C2 = dot2(point2.x - point3.x, - point2.y - point3.y); - - AB = dot(point1.x - point0.x, - point1.y - point0.y, - point3.x - point0.x, - point3.y - point0.y); - - CB = dot(point2.x - point3.x, - point2.y - point3.y, - point0.x - point3.x, - point0.y - point3.y); - - h1 = (A2*B2 - AB*AB) >> 3; - h2 = (C2*B2 - CB*CB) >> 3; - - if (h1 < B2 && h2 < B2) { - /* deviation squared less than half a pixel, use straight line */ - stroke_lines_append_fix(lines, &point3); - } else { - SpicePointFix point01, point23, point12, point012, point123, point0123; - - point01.x = (point0.x + point1.x) / 2; - point01.y = (point0.y + point1.y) / 2; - point12.x = (point1.x + point2.x) / 2; - point12.y = (point1.y + point2.y) / 2; - point23.x = (point2.x + point3.x) / 2; - point23.y = (point2.y + point3.y) / 2; - point012.x = (point01.x + point12.x) / 2; - point012.y = (point01.y + point12.y) / 2; - point123.x = (point12.x + point23.x) / 2; - point123.y = (point12.y + point23.y) / 2; - point0123.x = (point012.x + point123.x) / 2; - point0123.y = (point012.y + point123.y) / 2; - - subdivide_bezier(lines, point0, point01, point012, point0123); - subdivide_bezier(lines, point0123, point123, point23, point3); - } -} - -static void stroke_lines_append_bezier(StrokeLines *lines, - SpicePointFix *point1, - SpicePointFix *point2, - SpicePointFix *point3) -{ - SpicePointFix point0; - - point0.x = int_to_fix(lines->points[lines->num_points-1].x); - point0.y = int_to_fix(lines->points[lines->num_points-1].y); - - subdivide_bezier(lines, point0, *point1, *point2, *point3); -} - -static void stroke_lines_draw(StrokeLines *lines, - lineGC *gc, - int dashed) -{ - if (lines->num_points != 0) { - if (dashed) { - spice_canvas_zero_dash_line(gc, CoordModeOrigin, - lines->num_points, lines->points); - } else { - spice_canvas_zero_line(gc, CoordModeOrigin, - lines->num_points, lines->points); - } - lines->num_points = 0; - } -} - - -static void canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox, - SpiceClip *clip, SpiceStroke *stroke) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - SpiceCanvas *surface_canvas = NULL; - StrokeGC gc = { { 0 } }; - lineGCOps ops = { - stroke_fill_spans, - stroke_fill_rects - }; - StrokeLines lines; - unsigned int i; - int dashed; - - pixman_region32_init_rect(&gc.dest_region, - bbox->left, bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top); - - canvas_clip_pixman(canvas, &gc.dest_region, clip); - - if (!pixman_region32_not_empty(&gc.dest_region)) { - touch_brush(canvas, &stroke->brush); - pixman_region32_fini(&gc.dest_region); - return; - } - - gc.canvas = spice_canvas; - gc.fore_rop = ropd_descriptor_to_rop(stroke->fore_mode, - ROP_INPUT_BRUSH, - ROP_INPUT_DEST); - gc.back_rop = ropd_descriptor_to_rop(stroke->back_mode, - ROP_INPUT_BRUSH, - ROP_INPUT_DEST); - - gc.base.width = canvas->width; - gc.base.height = canvas->height; - gc.base.alu = gc.fore_rop; - gc.base.lineWidth = 0; - - /* dash */ - gc.base.dashOffset = 0; - gc.base.dash = NULL; - gc.base.numInDashList = 0; - gc.base.lineStyle = LineSolid; - /* win32 cosmetic lines are endpoint-exclusive, so use CapNotLast */ - gc.base.capStyle = CapNotLast; - gc.base.joinStyle = JoinMiter; - gc.base.ops = &ops; - - dashed = 0; - if (stroke->attr.flags & SPICE_LINE_FLAGS_STYLED) { - SPICE_FIXED28_4 *style = stroke->attr.style; - int nseg; - - dashed = 1; - - nseg = stroke->attr.style_nseg; - - /* To truly handle back_mode we should use LineDoubleDash here - and treat !foreground as back_rop using the same brush. - However, using the same brush for that seems wrong. - The old cairo backend was stroking the non-dashed line with - rop_mode before enabling dashes for the foreground which is - not right either. The gl an gdi backend don't use back_mode - at all */ - gc.base.lineStyle = LineOnOffDash; - gc.base.dash = (unsigned char *)spice_malloc(nseg); - gc.base.numInDashList = nseg; - - if (stroke->attr.flags & SPICE_LINE_FLAGS_START_WITH_GAP) { - gc.base.dash[stroke->attr.style_nseg - 1] = fix_to_int(style[0]); - for (i = 0; i < (unsigned int)(stroke->attr.style_nseg - 1); i++) { - gc.base.dash[i] = fix_to_int(style[i+1]); - } - gc.base.dashOffset = gc.base.dash[0]; - } else { - for (i = 0; i < stroke->attr.style_nseg; i++) { - gc.base.dash[i] = fix_to_int(style[i]); - } - } - } - - switch (stroke->brush.type) { - case SPICE_BRUSH_TYPE_NONE: - gc.solid = TRUE; - gc.color = 0; - break; - case SPICE_BRUSH_TYPE_SOLID: - gc.solid = TRUE; - gc.color = stroke->brush.u.color; - break; - case SPICE_BRUSH_TYPE_PATTERN: - gc.solid = FALSE; - surface_canvas = canvas_get_surface(canvas, - stroke->brush.u.pattern.pat); - if (surface_canvas) { - gc.use_surface_canvas = TRUE; - gc.surface_canvas = surface_canvas; - } else { - gc.use_surface_canvas = FALSE; - gc.tile = canvas_get_image(canvas, - stroke->brush.u.pattern.pat, - FALSE); - } - gc.tile_offset_x = stroke->brush.u.pattern.pos.x; - gc.tile_offset_y = stroke->brush.u.pattern.pos.y; - break; - default: - spice_warn_if_reached(); - return; - } - - stroke_lines_init(&lines); - - for (i = 0; i < stroke->path->num_segments; i++) { - SpicePathSeg *seg = stroke->path->segments[i]; - SpicePointFix* point, *end_point; - - point = seg->points; - end_point = point + seg->count; - - if (seg->flags & SPICE_PATH_BEGIN) { - stroke_lines_draw(&lines, (lineGC *)&gc, dashed); - stroke_lines_append_fix(&lines, point); - point++; - } - - if (seg->flags & SPICE_PATH_BEZIER) { - spice_return_if_fail((point - end_point) % 3 == 0); - for (; point + 2 < end_point; point += 3) { - stroke_lines_append_bezier(&lines, - &point[0], - &point[1], - &point[2]); - } - } else - { - for (; point < end_point; point++) { - stroke_lines_append_fix(&lines, point); - } - } - if (seg->flags & SPICE_PATH_END) { - if (seg->flags & SPICE_PATH_CLOSE) { - stroke_lines_append(&lines, - lines.points[0].x, lines.points[0].y); - } - stroke_lines_draw(&lines, (lineGC *)&gc, dashed); - } - } - - stroke_lines_draw(&lines, (lineGC *)&gc, dashed); - - if (gc.base.dash) { - free(gc.base.dash); - } - stroke_lines_free(&lines); - - if (!gc.solid && gc.tile && !surface_canvas) { - pixman_image_unref(gc.tile); - } - - pixman_region32_fini(&gc.dest_region); -} - - -//need surfaces handling here !!! -static void canvas_draw_rop3(SpiceCanvas *spice_canvas, SpiceRect *bbox, - SpiceClip *clip, SpiceRop3 *rop3) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - SpiceCanvas *surface_canvas; - pixman_region32_t dest_region; - pixman_image_t *d; - pixman_image_t *s; - SpicePoint src_pos; - int width; - int heigth; - - pixman_region32_init_rect(&dest_region, - bbox->left, bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top); - - canvas_clip_pixman(canvas, &dest_region, clip); - canvas_mask_pixman(canvas, &dest_region, &rop3->mask, - bbox->left, bbox->top); - - width = bbox->right - bbox->left; - heigth = bbox->bottom - bbox->top; - - d = canvas_get_image_from_self(spice_canvas, bbox->left, bbox->top, width, heigth); - surface_canvas = canvas_get_surface(canvas, rop3->src_bitmap); - if (surface_canvas) { - s = surface_canvas->ops->get_image(surface_canvas); - } else { - s = canvas_get_image(canvas, rop3->src_bitmap, FALSE); - } - - if (!rect_is_same_size(bbox, &rop3->src_area)) { - pixman_image_t *scaled_s = canvas_scale_surface(s, &rop3->src_area, width, heigth, - rop3->scale_mode); - pixman_image_unref(s); - s = scaled_s; - src_pos.x = 0; - src_pos.y = 0; - } else { - src_pos.x = rop3->src_area.left; - src_pos.y = rop3->src_area.top; - } - if (pixman_image_get_width(s) - src_pos.x < width || - pixman_image_get_height(s) - src_pos.y < heigth) { - spice_critical("bad src bitmap size"); - return; - } - if (rop3->brush.type == SPICE_BRUSH_TYPE_PATTERN) { - SpiceCanvas *_surface_canvas; - pixman_image_t *p; - - _surface_canvas = canvas_get_surface(canvas, rop3->brush.u.pattern.pat); - if (_surface_canvas) { - p = _surface_canvas->ops->get_image(_surface_canvas); - } else { - p = canvas_get_image(canvas, rop3->brush.u.pattern.pat, FALSE); - } - SpicePoint pat_pos; - - pat_pos.x = (bbox->left - rop3->brush.u.pattern.pos.x) % pixman_image_get_width(p); - pat_pos.y = (bbox->top - rop3->brush.u.pattern.pos.y) % pixman_image_get_height(p); - do_rop3_with_pattern(rop3->rop3, d, s, &src_pos, p, &pat_pos); - pixman_image_unref(p); - } else { - do_rop3_with_color(rop3->rop3, d, s, &src_pos, rop3->brush.u.color); - } - pixman_image_unref(s); - - spice_canvas->ops->blit_image(spice_canvas, &dest_region, d, - bbox->left, - bbox->top); - - pixman_image_unref(d); - - pixman_region32_fini(&dest_region); -} - -static void canvas_copy_bits(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - pixman_region32_t dest_region; - int dx, dy; - - pixman_region32_init_rect(&dest_region, - bbox->left, bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top); - - canvas_clip_pixman(canvas, &dest_region, clip); - - dx = bbox->left - src_pos->x; - dy = bbox->top - src_pos->y; - - if (dx != 0 || dy != 0) { - pixman_region32_t src_region; - - /* Clip so we don't read outside canvas */ - pixman_region32_init_rect(&src_region, - dx, dy, - canvas->width, - canvas->height); - pixman_region32_intersect(&dest_region, &dest_region, &src_region); - pixman_region32_fini(&src_region); - - spice_canvas->ops->copy_region(spice_canvas, &dest_region, dx, dy); - } - - pixman_region32_fini(&dest_region); -} - - - -static void canvas_base_group_start(SpiceCanvas *spice_canvas, QRegion *region) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - pixman_region32_fini(&canvas->canvas_region); - - /* Make sure we always clip to canvas size */ - pixman_region32_init_rect(&canvas->canvas_region, - 0, 0, - canvas->width, - canvas->height); - - pixman_region32_intersect(&canvas->canvas_region, &canvas->canvas_region, region); -} - -static void canvas_base_group_end(SpiceCanvas *spice_canvas) -{ - CanvasBase *canvas = (CanvasBase *)spice_canvas; - pixman_region32_fini(&canvas->canvas_region); - pixman_region32_init_rect(&canvas->canvas_region, - 0, 0, - canvas->width, - canvas->height); -} - - -static void unimplemented_op(SpiceCanvas *canvas) -{ - spice_critical("unimplemented canvas operation"); -} - -inline static void canvas_base_init_ops(SpiceCanvasOps *ops) -{ - void **ops_cast; - unsigned i; - - ops_cast = (void **)ops; - for (i = 0; i < sizeof(SpiceCanvasOps) / sizeof(void *); i++) { - ops_cast[i] = (void *) unimplemented_op; - } - - ops->draw_fill = canvas_draw_fill; - ops->draw_copy = canvas_draw_copy; - ops->draw_opaque = canvas_draw_opaque; - ops->copy_bits = canvas_copy_bits; - ops->draw_blend = canvas_draw_blend; - ops->draw_blackness = canvas_draw_blackness; - ops->draw_whiteness = canvas_draw_whiteness; - ops->draw_invers = canvas_draw_invers; - ops->draw_transparent = canvas_draw_transparent; - ops->draw_alpha_blend = canvas_draw_alpha_blend; - ops->draw_stroke = canvas_draw_stroke; - ops->draw_rop3 = canvas_draw_rop3; - ops->group_start = canvas_base_group_start; - ops->group_end = canvas_base_group_end; -} - -static int canvas_base_init(CanvasBase *canvas, SpiceCanvasOps *ops, - int width, int height, uint32_t format -#ifdef SW_CANVAS_CACHE - , SpiceImageCache *bits_cache - , SpicePaletteCache *palette_cache -#elif defined(SW_CANVAS_IMAGE_CACHE) - , SpiceImageCache *bits_cache -#endif - , SpiceImageSurfaces *surfaces - , SpiceGlzDecoder *glz_decoder - , SpiceJpegDecoder *jpeg_decoder - , SpiceZlibDecoder *zlib_decoder - ) -{ - canvas->parent.ops = ops; - canvas->quic_data.usr.error = quic_usr_error; - canvas->quic_data.usr.warn = quic_usr_warn; - canvas->quic_data.usr.info = quic_usr_warn; - canvas->quic_data.usr.malloc = quic_usr_malloc; - canvas->quic_data.usr.free = quic_usr_free; - canvas->quic_data.usr.more_space = quic_usr_more_space; - canvas->quic_data.usr.more_lines = quic_usr_more_lines; - if (!(canvas->quic_data.quic = quic_create(&canvas->quic_data.usr))) { - return 0; - } - - canvas->lz_data.usr.error = lz_usr_error; - canvas->lz_data.usr.warn = lz_usr_warn; - canvas->lz_data.usr.info = lz_usr_warn; - canvas->lz_data.usr.malloc = lz_usr_malloc; - canvas->lz_data.usr.free = lz_usr_free; - canvas->lz_data.usr.more_space = lz_usr_more_space; - canvas->lz_data.usr.more_lines = lz_usr_more_lines; - if (!(canvas->lz_data.lz = lz_create(&canvas->lz_data.usr))) { - return 0; - } - - canvas->surfaces = surfaces; - canvas->glz_data.decoder = glz_decoder; - canvas->jpeg = jpeg_decoder; - canvas->zlib = zlib_decoder; - - canvas->format = format; - - /* TODO: This is all wrong now */ - if (SPICE_SURFACE_FMT_DEPTH(format) == 16) { - canvas->color_shift = 5; - canvas->color_mask = 0x1f; - } else { - canvas->color_shift = 8; - canvas->color_mask = 0xff; - } - - canvas->width = width; - canvas->height = height; - pixman_region32_init_rect(&canvas->canvas_region, - 0, 0, - canvas->width, - canvas->height); - -#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) - canvas->bits_cache = bits_cache; -#endif -#ifdef SW_CANVAS_CACHE - canvas->palette_cache = palette_cache; -#endif - -#ifdef WIN32 - canvas->dc = NULL; -#endif - -#ifdef GDI_CANVAS - canvas->dc = create_compatible_dc(); - if (!canvas->dc) { - lz_destroy(canvas->lz_data.lz); - return 0; - } -#endif - return 1; -} diff -Nru spice-gtk-0.9/common/canvas_base.h spice-gtk-0.12/common/canvas_base.h --- spice-gtk-0.9/common/canvas_base.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/canvas_base.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,316 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H_CANVAS_BASE -#define _H_CANVAS_BASE - - -#include "pixman_utils.h" -#include "lz.h" -#include "region.h" -#include "draw.h" -#ifdef WIN32 -#include -#endif - -typedef void (*spice_destroy_fn_t)(void *data); - -typedef struct _SpiceImageCache SpiceImageCache; -typedef struct _SpiceImageSurfaces SpiceImageSurfaces; -typedef struct _SpicePaletteCache SpicePaletteCache; -typedef struct _SpiceGlzDecoder SpiceGlzDecoder; -typedef struct _SpiceJpegDecoder SpiceJpegDecoder; -typedef struct _SpiceZlibDecoder SpiceZlibDecoder; -typedef struct _SpiceCanvas SpiceCanvas; - -typedef struct { - void (*put)(SpiceImageCache *cache, - uint64_t id, - pixman_image_t *surface); - pixman_image_t *(*get)(SpiceImageCache *cache, - uint64_t id); -#ifdef SW_CANVAS_CACHE - void (*put_lossy)(SpiceImageCache *cache, - uint64_t id, - pixman_image_t *surface); - void (*replace_lossy)(SpiceImageCache *cache, - uint64_t id, - pixman_image_t *surface); - pixman_image_t *(*get_lossless)(SpiceImageCache *cache, - uint64_t id); -#endif -} SpiceImageCacheOps; - -struct _SpiceImageCache { - SpiceImageCacheOps *ops; -}; - -typedef struct { - SpiceCanvas *(*get)(SpiceImageSurfaces *surfaces, - uint32_t surface_id); -} SpiceImageSurfacesOps; - -struct _SpiceImageSurfaces { - SpiceImageSurfacesOps *ops; -}; - -typedef struct { - void (*put)(SpicePaletteCache *cache, - SpicePalette *palette); - SpicePalette *(*get)(SpicePaletteCache *cache, - uint64_t id); - void (*release)(SpicePaletteCache *cache, - SpicePalette *palette); -} SpicePaletteCacheOps; - -struct _SpicePaletteCache { - SpicePaletteCacheOps *ops; -}; - -typedef struct { - void (*decode)(SpiceGlzDecoder *decoder, - uint8_t *data, - SpicePalette *plt, - void *usr_data); -} SpiceGlzDecoderOps; - -struct _SpiceGlzDecoder { - SpiceGlzDecoderOps *ops; -}; - - -typedef struct SpiceJpegDecoderOps { - void (*begin_decode)(SpiceJpegDecoder *decoder, - uint8_t* data, - int data_size, - int* out_width, - int* out_height); - void (*decode)(SpiceJpegDecoder *decoder, - uint8_t* dest, - int stride, - int format); -} SpiceJpegDecoderOps; - -struct _SpiceJpegDecoder { - SpiceJpegDecoderOps *ops; -}; - -typedef struct { - void (*decode)(SpiceZlibDecoder *decoder, - uint8_t *data, - int data_size, - uint8_t *dest, - int dest_size); -} SpiceZlibDecoderOps; - -struct _SpiceZlibDecoder { - SpiceZlibDecoderOps *ops; -}; - -typedef struct { - void (*draw_fill)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill); - void (*draw_copy)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy); - void (*draw_opaque)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque); - void (*copy_bits)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos); - void (*draw_text)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text); - void (*draw_stroke)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke); - void (*draw_rop3)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3); - void (*draw_blend)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend); - void (*draw_blackness)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness); - void (*draw_whiteness)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness); - void (*draw_invers)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers); - void (*draw_transparent)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent); - void (*draw_alpha_blend)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlend* alpha_blend); - void (*put_image)(SpiceCanvas *canvas, -#ifdef WIN32 - HDC dc, -#endif - const SpiceRect *dest, const uint8_t *src_data, - uint32_t src_width, uint32_t src_height, int src_stride, - const QRegion *clip); - void (*clear)(SpiceCanvas *canvas); - void (*read_bits)(SpiceCanvas *canvas, uint8_t *dest, int dest_stride, const SpiceRect *area); - void (*group_start)(SpiceCanvas *canvas, QRegion *region); - void (*group_end)(SpiceCanvas *canvas); - void (*destroy)(SpiceCanvas *canvas); - - /* Implementation vfuncs */ - void (*fill_solid_spans)(SpiceCanvas *canvas, - SpicePoint *points, - int *widths, - int n_spans, - uint32_t color); - void (*fill_solid_rects)(SpiceCanvas *canvas, - pixman_box32_t *rects, - int n_rects, - uint32_t color); - void (*fill_solid_rects_rop)(SpiceCanvas *canvas, - pixman_box32_t *rects, - int n_rects, - uint32_t color, - SpiceROP rop); - void (*fill_tiled_rects)(SpiceCanvas *canvas, - pixman_box32_t *rects, - int n_rects, - pixman_image_t *tile, - int offset_x, int offset_y); - void (*fill_tiled_rects_from_surface)(SpiceCanvas *canvas, - pixman_box32_t *rects, - int n_rects, - SpiceCanvas *tile, - int offset_x, int offset_y); - void (*fill_tiled_rects_rop)(SpiceCanvas *canvas, - pixman_box32_t *rects, - int n_rects, - pixman_image_t *tile, - int offset_x, int offset_y, - SpiceROP rop); - void (*fill_tiled_rects_rop_from_surface)(SpiceCanvas *canvas, - pixman_box32_t *rects, - int n_rects, - SpiceCanvas *tile, - int offset_x, int offset_y, - SpiceROP rop); - void (*blit_image)(SpiceCanvas *canvas, - pixman_region32_t *region, - pixman_image_t *src_image, - int offset_x, int offset_y); - void (*blit_image_from_surface)(SpiceCanvas *canvas, - pixman_region32_t *region, - SpiceCanvas *src_image, - int offset_x, int offset_y); - void (*blit_image_rop)(SpiceCanvas *canvas, - pixman_region32_t *region, - pixman_image_t *src_image, - int offset_x, int offset_y, - SpiceROP rop); - void (*blit_image_rop_from_surface)(SpiceCanvas *canvas, - pixman_region32_t *region, - SpiceCanvas *src_image, - int offset_x, int offset_y, - SpiceROP rop); - void (*scale_image)(SpiceCanvas *canvas, - pixman_region32_t *region, - pixman_image_t *src_image, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode); - void (*scale_image_from_surface)(SpiceCanvas *canvas, - pixman_region32_t *region, - SpiceCanvas *src_image, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode); - void (*scale_image_rop)(SpiceCanvas *canvas, - pixman_region32_t *region, - pixman_image_t *src_image, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode, SpiceROP rop); - void (*scale_image_rop_from_surface)(SpiceCanvas *canvas, - pixman_region32_t *region, - SpiceCanvas *src_image, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode, SpiceROP rop); - void (*blend_image)(SpiceCanvas *canvas, - pixman_region32_t *region, - int dest_has_alpha, - pixman_image_t *src_image, - int src_x, int src_y, - int dest_x, int dest_y, - int width, int height, - int overall_alpha); - void (*blend_image_from_surface)(SpiceCanvas *canvas, - pixman_region32_t *region, - int dest_has_alpha, - SpiceCanvas *src_image, - int src_has_alpha, - int src_x, int src_y, - int dest_x, int dest_y, - int width, int height, - int overall_alpha); - void (*blend_scale_image)(SpiceCanvas *canvas, - pixman_region32_t *region, - int dest_has_alpha, - pixman_image_t *src_image, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode, - int overall_alpha); - void (*blend_scale_image_from_surface)(SpiceCanvas *canvas, - pixman_region32_t *region, - int dest_has_alpha, - SpiceCanvas *src_image, - int src_has_alpha, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode, - int overall_alpha); - void (*colorkey_image)(SpiceCanvas *canvas, - pixman_region32_t *region, - pixman_image_t *src_image, - int offset_x, int offset_y, - uint32_t transparent_color); - void (*colorkey_image_from_surface)(SpiceCanvas *canvas, - pixman_region32_t *region, - SpiceCanvas *src_image, - int offset_x, int offset_y, - uint32_t transparent_color); - void (*colorkey_scale_image)(SpiceCanvas *canvas, - pixman_region32_t *region, - pixman_image_t *src_image, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - uint32_t transparent_color); - void (*colorkey_scale_image_from_surface)(SpiceCanvas *canvas, - pixman_region32_t *region, - SpiceCanvas *src_image, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - uint32_t transparent_color); - void (*copy_region)(SpiceCanvas *canvas, - pixman_region32_t *dest_region, - int dx, int dy); - pixman_image_t *(*get_image)(SpiceCanvas *canvas); -} SpiceCanvasOps; - -void spice_canvas_set_usr_data(SpiceCanvas *canvas, void *data, spice_destroy_fn_t destroy_fn); -void *spice_canvas_get_usr_data(SpiceCanvas *canvas); - -struct _SpiceCanvas { - SpiceCanvasOps *ops; -}; - -#endif diff -Nru spice-gtk-0.9/common/canvas_utils.c spice-gtk-0.12/common/canvas_utils.c --- spice-gtk-0.9/common/canvas_utils.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/canvas_utils.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,307 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#include "canvas_utils.h" - -#include - -#ifdef __GNUC__ -#include -#include -#endif -#include "mem.h" - -#ifdef WIN32 -static int gdi_handlers = 0; -#endif - -#ifndef ASSERT -#define ASSERT(x) if (!(x)) { \ - printf("%s: ASSERT %s failed\n", __FUNCTION__, #x); \ - abort(); \ -} -#endif - - -#ifndef CANVAS_ERROR -#define CANVAS_ERROR(format, ...) { \ - printf("%s: " format "\n", __FUNCTION__, ## __VA_ARGS__); \ - abort(); \ -} -#endif - -static void release_data(pixman_image_t *image, void *release_data) -{ - PixmanData *data = (PixmanData *)release_data; - -#ifdef WIN32 - if (data->bitmap) { - DeleteObject((HBITMAP)data->bitmap); - CloseHandle(data->mutex); - gdi_handlers--; - } -#endif - if (data->data) { - free(data->data); - } - - free(data); -} - -static PixmanData * -pixman_image_add_data(pixman_image_t *image) -{ - PixmanData *data; - - data = (PixmanData *)pixman_image_get_destroy_data(image); - if (data == NULL) { - data = (PixmanData *)calloc(1, sizeof(PixmanData)); - if (data == NULL) { - CANVAS_ERROR("out of memory"); - } - pixman_image_set_destroy_function(image, - release_data, - data); - } - - return data; -} - -void -spice_pixman_image_set_format(pixman_image_t *image, - pixman_format_code_t format) -{ - PixmanData *data; - - data = pixman_image_add_data(image); - data->format = format; -} - -pixman_format_code_t -spice_pixman_image_get_format(pixman_image_t *image) -{ - PixmanData *data; - - data = (PixmanData *)pixman_image_get_destroy_data(image); - if (data != NULL && - data->format != 0) - return data->format; - - CANVAS_ERROR("Unknown pixman image type"); -} - -static inline pixman_image_t *__surface_create_stride(pixman_format_code_t format, int width, int height, - int stride) -{ - uint8_t *data; - uint8_t *stride_data; - pixman_image_t *surface; - PixmanData *pixman_data; - - data = (uint8_t *)spice_malloc_n(abs(stride), height); - if (stride < 0) { - stride_data = data + (-stride) * (height - 1); - } else { - stride_data = data; - } - - surface = pixman_image_create_bits(format, width, height, (uint32_t *)stride_data, stride); - - if (surface == NULL) { - free(data); - CANVAS_ERROR("create surface failed, out of memory"); - } - - pixman_data = pixman_image_add_data(surface); - pixman_data->data = data; - pixman_data->format = format; - - return surface; -} - -#ifdef WIN32 -pixman_image_t *surface_create(HDC dc, pixman_format_code_t format, - int width, int height, int top_down) -#else -pixman_image_t * surface_create(pixman_format_code_t format, int width, int height, int top_down) -#endif -{ -#ifdef WIN32 - /* - * Windows xp allow only 10,000 of gdi handlers, considering the fact that - * we limit here the number to 5000, we dont use atomic operations to sync - * this calculation against the other canvases (in case of multiple - * monitors), in worst case there will be little more than 5000 gdi - * handlers. - */ - if (dc && gdi_handlers < 5000) { - uint8_t *data; - uint8_t *src; - struct { - BITMAPINFO inf; - RGBQUAD palette[255]; - } bitmap_info; - int nstride; - pixman_image_t *surface; - PixmanData *pixman_data; - HBITMAP bitmap; - HANDLE mutex; - - memset(&bitmap_info, 0, sizeof(bitmap_info)); - bitmap_info.inf.bmiHeader.biSize = sizeof(bitmap_info.inf.bmiHeader); - bitmap_info.inf.bmiHeader.biWidth = width; - - bitmap_info.inf.bmiHeader.biHeight = (!top_down) ? height : -height; - - bitmap_info.inf.bmiHeader.biPlanes = 1; - switch (format) { - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: - bitmap_info.inf.bmiHeader.biBitCount = 32; - nstride = width * 4; - break; - case PIXMAN_x1r5g5b5: - case PIXMAN_r5g6b5: - bitmap_info.inf.bmiHeader.biBitCount = 16; - nstride = SPICE_ALIGN(width * 2, 4); - break; - case PIXMAN_a8: - bitmap_info.inf.bmiHeader.biBitCount = 8; - nstride = SPICE_ALIGN(width, 4); - break; - case PIXMAN_a1: - bitmap_info.inf.bmiHeader.biBitCount = 1; - nstride = SPICE_ALIGN(width, 32) / 8; - break; - default: - CANVAS_ERROR("invalid format"); - } - - bitmap_info.inf.bmiHeader.biCompression = BI_RGB; - - mutex = CreateMutex(NULL, 0, NULL); - if (!mutex) { - CANVAS_ERROR("Unable to CreateMutex"); - } - - bitmap = CreateDIBSection(dc, &bitmap_info.inf, 0, (VOID **)&data, NULL, 0); - if (!bitmap) { - CloseHandle(mutex); - CANVAS_ERROR("Unable to CreateDIBSection"); - } - - if (top_down) { - src = data; - } else { - src = data + nstride * (height - 1); - nstride = -nstride; - } - - surface = pixman_image_create_bits(format, width, height, (uint32_t *)src, nstride); - if (surface == NULL) { - CloseHandle(mutex); - DeleteObject(bitmap); - CANVAS_ERROR("create surface failed, out of memory"); - } - pixman_data = pixman_image_add_data(surface); - pixman_data->format = format; - pixman_data->bitmap = bitmap; - pixman_data->mutex = mutex; - gdi_handlers++; - return surface; - } else { -#endif - if (top_down) { - pixman_image_t *surface; - PixmanData *data; - - surface = pixman_image_create_bits(format, width, height, NULL, 0); - data = pixman_image_add_data(surface); - data->format = format; - return surface; - } else { - // NOTE: we assume here that the lz decoders always decode to RGB32. - int stride = 0; - switch (format) { - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: - stride = width * 4; - break; - case PIXMAN_x1r5g5b5: - case PIXMAN_r5g6b5: - stride = SPICE_ALIGN(width * 2, 4); - break; - case PIXMAN_a8: - stride = SPICE_ALIGN(width, 4); - break; - case PIXMAN_a1: - stride = SPICE_ALIGN(width, 32) / 8; - break; - default: - CANVAS_ERROR("invalid format"); - } - stride = -stride; - return __surface_create_stride(format, width, height, stride); - } -#ifdef WIN32 -} - -#endif -} - -#ifdef WIN32 -pixman_image_t *surface_create_stride(HDC dc, pixman_format_code_t format, int width, int height, - int stride) -#else -pixman_image_t *surface_create_stride(pixman_format_code_t format, int width, int height, - int stride) -#endif -{ -#ifdef WIN32 - if (dc) { - if (abs(stride) == (width * 4)) { - return surface_create(dc, format, width, height, (stride > 0)); - } - } -#endif - - return __surface_create_stride(format, width, height, stride); -} - -pixman_image_t *alloc_lz_image_surface(LzDecodeUsrData *canvas_data, - pixman_format_code_t pixman_format, int width, - int height, int gross_pixels, int top_down) -{ - int stride; - pixman_image_t *surface = NULL; - - stride = (gross_pixels / height) * (PIXMAN_FORMAT_BPP (pixman_format) / 8); - - if (!top_down) { - stride = -stride; - } - - surface = surface_create_stride( -#ifdef WIN32 - canvas_data->dc, -#endif - pixman_format, width, height, stride); - canvas_data->out_surface = surface; - return surface; -} - diff -Nru spice-gtk-0.9/common/canvas_utils.h spice-gtk-0.12/common/canvas_utils.h --- spice-gtk-0.9/common/canvas_utils.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/canvas_utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H_CANVAS_UTILS -#define _H_CANVAS_UTILS - -#ifdef WIN32 -#include -#endif - -#include - -#include "pixman_utils.h" -#include "lz.h" - -typedef struct PixmanData { -#ifdef WIN32 - HBITMAP bitmap; - HANDLE mutex; -#endif - uint8_t *data; - pixman_format_code_t format; -} PixmanData; - -void spice_pixman_image_set_format(pixman_image_t *image, - pixman_format_code_t format); -pixman_format_code_t spice_pixman_image_get_format(pixman_image_t *image); - - -#ifdef WIN32 -pixman_image_t *surface_create(HDC dc, pixman_format_code_t format, - int width, int height, int top_down); -#else -pixman_image_t *surface_create(pixman_format_code_t format, int width, int height, int top_down); -#endif - -#ifdef WIN32 -pixman_image_t *surface_create_stride(HDC dc, pixman_format_code_t format, int width, int height, - int stride); -#else -pixman_image_t *surface_create_stride(pixman_format_code_t format, int width, int height, - int stride); -#endif - - -typedef struct LzDecodeUsrData { -#ifdef WIN32 - HDC dc; -#endif - pixman_image_t *out_surface; -} LzDecodeUsrData; - - -pixman_image_t *alloc_lz_image_surface(LzDecodeUsrData *canvas_data, - pixman_format_code_t pixman_format, int width, - int height, int gross_pixels, int top_down); -#endif diff -Nru spice-gtk-0.9/common/demarshallers.h spice-gtk-0.12/common/demarshallers.h --- spice-gtk-0.9/common/demarshallers.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/demarshallers.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -/* - Copyright (C) 2010 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ -#ifndef _H_DEMARSHAL -#define _H_DEMARSHAL - -typedef void (*message_destructor_t)(uint8_t *message); -typedef uint8_t * (*spice_parse_channel_func_t)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, - size_t *size_out, message_destructor_t *free_message); - -spice_parse_channel_func_t spice_get_server_channel_parser(uint32_t channel, unsigned int *max_message_type); -spice_parse_channel_func_t spice_get_server_channel_parser1(uint32_t channel, unsigned int *max_message_type); - -#endif - diff -Nru spice-gtk-0.9/common/draw.h spice-gtk-0.12/common/draw.h --- spice-gtk-0.9/common/draw.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/draw.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,274 +0,0 @@ -/* - Copyright (C) 2009 Red Hat, Inc. - - 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 copyright holder 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 HOLDER 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 - HOLDER OR CONTRIBUTORS 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. -*/ - -#ifndef _H_SPICE_DRAW -#define _H_SPICE_DRAW - -#include -#include -#include "mem.h" - -#define SPICE_GET_ADDRESS(addr) ((void *)(unsigned long)(addr)) -#define SPICE_SET_ADDRESS(addr, val) ((addr) = (unsigned long)(val)) - -typedef int32_t SPICE_FIXED28_4; -typedef uint64_t SPICE_ADDRESS; - -typedef struct SpicePointFix { - SPICE_FIXED28_4 x; - SPICE_FIXED28_4 y; -} SpicePointFix; - -typedef struct SpicePoint { - int32_t x; - int32_t y; -} SpicePoint; - -typedef struct SpicePoint16 { - int16_t x; - int16_t y; -} SpicePoint16; - -typedef struct SpiceRect { - int32_t left; - int32_t top; - int32_t right; - int32_t bottom; -} SpiceRect; - -typedef struct SpicePathSeg { - uint32_t flags; - uint32_t count; - SpicePointFix points[0]; -} SpicePathSeg; - -typedef struct SpicePath { - uint32_t num_segments; - SpicePathSeg *segments[0]; -} SpicePath; - -typedef struct SpiceClipRects { - uint32_t num_rects; - SpiceRect rects[0]; -} SpiceClipRects; - -typedef struct SpiceClip { - uint32_t type; - SpiceClipRects *rects; -} SpiceClip; - -typedef struct SpicePalette { - uint64_t unique; - uint16_t num_ents; - uint32_t ents[0]; -} SpicePalette; - -#define SPICE_SURFACE_FMT_DEPTH(_d) ((_d) & 0x3f) - -typedef struct SpiceImageDescriptor { - uint64_t id; - uint8_t type; - uint8_t flags; - uint32_t width; - uint32_t height; -} SpiceImageDescriptor; - -typedef struct SpiceBitmap { - uint8_t format; - uint8_t flags; - uint32_t x; - uint32_t y; - uint32_t stride; - SpicePalette *palette; - uint64_t palette_id; - SpiceChunks *data; -} SpiceBitmap; - -typedef struct SpiceSurface { - uint32_t surface_id; -} SpiceSurface; - -typedef struct SpiceQUICData { - uint32_t data_size; - SpiceChunks *data; -} SpiceQUICData, SpiceLZRGBData, SpiceJPEGData; - -typedef struct SpiceLZPLTData { - uint8_t flags; - uint32_t data_size; - SpicePalette *palette; - uint64_t palette_id; - SpiceChunks *data; -} SpiceLZPLTData; - -typedef struct SpiceZlibGlzRGBData { - uint32_t glz_data_size; - uint32_t data_size; - SpiceChunks *data; -} SpiceZlibGlzRGBData; - -typedef struct SpiceJPEGAlphaData { - uint8_t flags; - uint32_t jpeg_size; - uint32_t data_size; - SpiceChunks *data; -} SpiceJPEGAlphaData; - - -typedef struct SpiceImage { - SpiceImageDescriptor descriptor; - union { - SpiceBitmap bitmap; - SpiceQUICData quic; - SpiceSurface surface; - SpiceLZRGBData lz_rgb; - SpiceLZPLTData lz_plt; - SpiceJPEGData jpeg; - SpiceZlibGlzRGBData zlib_glz; - SpiceJPEGAlphaData jpeg_alpha; - } u; -} SpiceImage; - -typedef struct SpicePattern { - SpiceImage *pat; - SpicePoint pos; -} SpicePattern; - -typedef struct SpiceBrush { - uint32_t type; - union { - uint32_t color; - SpicePattern pattern; - } u; -} SpiceBrush; - -typedef struct SpiceQMask { - uint8_t flags; - SpicePoint pos; - SpiceImage *bitmap; -} SpiceQMask; - -typedef struct SpiceFill { - SpiceBrush brush; - uint16_t rop_descriptor; - SpiceQMask mask; -} SpiceFill; - -typedef struct SpiceOpaque { - SpiceImage *src_bitmap; - SpiceRect src_area; - SpiceBrush brush; - uint16_t rop_descriptor; - uint8_t scale_mode; - SpiceQMask mask; -} SpiceOpaque; - -typedef struct SpiceCopy { - SpiceImage *src_bitmap; - SpiceRect src_area; - uint16_t rop_descriptor; - uint8_t scale_mode; - SpiceQMask mask; -} SpiceCopy, SpiceBlend; - -typedef struct SpiceTransparent { - SpiceImage *src_bitmap; - SpiceRect src_area; - uint32_t src_color; - uint32_t true_color; -} SpiceTransparent; - -typedef struct SpiceAlphaBlend { - uint16_t alpha_flags; - uint8_t alpha; - SpiceImage *src_bitmap; - SpiceRect src_area; -} SpiceAlphaBlend; - -typedef struct SpiceRop3 { - SpiceImage *src_bitmap; - SpiceRect src_area; - SpiceBrush brush; - uint8_t rop3; - uint8_t scale_mode; - SpiceQMask mask; -} SpiceRop3; - -typedef struct SpiceBlackness { - SpiceQMask mask; -} SpiceBlackness, SpiceInvers, SpiceWhiteness; - -typedef struct SpiceLineAttr { - uint8_t flags; - uint8_t style_nseg; - SPICE_FIXED28_4 *style; -} SpiceLineAttr; - -typedef struct SpiceStroke { - SpicePath *path; - SpiceLineAttr attr; - SpiceBrush brush; - uint16_t fore_mode; - uint16_t back_mode; -} SpiceStroke; - -typedef struct SpiceRasterGlyph { - SpicePoint render_pos; - SpicePoint glyph_origin; - uint16_t width; - uint16_t height; - uint8_t data[0]; -} SpiceRasterGlyph; - -typedef struct SpiceString { - uint16_t length; - uint16_t flags; - SpiceRasterGlyph *glyphs[0]; -} SpiceString; - -typedef struct SpiceText { - SpiceString *str; - SpiceRect back_area; - SpiceBrush fore_brush; - SpiceBrush back_brush; - uint16_t fore_mode; - uint16_t back_mode; -} SpiceText; - -typedef struct SpiceCursorHeader { - uint64_t unique; - uint16_t type; - uint16_t width; - uint16_t height; - uint16_t hot_spot_x; - uint16_t hot_spot_y; -} SpiceCursorHeader; - -#endif /* _H_SPICE_DRAW */ diff -Nru spice-gtk-0.9/common/gdi_canvas.c spice-gtk-0.12/common/gdi_canvas.c --- spice-gtk-0.9/common/gdi_canvas.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/gdi_canvas.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1870 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#include -#include -#include "gdi_canvas.h" -#define GDI_CANVAS -#include "canvas_base.c" -#include "rop3.h" -#include "rect.h" -#include "region.h" -#include "threads.h" - -typedef struct GdiCanvas GdiCanvas; - -struct GdiCanvas { - CanvasBase base; - HDC dc; - RecurciveMutex* lock; -}; - - -struct BitmapData { - HBITMAP hbitmap; - HBITMAP prev_hbitmap; - SpicePoint pos; - uint8_t flags; - HDC dc; - int cache; - int from_surface; -}; - -#define _rop3_brush 0xf0 -#define _rop3_src 0xcc -#define _rop3_dest 0xaa - -uint32_t raster_ops[] = { - 0x00000042, - 0x00010289, - 0x00020C89, - 0x000300AA, - 0x00040C88, - 0x000500A9, - 0x00060865, - 0x000702C5, - 0x00080F08, - 0x00090245, - 0x000A0329, - 0x000B0B2A, - 0x000C0324, - 0x000D0B25, - 0x000E08A5, - 0x000F0001, - 0x00100C85, - 0x001100A6, - 0x00120868, - 0x001302C8, - 0x00140869, - 0x001502C9, - 0x00165CCA, - 0x00171D54, - 0x00180D59, - 0x00191CC8, - 0x001A06C5, - 0x001B0768, - 0x001C06CA, - 0x001D0766, - 0x001E01A5, - 0x001F0385, - 0x00200F09, - 0x00210248, - 0x00220326, - 0x00230B24, - 0x00240D55, - 0x00251CC5, - 0x002606C8, - 0x00271868, - 0x00280369, - 0x002916CA, - 0x002A0CC9, - 0x002B1D58, - 0x002C0784, - 0x002D060A, - 0x002E064A, - 0x002F0E2A, - 0x0030032A, - 0x00310B28, - 0x00320688, - 0x00330008, - 0x003406C4, - 0x00351864, - 0x003601A8, - 0x00370388, - 0x0038078A, // PSDPoax - 0x00390604, // SPDnox - 0x003A0644, // SPDSxox - 0x003B0E24, // SPDnoan - 0x003C004A, // PSx - 0x003D18A4, // SPDSonox - 0x003E1B24, // SPDSnaox - 0x003F00EA, // PSan - 0x00400F0A, // PSDnaa - 0x00410249, // DPSxon - 0x00420D5D, // SDxPDxa - 0x00431CC4, // SPDSanaxn - 0x00440328, // SDna SRCERASE - 0x00450B29, // DPSnaon - 0x004606C6, // DSPDaox - 0x0047076A, // PSDPxaxn - 0x00480368, // SDPxa - 0x004916C5, // PDSPDaoxxn - 0x004A0789, // DPSDoax - 0x004B0605, // PDSnox - 0x004C0CC8, // SDPana - 0x004D1954, // SSPxDSxoxn - 0x004E0645, // PDSPxox - 0x004F0E25, // PDSnoan - 0x00500325, // PDna - 0x00510B26, // DSPnaon - 0x005206C9, // DPSDaox - 0x00530764, // SPDSxaxn - 0x005408A9, // DPSonon - 0x00550009, // Dn DSTINVERT - 0x005601A9, // DPSox - 0x00570389, // DPSoan - 0x00580785, // PDSPoax - 0x00590609, // DPSnox - 0x005A0049, // DPx PATINVERT - 0x005B18A9, // DPSDonox - 0x005C0649, // DPSDxox - 0x005D0E29, // DPSnoan - 0x005E1B29, // DPSDnaox - 0x005F00E9, // DPan - 0x00600365, // PDSxa - 0x006116C6, // DSPDSaoxxn - 0x00620786, // DSPDoax - 0x00630608, // SDPnox - 0x00640788, // SDPSoax - 0x00650606, // DSPnox - 0x00660046, // DSx SRCINVERT - 0x006718A8, // SDPSonox - 0x006858A6, // DSPDSonoxxn - 0x00690145, // PDSxxn - 0x006A01E9, // DPSax - 0x006B178A, // PSDPSoaxxn - 0x006C01E8, // SDPax - 0x006D1785, // PDSPDoaxxn - 0x006E1E28, // SDPSnoax - 0x006F0C65, // PDSxnan - 0x00700CC5, // PDSana - 0x00711D5C, // SSDxPDxaxn - 0x00720648, // SDPSxox - 0x00730E28, // SDPnoan - 0x00740646, // DSPDxox - 0x00750E26, // DSPnoan - 0x00761B28, // SDPSnaox - 0x007700E6, // DSan - 0x007801E5, // PDSax - 0x00791786, // DSPDSoaxxn - 0x007A1E29, // DPSDnoax - 0x007B0C68, // SDPxnan - 0x007C1E24, // SPDSnoax - 0x007D0C69, // DPSxnan - 0x007E0955, // SPxDSxo - 0x007F03C9, // DPSaan - 0x008003E9, // DPSaa - 0x00810975, // SPxDSxon - 0x00820C49, // DPSxna - 0x00831E04, // SPDSnoaxn - 0x00840C48, // SDPxna - 0x00851E05, // PDSPnoaxn - 0x008617A6, // DSPDSoaxx - 0x008701C5, // PDSaxn - 0x008800C6, // DSa SRCAND - 0x00891B08, // SDPSnaoxn - 0x008A0E06, // DSPnoa - 0x008B0666, // DSPDxoxn - 0x008C0E08, // SDPnoa - 0x008D0668, // SDPSxoxn - 0x008E1D7C, // SSDxPDxax - 0x008F0CE5, // PDSanan - 0x00900C45, // PDSxna - 0x00911E08, // SDPSnoaxn - 0x009217A9, // DPSDPoaxx - 0x009301C4, // SPDaxn - 0x009417AA, // PSDPSoaxx - 0x009501C9, // DPSaxn - 0x00960169, // DPSxx - 0x0097588A, // PSDPSonoxx - 0x00981888, // SDPSonoxn - 0x00990066, // DSxn - 0x009A0709, // DPSnax - 0x009B07A8, // SDPSoaxn - 0x009C0704, // SPDnax - 0x009D07A6, // DSPDoaxn - 0x009E16E6, // DSPDSaoxx - 0x009F0345, // PDSxan - 0x00A000C9, // DPa - 0x00A11B05, // PDSPnaoxn - 0x00A20E09, // DPSnoa - 0x00A30669, // DPSDxoxn - 0x00A41885, // PDSPonoxn - 0x00A50065, // PDxn - 0x00A60706, // DSPnax - 0x00A707A5, // PDSPoaxn - 0x00A803A9, // DPSoa - 0x00A90189, // DPSoxn - 0x00AA0029, // D - 0x00AB0889, // DPSono - 0x00AC0744, // SPDSxax - 0x00AD06E9, // DPSDaoxn - 0x00AE0B06, // DSPnao - 0x00AF0229, // DPno - 0x00B00E05, // PDSnoa - 0x00B10665, // PDSPxoxn - 0x00B21974, // SSPxDSxox - 0x00B30CE8, // SDPanan - 0x00B4070A, // PSDnax - 0x00B507A9, // DPSDoaxn - 0x00B616E9, // DPSDPaoxx - 0x00B70348, // SDPxan - 0x00B8074A, // PSDPxax - 0x00B906E6, // DSPDaoxn - 0x00BA0B09, // DPSnao - 0x00BB0226, // DSno MERGEPAINT - 0x00BC1CE4, // SPDSanax - 0x00BD0D7D, // SDxPDxan - 0x00BE0269, // DPSxo - 0x00BF08C9, // DPSano - 0x00C000CA, // PSa MERGECOPY - 0x00C11B04, // SPDSnaoxn - 0x00C21884, // SPDSonoxn - 0x00C3006A, // PSxn - 0x00C40E04, // SPDnoa - 0x00C50664, // SPDSxoxn - 0x00C60708, // SDPnax - 0x00C707AA, // PSDPoaxn - 0x00C803A8, // SDPoa - 0x00C90184, // SPDoxn - 0x00CA0749, // DPSDxax - 0x00CB06E4, // SPDSaoxn - 0x00CC0020, // S SRCCOPY - 0x00CD0888, // SDPono - 0x00CE0B08, // SDPnao - 0x00CF0224, // SPno - 0x00D00E0A, // PSDnoa - 0x00D1066A, // PSDPxoxn - 0x00D20705, // PDSnax - 0x00D307A4, // SPDSoaxn - 0x00D41D78, // SSPxPDxax - 0x00D50CE9, // DPSanan - 0x00D616EA, // PSDPSaoxx - 0x00D70349, // DPSxan - 0x00D80745, // PDSPxax - 0x00D906E8, // SDPSaoxn - 0x00DA1CE9, // DPSDanax - 0x00DB0D75, // SPxDSxan - 0x00DC0B04, // SPDnao - 0x00DD0228, // SDno - 0x00DE0268, // SDPxo - 0x00DF08C8, // SDPano - 0x00E003A5, // PDSoa - 0x00E10185, // PDSoxn - 0x00E20746, // DSPDxax - 0x00E306EA, // PSDPaoxn - 0x00E40748, // SDPSxax - 0x00E506E5, // PDSPaoxn - 0x00E61CE8, // SDPSanax - 0x00E70D79, // SPxPDxan - 0x00E81D74, // SSPxDSxax - 0x00E95CE6, // DSPDSanaxxn - 0x00EA02E9, // DPSao - 0x00EB0849, // DPSxno - 0x00EC02E8, // SDPao - 0x00ED0848, // SDPxno - 0x00EE0086, // DSo SRCPAINT - 0x00EF0A08, // SDPnoo - 0x00F00021, // P PATCOPY - 0x00F10885, // PDSono - 0x00F20B05, // PDSnao - 0x00F3022A, // PSno - 0x00F40B0A, // PSDnao - 0x00F50225, // PDno - 0x00F60265, // PDSxo - 0x00F708C5, // PDSano - 0x00F802E5, // PDSao - 0x00F90845, // PDSxno - 0x00FA0089, // DPo - 0x00FB0A09, // DPSnoo PATPAINT - 0x00FC008A, // PSo - 0x00FD0A0A, // PSDnoo - 0x00FE02A9, // DPSoo - 0x00FF0062 // 1 WHITENESS -}; - -static void set_path(GdiCanvas *canvas, SpicePath *s) -{ - unsigned int i; - - for (i = 0; i < s->num_segments; i++) { - SpicePathSeg* seg = s->segments[0]; - SpicePointFix* point = seg->points; - SpicePointFix* end_point = point + seg->count; - - if (seg->flags & SPICE_PATH_BEGIN) { - BeginPath(canvas->dc); - if (!MoveToEx(canvas->dc, (int)fix_to_double(point->x), (int)fix_to_double(point->y), - NULL)) { - spice_critical("MoveToEx failed"); - return; - } - point++; - } - - if (seg->flags & SPICE_PATH_BEZIER) { - spice_return_if_fail((point - end_point) % 3 == 0); - for (; point + 2 < end_point; point += 3) { - POINT points[3]; - - points[0].x = (int)fix_to_double(point[0].x); - points[0].y = (int)fix_to_double(point[0].y); - points[1].x = (int)fix_to_double(point[1].x); - points[1].y = (int)fix_to_double(point[1].y); - points[2].x = (int)fix_to_double(point[2].x); - points[2].y = (int)fix_to_double(point[2].y); - if (!PolyBezierTo(canvas->dc, points, 3)) { - spice_critical("PolyBezierTo failed"); - return; - } - } - } else { - for (; point < end_point; point++) { - if (!LineTo(canvas->dc, (int)fix_to_double(point->x), - (int)fix_to_double(point->y))) { - spice_critical("LineTo failed"); - } - } - } - - if (seg->flags & SPICE_PATH_END) { - - if (seg->flags & SPICE_PATH_CLOSE) { - if (!CloseFigure(canvas->dc)) { - spice_critical("CloseFigure failed"); - } - } - - if (!EndPath(canvas->dc)) { - spice_critical("EndPath failed"); - } - } - - } -} - -static void set_scale_mode(GdiCanvas *canvas, uint8_t scale_mode) -{ - if (scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE) { - SetStretchBltMode(canvas->dc, HALFTONE); - } else if (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) { - SetStretchBltMode(canvas->dc, COLORONCOLOR); - } else { - spice_critical("Unknown ScaleMode"); - } -} - -static void set_clip(GdiCanvas *canvas, SpiceClip *clip) -{ - switch (clip->type) { - case SPICE_CLIP_TYPE_NONE: - if (SelectClipRgn(canvas->dc, NULL) == ERROR) { - spice_critical("SelectClipRgn failed"); - } - break; - case SPICE_CLIP_TYPE_RECTS: { - uint32_t n = clip->rects->num_rects; - - SpiceRect *now = clip->rects->rects; - SpiceRect *end = now + n; - - if (now < end) { - HRGN main_hrgn; - - main_hrgn = CreateRectRgn(now->left, now->top, now->right, now->bottom); - if (!main_hrgn) { - return; - } - now++; - for (; now < end; now++) { - HRGN combaine_hrgn; - combaine_hrgn = CreateRectRgn(now->left, now->top, now->right, - now->bottom); - if (!combaine_hrgn) { - spice_critical("Unable to CreateRectRgn"); - DeleteObject(main_hrgn); - return; - } - if (CombineRgn(main_hrgn, main_hrgn, combaine_hrgn, RGN_OR) == ERROR) { - spice_critical("Unable to CombineRgn"); - DeleteObject(combaine_hrgn); - return; - } - DeleteObject(combaine_hrgn); - } - if (SelectClipRgn(canvas->dc, main_hrgn) == ERROR) { - spice_critical("Unable to SelectClipRgn"); - } - DeleteObject(main_hrgn); - } - break; - } - default: - spice_warn_if_reached(); - return; - } -} - -static void copy_bitmap(const uint8_t *src_image, int height, int src_stride, - uint8_t *dest_bitmap, int dest_stride) -{ - int copy_width = MIN(dest_stride, src_stride); - int y = 0; - - spice_return_if_fail(dest_stride >= 0 && src_stride >= 0); - - while (y < height) { - memcpy(dest_bitmap, src_image, copy_width); - src_image += src_stride; - dest_bitmap += dest_stride; - y++; - } -} - -static void copy_bitmap_alpha(const uint8_t *src_alpha, int height, int width, int src_stride, - uint8_t *dest_bitmap, int dest_stride, int alpha_bits_size) -{ - int y = 0; - uint8_t i_offset; - int i_count = 0; - int i = 0; - int width_div_stride; - - width_div_stride = width / src_stride; - - if (alpha_bits_size == 1) { - i_offset = 1; - } else { - i_offset = 8; - } - - - while (y < height) { - int x; - - for (x = 0; x < width; ++x) { - uint8_t alphaval; - double alpha; - - alphaval = src_alpha[i]; - alphaval = alphaval >> (i_count * i_offset); - alphaval &= ((uint8_t)0xff >> (8 - i_offset)); - alphaval = ((255 * alphaval) / ((uint8_t)0xff >> (8 - i_offset))); - - dest_bitmap[x * 4 + 3] = alphaval; - alpha = (double)alphaval / 0xff; - dest_bitmap[x * 4 + 2] = (uint8_t)(alpha * dest_bitmap[x * 4 + 2]); - dest_bitmap[x * 4 + 1] = (uint8_t)(alpha * dest_bitmap[x * 4 + 1]); - dest_bitmap[x * 4] = (uint8_t)(alpha * dest_bitmap[x * 4]); - - i_count++; - if (i_count == (8 / i_offset)) { - i++; - i_count = 0; - } - } - - dest_bitmap += width * 4; - i = 0; - src_alpha += src_stride; - i_count = 0; - y++; - } -} - -static uint8_t *create_bitmap(HBITMAP *bitmap, HBITMAP *prev_bitmap, HDC *dc, - const uint8_t *bitmap_data, int width, int height, - int stride, int bits, int rotate) -{ - uint8_t *data; - const uint8_t *src_data; - uint32_t nstride; - struct { - BITMAPINFO inf; - RGBQUAD palette[255]; - } bitmap_info; - - memset(&bitmap_info, 0, sizeof(bitmap_info)); - bitmap_info.inf.bmiHeader.biSize = sizeof(bitmap_info.inf.bmiHeader); - bitmap_info.inf.bmiHeader.biWidth = width; - if (stride < 0) { - bitmap_info.inf.bmiHeader.biHeight = height; - } else { - bitmap_info.inf.bmiHeader.biHeight = -height; - } - - if (rotate) { - bitmap_info.inf.bmiHeader.biHeight = -bitmap_info.inf.bmiHeader.biHeight; - } - - bitmap_info.inf.bmiHeader.biPlanes = 1; - bitmap_info.inf.bmiHeader.biBitCount = bits; - bitmap_info.inf.bmiHeader.biCompression = BI_RGB; - - *dc = create_compatible_dc(); - if (!*dc) { - spice_critical("create_compatible_dc() failed"); - return NULL; - } - - *bitmap = CreateDIBSection(*dc, &bitmap_info.inf, 0, (VOID **)&data, NULL, 0); - if (!*bitmap) { - spice_critical("Unable to CreateDIBSection"); - DeleteDC(*dc); - return NULL; - } - *prev_bitmap = (HBITMAP)SelectObject(*dc, *bitmap); - - if (stride < 0) { - src_data = bitmap_data - (height - 1) * -stride; - } else { - src_data = bitmap_data; - } - - switch (bits) { - case 1: - nstride = SPICE_ALIGN(width, 32) / 8; - break; - case 8: - nstride = SPICE_ALIGN(width, 4); - break; - case 16: - nstride = SPICE_ALIGN(width * 2, 4); - break; - case 32: - nstride = width * 4; - break; - default: - spice_warn_if_reached(); - return; - } - - if (bitmap_data) { - if (stride < 0) { - copy_bitmap(src_data, height, -stride, data, nstride); - } else { - copy_bitmap(src_data, height, stride, data, nstride); - } - } - - return data; -} - -static uint8_t *create_bitmap_from_pixman(HBITMAP *bitmap, HBITMAP *prev_bitmap, HDC *dc, - pixman_image_t *surface, int rotate) -{ - return create_bitmap(bitmap, prev_bitmap, dc, - (uint8_t*)pixman_image_get_data(surface), - pixman_image_get_width(surface), - pixman_image_get_height(surface), - pixman_image_get_stride(surface), - spice_pixman_image_get_bpp(surface), - rotate); -} - - -static void release_bitmap(HDC dc, HBITMAP bitmap, HBITMAP prev_bitmap, int cache) -{ - bitmap = (HBITMAP)SelectObject(dc, prev_bitmap); - if (!cache) { - DeleteObject(bitmap); - } - DeleteDC(dc); -} - -static inline uint8_t get_converted_color(uint8_t color) -{ - uint8_t msb; - - msb = color & 0xE0; - msb = msb >> 5; - color |= msb; - return color; -} - -static inline COLORREF get_color_ref(GdiCanvas *canvas, uint32_t color) -{ - int shift = canvas->base.color_shift == 8 ? 0 : 3; - uint8_t r, g, b; - - b = (color & canvas->base.color_mask); - color >>= canvas->base.color_shift; - g = (color & canvas->base.color_mask); - color >>= canvas->base.color_shift; - r = (color & canvas->base.color_mask); - if (shift) { - r = get_converted_color(r << shift); - g = get_converted_color(g << shift); - b = get_converted_color(b << shift); - } - return RGB(r, g, b); -} - -static HBRUSH get_brush(GdiCanvas *canvas, SpiceBrush *brush, RecurciveMutex **brush_lock) -{ - HBRUSH hbrush; - - *brush_lock = NULL; - - switch (brush->type) { - case SPICE_BRUSH_TYPE_SOLID: - if (!(hbrush = CreateSolidBrush(get_color_ref(canvas, brush->u.color)))) { - spice_critical("CreateSolidBrush failed"); - return NULL; - } - return hbrush; - case SPICE_BRUSH_TYPE_PATTERN: { - GdiCanvas *gdi_surface = NULL; - HBRUSH hbrush; - pixman_image_t *surface = NULL; - HDC dc; - HBITMAP bitmap; - HBITMAP prev_bitmap; - - gdi_surface = (GdiCanvas *)canvas_get_surface(&canvas->base, brush->u.pattern.pat); - if (gdi_surface) { - bitmap = (HBITMAP)GetCurrentObject(gdi_surface->dc, OBJ_BITMAP); - if (!bitmap) { - spice_critical("GetCurrentObject failed"); - return NULL; - } - *brush_lock = gdi_surface->lock; - } else { - surface = canvas_get_image(&canvas->base, brush->u.pattern.pat, FALSE); - if (!create_bitmap_from_pixman(&bitmap, &prev_bitmap, &dc, surface, 0)) { - spice_critical("create_bitmap failed"); - return NULL; - } - } - - if (!(hbrush = CreatePatternBrush(bitmap))) { - spice_critical("CreatePatternBrush failed"); - return NULL; - } - - if (!gdi_surface) { - release_bitmap(dc, bitmap, prev_bitmap, 0); - pixman_image_unref(surface); - } - return hbrush; - } - case SPICE_BRUSH_TYPE_NONE: - return NULL; - default: - spice_warn_if_reached(); - return NULL; - } -} - -static HBRUSH set_brush(HDC dc, HBRUSH hbrush, SpiceBrush *brush) -{ - switch (brush->type) { - case SPICE_BRUSH_TYPE_SOLID: { - return (HBRUSH)SelectObject(dc, hbrush); - } - case SPICE_BRUSH_TYPE_PATTERN: { - HBRUSH prev_hbrush; - prev_hbrush = (HBRUSH)SelectObject(dc, hbrush); - if (!SetBrushOrgEx(dc, brush->u.pattern.pos.x, brush->u.pattern.pos.y, NULL)) { - spice_critical("SetBrushOrgEx failed"); - return NULL; - } - return prev_hbrush; - } - default: - spice_warn_if_reached(); - return NULL; - } -} - -static void unset_brush(HDC dc, HBRUSH prev_hbrush) -{ - if (!prev_hbrush) { - return; - } - prev_hbrush = (HBRUSH)SelectObject(dc, prev_hbrush); - DeleteObject(prev_hbrush); -} - -uint8_t calc_rop3(uint16_t rop3_bits, int brush) -{ - uint8_t rop3 = 0; - uint8_t rop3_src = _rop3_src; - uint8_t rop3_dest = _rop3_dest; - uint8_t rop3_brush = _rop3_brush; - uint8_t rop3_src_brush; - - if (rop3_bits & SPICE_ROPD_INVERS_SRC) { - rop3_src = ~rop3_src; - } - if (rop3_bits & SPICE_ROPD_INVERS_BRUSH) { - rop3_brush = ~rop3_brush; - } - if (rop3_bits & SPICE_ROPD_INVERS_DEST) { - rop3_dest = ~rop3_dest; - } - - if (brush) { - rop3_src_brush = rop3_brush; - } else { - rop3_src_brush = rop3_src; - } - - if (rop3_bits & SPICE_ROPD_OP_PUT) { - rop3 = rop3_src_brush; - } - if (rop3_bits & SPICE_ROPD_OP_OR) { - rop3 = rop3_src_brush | rop3_dest; - } - if (rop3_bits & SPICE_ROPD_OP_AND) { - rop3 = rop3_src_brush & rop3_dest; - } - if (rop3_bits & SPICE_ROPD_OP_XOR) { - rop3 = rop3_src_brush ^ rop3_dest; - } - if (rop3_bits & SPICE_ROPD_INVERS_RES) { - rop3 = ~rop3_dest; - } - - if (rop3_bits & SPICE_ROPD_OP_BLACKNESS || rop3_bits & SPICE_ROPD_OP_WHITENESS || - rop3_bits & SPICE_ROPD_OP_INVERS) { - spice_warn_if_reached("invalid rop3 type"); - return 0; - } - return rop3; -} - -uint8_t calc_rop3_src_brush(uint16_t rop3_bits) -{ - uint8_t rop3 = 0; - uint8_t rop3_src = _rop3_src; - uint8_t rop3_brush = _rop3_brush; - - if (rop3_bits & SPICE_ROPD_INVERS_SRC) { - rop3_src = ~rop3_src; - } - if (rop3_bits & SPICE_ROPD_INVERS_BRUSH) { - rop3_brush = ~rop3_brush; - } - - if (rop3_bits & SPICE_ROPD_OP_OR) { - rop3 = rop3_src | rop3_brush; - } - if (rop3_bits & SPICE_ROPD_OP_AND) { - rop3 = rop3_src & rop3_brush; - } - if (rop3_bits & SPICE_ROPD_OP_XOR) { - rop3 = rop3_src ^ rop3_brush; - } - - return rop3; -} - -static struct BitmapData get_mask_bitmap(struct GdiCanvas *canvas, struct SpiceQMask *mask) -{ - GdiCanvas *gdi_surface; - pixman_image_t *surface; - struct BitmapData bitmap; - PixmanData *pixman_data; - - bitmap.hbitmap = NULL; - if (!mask->bitmap) { - return bitmap; - } - - gdi_surface = (GdiCanvas *)canvas_get_surface_mask(&canvas->base, mask->bitmap); - if (gdi_surface) { - HBITMAP _bitmap; - - _bitmap = (HBITMAP)GetCurrentObject(gdi_surface->dc, OBJ_BITMAP); - if (!_bitmap) { - spice_critical("GetCurrentObject failed"); - return bitmap; - } - bitmap.dc = gdi_surface->dc; - bitmap.hbitmap = _bitmap; - bitmap.prev_hbitmap = (HBITMAP)0; - bitmap.cache = 0; - bitmap.from_surface = 1; - } else { - - if (!(surface = canvas_get_mask(&canvas->base, mask, NULL))) { - return bitmap; - } - - pixman_data = (PixmanData *)pixman_image_get_destroy_data (surface); - if (pixman_data && (WaitForSingleObject(pixman_data->mutex, INFINITE) != WAIT_FAILED)) { - bitmap.dc = create_compatible_dc(); - bitmap.prev_hbitmap = (HBITMAP)SelectObject(bitmap.dc, pixman_data->bitmap); - bitmap.hbitmap = pixman_data->bitmap; - ReleaseMutex(pixman_data->mutex); - bitmap.cache = 1; - } else if (!create_bitmap_from_pixman(&bitmap.hbitmap, &bitmap.prev_hbitmap, &bitmap.dc, - surface, 0)) { - bitmap.hbitmap = NULL; - } else { - bitmap.cache = 0; - } - - bitmap.from_surface = 0; - } - - bitmap.flags = mask->flags; - bitmap.pos = mask->pos; - - return bitmap; -} - -static void gdi_draw_bitmap(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest, - HDC src_dc, struct BitmapData *bitmapmask, uint32_t rop3_val) -{ - uint32_t rast_oper; - - rast_oper = raster_ops[rop3_val]; - - if (!bitmapmask || !bitmapmask->hbitmap) { - if ((dest->right - dest->left) == (src->right - src->left) && - (dest->bottom - dest->top) == (src->bottom - src->top)) { - if (!BitBlt(dest_dc, dest->left, dest->top, dest->right - dest->left, - dest->bottom - dest->top, src_dc, src->left, src->top, rast_oper)) { - spice_critical("BitBlt failed"); - return; - } - } else { - if (!StretchBlt(dest_dc, dest->left, dest->top, dest->right - dest->left, - dest->bottom - dest->top, src_dc, src->left, src->top, - src->right - src->left, src->bottom - src->top, rast_oper)) { - spice_critical("StretchBlt failed"); - return; - } - } - } else { - rast_oper = MAKEROP4(rast_oper, raster_ops[_rop3_dest]); - - if (!MaskBlt(dest_dc, dest->left, dest->top, dest->right - dest->left, - dest->bottom - dest->top, src_dc, src->left, src->top, - bitmapmask->hbitmap, bitmapmask->pos.x, bitmapmask->pos.y, - rast_oper)) { - spice_critical("MaskBlt failed"); - return; - } - } -} - -static void gdi_draw_bitmap_redrop(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest, - HDC src_dc, struct BitmapData *bitmapmask, - uint16_t rop, int brush) -{ - uint32_t rop3_val; - - rop3_val = calc_rop3(rop, brush); - gdi_draw_bitmap(dest_dc, src, dest, src_dc, bitmapmask, rop3_val); -} - -static void free_mask(struct BitmapData *bitmap) -{ - if (bitmap->hbitmap) { - if (!bitmap->from_surface) { - release_bitmap(bitmap->dc, bitmap->hbitmap, bitmap->prev_hbitmap, bitmap->cache); - } - } -} - -static void draw_str_mask_bitmap(struct GdiCanvas *canvas, - SpiceString *str, int n, SpiceRect *dest, - SpiceRect *src, SpiceBrush *brush) -{ - pixman_image_t *surface; - struct BitmapData bitmap; - SpicePoint pos; - int dest_stride; - uint8_t *bitmap_data; - HBRUSH prev_hbrush; - HBRUSH hbrush; - RecurciveMutex *brush_lock; - - bitmap.hbitmap = (HBITMAP)1; - if (!(surface = canvas_get_str_mask(&canvas->base, str, n, &pos))) { - spice_critical("unable to canvas_get_str_mask"); - return; - } - - bitmap.from_surface = 0; - bitmap.cache = 0; - bitmap_data = create_bitmap(&bitmap.hbitmap, &bitmap.prev_hbitmap, - &bitmap.dc, NULL, - pixman_image_get_width(surface), - pixman_image_get_height(surface), - pixman_image_get_stride(surface), 32, 0); - - if (!bitmap_data) { - return; - } - - bitmap.flags = 0; - bitmap.pos.x = 0; - bitmap.pos.y = 0; - - dest->left = pos.x; - dest->top = pos.y; - dest->right = pos.x + pixman_image_get_width(surface); - dest->bottom = pos.y + pixman_image_get_height(surface); - src->left = 0; - src->top = 0; - src->right = pixman_image_get_width(surface); - src->bottom = pixman_image_get_height(surface); - - dest_stride = pixman_image_get_width(surface); - switch (n) { - case 1: - dest_stride = dest_stride / 8; - break; - case 4: - dest_stride = dest_stride / 2; - break; - case 32: - dest_stride = dest_stride * 4; - break; - default: - spice_warn_if_reached(); - return; - } - dest_stride = dest_stride + 3; - dest_stride = dest_stride & ~3; - - hbrush = get_brush(canvas, brush, &brush_lock); - prev_hbrush = set_brush(bitmap.dc, hbrush, brush); - if (brush_lock) { - RecurciveLock b_lock(*brush_lock); - gdi_draw_bitmap(bitmap.dc, src, src, bitmap.dc, NULL, _rop3_brush); - } else { - gdi_draw_bitmap(bitmap.dc, src, src, bitmap.dc, NULL, _rop3_brush); - } - - unset_brush(bitmap.dc, prev_hbrush); - - copy_bitmap_alpha((uint8_t *)pixman_image_get_data(surface), - pixman_image_get_height(surface), - pixman_image_get_width(surface), - pixman_image_get_stride(surface), - bitmap_data, dest_stride, n); - - BLENDFUNCTION bf = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA}; - - RecurciveLock lock(*canvas->lock); - AlphaBlend(canvas->dc, dest->left, dest->top, dest->right - dest->left, - dest->bottom - dest->top, bitmap.dc, src->left, src->top, - src->right - src->left, src->bottom - src->top, bf); - - free_mask(&bitmap); -} - -static void gdi_draw_image(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest, - pixman_image_t *image, struct BitmapData *bitmapmask, uint16_t rop, - int rotate) -{ - HDC dc; - HBITMAP bitmap; - HBITMAP prev_bitmap; - - create_bitmap_from_pixman(&bitmap, &prev_bitmap, &dc, image, rotate); - - gdi_draw_bitmap_redrop(dest_dc, src, dest, dc, bitmapmask, rop, 0); - - release_bitmap(dc, bitmap, prev_bitmap, 0); -} - -static void gdi_draw_image_rop3(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest, - pixman_image_t *image, struct BitmapData *bitmapmask, uint8_t rop3, - int rotate) -{ - HDC dc; - HBITMAP bitmap; - HBITMAP prev_bitmap; - - create_bitmap_from_pixman(&bitmap, &prev_bitmap, &dc, image, rotate); - - gdi_draw_bitmap(dest_dc, src, dest, dc, bitmapmask, rop3); - - release_bitmap(dc, bitmap, prev_bitmap, 0); -} - -static void gdi_canvas_draw_fill(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill) -{ - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - HBRUSH prev_hbrush; - HBRUSH brush; - struct BitmapData bitmapmask; - RecurciveMutex *brush_lock; - - RecurciveLock lock(*canvas->lock); - - brush = get_brush(canvas, &fill->brush, &brush_lock); - spice_return_if_fail(brush != NULL); - - bitmapmask = get_mask_bitmap(canvas, &fill->mask); - - set_clip(canvas, clip); - prev_hbrush = set_brush(canvas->dc, brush, &fill->brush); - if (brush_lock) { - RecurciveLock b_lock(*brush_lock); - gdi_draw_bitmap_redrop(canvas->dc, bbox, bbox, canvas->dc, &bitmapmask, - fill->rop_descriptor, fill->brush.type != SPICE_BRUSH_TYPE_NONE); - } else { - gdi_draw_bitmap_redrop(canvas->dc, bbox, bbox, canvas->dc, &bitmapmask, - fill->rop_descriptor, fill->brush.type != SPICE_BRUSH_TYPE_NONE); - } - - free_mask(&bitmapmask); - unset_brush(canvas->dc, prev_hbrush); -} - -static void gdi_canvas_draw_copy(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy) -{ - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - GdiCanvas *gdi_surface; - pixman_image_t *surface; - struct BitmapData bitmapmask; - PixmanData *pixman_data; - - gdi_surface = (GdiCanvas *)canvas_get_surface(&canvas->base, copy->src_bitmap); - if (gdi_surface) { - RecurciveLock lock(*canvas->lock); - RecurciveLock s_lock(*gdi_surface->lock); - bitmapmask = get_mask_bitmap(canvas, ©->mask); - set_scale_mode(canvas, copy->scale_mode); - set_clip(canvas, clip); - gdi_draw_bitmap_redrop(canvas->dc, ©->src_area, bbox, gdi_surface->dc, - &bitmapmask, copy->rop_descriptor, 0); - } else { - surface = canvas_get_image(&canvas->base, copy->src_bitmap, FALSE); - pixman_data = (PixmanData *)pixman_image_get_destroy_data(surface); - - RecurciveLock lock(*canvas->lock); - bitmapmask = get_mask_bitmap(canvas, ©->mask); - set_scale_mode(canvas, copy->scale_mode); - set_clip(canvas, clip); - - if (pixman_data && (WaitForSingleObject(pixman_data->mutex, INFINITE) != WAIT_FAILED)) { - HDC dc; - HBITMAP prev_bitmap; - - dc = create_compatible_dc(); - prev_bitmap = (HBITMAP)SelectObject(dc, pixman_data->bitmap); - gdi_draw_bitmap_redrop(canvas->dc, ©->src_area, bbox, dc, - &bitmapmask, copy->rop_descriptor, 0); - SelectObject(dc, prev_bitmap); - DeleteObject(dc); - ReleaseMutex(pixman_data->mutex); - } else { - gdi_draw_image(canvas->dc, ©->src_area, bbox, surface, &bitmapmask, - copy->rop_descriptor, 0); - } - - pixman_image_unref(surface); - - } - free_mask(&bitmapmask); -} - -static void gdi_canvas_put_image(SpiceCanvas *spice_canvas, HDC dc, const SpiceRect *dest, const uint8_t *src_data, - uint32_t src_width, uint32_t src_height, int src_stride, - const QRegion *clip) -{ - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - SpiceRect src; - src.top = 0; - src.bottom = src_height; - src.left = 0; - src.right = src_width; - int num_rects; - pixman_box32_t *rects; - - RecurciveLock lock(*canvas->lock); - set_scale_mode(canvas, SPICE_IMAGE_SCALE_MODE_NEAREST); - if (clip) { - rects = pixman_region32_rectangles((pixman_region32_t*)clip, &num_rects); - if (num_rects == 0) { - return; - } else { - HRGN main_hrgn; - int i; - - main_hrgn = CreateRectRgn(rects[0].x1, rects[0].y1, rects[0].x2, - rects[0].y2); - if (!main_hrgn) { - return; - } - - for (i = 1; i < num_rects; i++) { - HRGN combaine_hrgn; - - combaine_hrgn = CreateRectRgn(rects[i].x1, rects[i].y1, - rects[i].x2, - rects[i].y2); - if (!combaine_hrgn) { - spice_critical("CreateRectRgn failed"); - DeleteObject(main_hrgn); - return; - } - if (!CombineRgn(main_hrgn, main_hrgn, combaine_hrgn, RGN_OR)) { - spice_critical("CombineRgn failed in put_image"); - return; - } - DeleteObject(combaine_hrgn); - } - if (SelectClipRgn(canvas->dc, main_hrgn) == ERROR) { - spice_critical("SelectClipRgn failed in put_image"); - DeleteObject(main_hrgn); - return; - } - DeleteObject(main_hrgn); - } - } else { - SelectClipRgn(canvas->dc, NULL); - } - - if (dc) { - gdi_draw_bitmap_redrop(canvas->dc, &src, dest, dc, - NULL, SPICE_ROPD_OP_PUT, 0); - } else { - pixman_image_t *image = pixman_image_create_bits(PIXMAN_a8r8g8b8, src_width, src_height, - (uint32_t *)src_data, src_stride); - gdi_draw_image(canvas->dc, &src, dest, image, NULL, SPICE_ROPD_OP_PUT, 0); - pixman_image_unref(image); - } -} - -static void gdi_draw_bitmap_transparent(GdiCanvas *canvas, HDC dest_dc, const SpiceRect *src, - const SpiceRect *dest, HDC src_dc, uint32_t color) -{ - TransparentBlt(dest_dc, dest->left, dest->top, dest->right - dest->left, - dest->bottom - dest->top, src_dc, src->left, src->top, - src->right - src->left, src->bottom - src->top, - RGB(((uint8_t*)&color)[2], ((uint8_t*)&color)[1], ((uint8_t*)&color)[0])); -} - -static void gdi_draw_image_transparent(GdiCanvas *canvas, HDC dest_dc, const SpiceRect *src, - const SpiceRect *dest, pixman_image_t *image, - uint32_t color, int rotate) -{ - HDC dc; - HBITMAP bitmap; - HBITMAP prev_bitmap; - - create_bitmap_from_pixman(&bitmap, &prev_bitmap, &dc, image, rotate); - - gdi_draw_bitmap_transparent(canvas, dest_dc, src, dest, dc, color); - - release_bitmap(dc, bitmap, prev_bitmap, 0); -} - -static void gdi_canvas_draw_transparent(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, - SpiceTransparent* transparent) -{ - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - GdiCanvas *gdi_surface; - pixman_image_t *surface; - PixmanData *pixman_data; - - gdi_surface = (GdiCanvas *)canvas_get_surface(&canvas->base, transparent->src_bitmap); - if (gdi_surface) { - RecurciveLock lock(*canvas->lock); - RecurciveLock s_lock(*gdi_surface->lock); - set_clip(canvas, clip); - gdi_draw_bitmap_transparent(canvas, canvas->dc, &transparent->src_area, bbox, - gdi_surface->dc, transparent->true_color); - } else { - surface = canvas_get_image(&canvas->base, transparent->src_bitmap, FALSE); - pixman_data = (PixmanData *)pixman_image_get_destroy_data(surface); - RecurciveLock lock(*canvas->lock); - set_clip(canvas, clip); - if (pixman_data && (WaitForSingleObject(pixman_data->mutex, INFINITE) != WAIT_FAILED)) { - HDC dc; - HBITMAP prev_bitmap; - - dc = create_compatible_dc(); - prev_bitmap = (HBITMAP)SelectObject(dc, pixman_data->bitmap); - gdi_draw_bitmap_transparent(canvas, canvas->dc, &transparent->src_area, bbox, dc, - transparent->true_color); - - SelectObject(dc, prev_bitmap); - DeleteObject(dc); - ReleaseMutex(pixman_data->mutex); - } else { - gdi_draw_image_transparent(canvas, canvas->dc, &transparent->src_area, bbox, surface, - transparent->true_color, 0); - } - - pixman_image_unref(surface); - } -} - -static void gdi_draw_bitmap_alpha(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest, - HDC src_dc, uint8_t alpha, int use_bitmap_alpha) -{ - BLENDFUNCTION bf; - - bf.BlendOp = AC_SRC_OVER; - bf.BlendFlags = 0; - bf.SourceConstantAlpha = alpha; - - if (use_bitmap_alpha) { - bf.AlphaFormat = AC_SRC_ALPHA; - } else { - bf.AlphaFormat = 0; - } - - if (!AlphaBlend(dest_dc, dest->left, dest->top, dest->right - dest->left, - dest->bottom - dest->top, src_dc, src->left, src->top, - src->right - src->left, src->bottom - src->top, bf)) { - spice_critical("AlphaBlend failed"); - return; - } -} - -static void gdi_draw_image_alpha(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest, - pixman_image_t *image, uint8_t alpha, - int rotate, int use_bitmap_alpha) -{ - HDC dc; - HBITMAP bitmap; - HBITMAP prev_bitmap; - - create_bitmap_from_pixman(&bitmap, &prev_bitmap, &dc, image, rotate); - - gdi_draw_bitmap_alpha(dest_dc, src, dest, dc, alpha, use_bitmap_alpha); - - release_bitmap(dc, bitmap, prev_bitmap, 0); -} - -static void gdi_canvas_draw_alpha_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlend* alpha_blend) -{ - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - GdiCanvas *gdi_surface; - pixman_image_t *surface; - PixmanData *pixman_data; - int use_bitmap_alpha; - - gdi_surface = (GdiCanvas *)canvas_get_surface(&canvas->base, alpha_blend->src_bitmap); - if (gdi_surface) { - RecurciveLock lock(*canvas->lock); - RecurciveLock s_lock(*gdi_surface->lock); - set_clip(canvas, clip); - use_bitmap_alpha = alpha_blend->alpha_flags & SPICE_ALPHA_FLAGS_SRC_SURFACE_HAS_ALPHA; - gdi_draw_bitmap_alpha(canvas->dc, &alpha_blend->src_area, bbox, gdi_surface->dc, - alpha_blend->alpha, use_bitmap_alpha); - } else { - surface = canvas_get_image(&canvas->base, alpha_blend->src_bitmap, TRUE); - use_bitmap_alpha = pixman_image_get_depth(surface) == 32; - pixman_data = (PixmanData *)pixman_image_get_destroy_data(surface); - - RecurciveLock lock(*canvas->lock); - set_clip(canvas, clip); - if (pixman_data && (WaitForSingleObject(pixman_data->mutex, INFINITE) != WAIT_FAILED)) { - HDC dc; - HBITMAP prev_bitmap; - - dc = create_compatible_dc(); - prev_bitmap = (HBITMAP)SelectObject(dc, pixman_data->bitmap); - gdi_draw_bitmap_alpha(canvas->dc, &alpha_blend->src_area, bbox, dc, alpha_blend->alpha, - use_bitmap_alpha); - SelectObject(dc, prev_bitmap); - DeleteObject(dc); - ReleaseMutex(pixman_data->mutex); - } else { - gdi_draw_image_alpha(canvas->dc, &alpha_blend->src_area, bbox, surface, - alpha_blend->alpha, 0, use_bitmap_alpha); - } - - pixman_image_unref(surface); - } -} - -static void gdi_canvas_draw_opaque(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque) -{ - GdiCanvas *gdi_surface; - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - pixman_image_t *surface; - struct BitmapData bitmapmask; - PixmanData *pixman_data; - HBRUSH prev_hbrush; - HBRUSH hbrush; - uint8_t rop3; - RecurciveMutex *brush_lock; - - rop3 = calc_rop3_src_brush(opaque->rop_descriptor); - - gdi_surface = (GdiCanvas *)canvas_get_surface(&canvas->base, opaque->src_bitmap); - if (gdi_surface) { - RecurciveLock lock(*canvas->lock); - RecurciveLock s_lock(*gdi_surface->lock); - bitmapmask = get_mask_bitmap(canvas, &opaque->mask); - hbrush = get_brush(canvas, &opaque->brush, &brush_lock); - set_scale_mode(canvas, opaque->scale_mode); - set_clip(canvas, clip); - prev_hbrush = set_brush(canvas->dc, hbrush, &opaque->brush); - if (brush_lock) { - RecurciveLock b_lock(*brush_lock); - gdi_draw_bitmap(canvas->dc, &opaque->src_area, bbox, gdi_surface->dc, &bitmapmask, rop3); - } else { - gdi_draw_bitmap(canvas->dc, &opaque->src_area, bbox, gdi_surface->dc, &bitmapmask, rop3); - } - unset_brush(canvas->dc, prev_hbrush); - } else { - surface = canvas_get_image(&canvas->base, opaque->src_bitmap, FALSE); - pixman_data = (PixmanData *)pixman_image_get_destroy_data(surface); - - RecurciveLock lock(*canvas->lock); - bitmapmask = get_mask_bitmap(canvas, &opaque->mask); - hbrush = get_brush(canvas, &opaque->brush, &brush_lock); - set_scale_mode(canvas, opaque->scale_mode); - set_clip(canvas, clip); - prev_hbrush = set_brush(canvas->dc, hbrush, &opaque->brush); - - if (pixman_data && (WaitForSingleObject(pixman_data->mutex, INFINITE) != WAIT_FAILED)) { - HDC dc; - HBITMAP prev_bitmap; - - dc = create_compatible_dc(); - prev_bitmap = (HBITMAP)SelectObject(dc, pixman_data->bitmap); - if (brush_lock) { - RecurciveLock b_lock(*brush_lock); - gdi_draw_bitmap(canvas->dc, &opaque->src_area, bbox, dc, &bitmapmask, rop3); - } else { - gdi_draw_bitmap(canvas->dc, &opaque->src_area, bbox, dc, &bitmapmask, rop3); - } - SelectObject(dc, prev_bitmap); - DeleteObject(dc); - ReleaseMutex(pixman_data->mutex); - } else { - if (brush_lock) { - RecurciveLock b_lock(*brush_lock); - gdi_draw_image_rop3(canvas->dc, &opaque->src_area, bbox, surface, &bitmapmask, rop3, 0); - } else { - gdi_draw_image_rop3(canvas->dc, &opaque->src_area, bbox, surface, &bitmapmask, rop3, 0); - } - } - unset_brush(canvas->dc, prev_hbrush); - pixman_image_unref(surface); - } - - free_mask(&bitmapmask); -} - -static void gdi_canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend) -{ - GdiCanvas *gdi_surface; - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - pixman_image_t *surface; - struct BitmapData bitmapmask; - PixmanData *pixman_data; - - gdi_surface = (GdiCanvas *)canvas_get_surface(&canvas->base, blend->src_bitmap); - if (gdi_surface) { - RecurciveLock lock(*canvas->lock); - RecurciveLock s_lock(*gdi_surface->lock); - bitmapmask = get_mask_bitmap(canvas, &blend->mask); - set_scale_mode(canvas, blend->scale_mode); - set_clip(canvas, clip); - gdi_draw_bitmap_redrop(canvas->dc, &blend->src_area, bbox, gdi_surface->dc, - &bitmapmask, blend->rop_descriptor, 0); - } else { - surface = canvas_get_image(&canvas->base, blend->src_bitmap, FALSE); - pixman_data = (PixmanData *)pixman_image_get_destroy_data(surface); - - RecurciveLock lock(*canvas->lock); - bitmapmask = get_mask_bitmap(canvas, &blend->mask); - set_scale_mode(canvas, blend->scale_mode); - set_clip(canvas, clip); - - if (pixman_data && (WaitForSingleObject(pixman_data->mutex, INFINITE) != WAIT_FAILED)) { - HDC dc; - HBITMAP prev_bitmap; - - dc = create_compatible_dc(); - prev_bitmap = (HBITMAP)SelectObject(dc, pixman_data->bitmap); - gdi_draw_bitmap_redrop(canvas->dc, &blend->src_area, bbox, dc, - &bitmapmask, blend->rop_descriptor, 0); - SelectObject(dc, prev_bitmap); - DeleteObject(dc); - ReleaseMutex(pixman_data->mutex); - } else { - gdi_draw_image(canvas->dc, &blend->src_area, bbox, surface, - &bitmapmask, blend->rop_descriptor, 0); - } - - pixman_image_unref(surface); - } - - free_mask(&bitmapmask); -} - -static void gdi_canvas_draw_blackness(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness) -{ - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - struct BitmapData bitmapmask; - - RecurciveLock lock(*canvas->lock); - bitmapmask = get_mask_bitmap(canvas, &blackness->mask); - set_clip(canvas, clip); - gdi_draw_bitmap(canvas->dc, bbox, bbox, canvas->dc, &bitmapmask, 0x0); - - free_mask(&bitmapmask); -} - -static void gdi_canvas_draw_invers(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers) -{ - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - struct BitmapData bitmapmask; - - RecurciveLock lock(*canvas->lock); - bitmapmask = get_mask_bitmap(canvas, &invers->mask); - set_clip(canvas, clip); - gdi_draw_bitmap(canvas->dc, bbox, bbox, canvas->dc, &bitmapmask, 0x55); - - free_mask(&bitmapmask); -} - -static void gdi_canvas_draw_whiteness(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness) -{ - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - struct BitmapData bitmapmask; - - RecurciveLock lock(*canvas->lock); - bitmapmask = get_mask_bitmap(canvas, &whiteness->mask); - set_clip(canvas, clip); - gdi_draw_bitmap(canvas->dc, bbox, bbox, canvas->dc, &bitmapmask, 0xff); - - free_mask(&bitmapmask); -} - -static void gdi_canvas_draw_rop3(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3) -{ - GdiCanvas *gdi_surface; - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - pixman_image_t *surface; - struct BitmapData bitmapmask; - HBRUSH prev_hbrush; - HBRUSH hbrush; - PixmanData *pixman_data; - RecurciveMutex *brush_lock; - - gdi_surface = (GdiCanvas *)canvas_get_surface(&canvas->base, rop3->src_bitmap); - if (gdi_surface) { - RecurciveLock lock(*canvas->lock); - RecurciveLock s_lock(*gdi_surface->lock); - hbrush = get_brush(canvas, &rop3->brush, &brush_lock); - bitmapmask = get_mask_bitmap(canvas, &rop3->mask); - set_scale_mode(canvas, rop3->scale_mode); - set_clip(canvas, clip); - prev_hbrush = set_brush(canvas->dc, hbrush, &rop3->brush); - if (brush_lock) { - RecurciveLock b_lock(*brush_lock); - gdi_draw_bitmap(canvas->dc, &rop3->src_area, bbox, gdi_surface->dc, - &bitmapmask, rop3->rop3); - } else { - gdi_draw_bitmap(canvas->dc, &rop3->src_area, bbox, gdi_surface->dc, - &bitmapmask, rop3->rop3); - } - unset_brush(canvas->dc, prev_hbrush); - } else { - surface = canvas_get_image(&canvas->base, rop3->src_bitmap, FALSE); - pixman_data = (PixmanData *)pixman_image_get_destroy_data(surface); - RecurciveLock lock(*canvas->lock); - hbrush = get_brush(canvas, &rop3->brush, &brush_lock); - bitmapmask = get_mask_bitmap(canvas, &rop3->mask); - set_scale_mode(canvas, rop3->scale_mode); - set_clip(canvas, clip); - prev_hbrush = set_brush(canvas->dc, hbrush, &rop3->brush); - - if (pixman_data && (WaitForSingleObject(pixman_data->mutex, INFINITE) != WAIT_FAILED)) { - HDC dc; - HBITMAP prev_bitmap; - - dc = create_compatible_dc(); - prev_bitmap = (HBITMAP)SelectObject(dc, pixman_data->bitmap); - if (brush_lock) { - RecurciveLock b_lock(*brush_lock); - gdi_draw_bitmap(canvas->dc, &rop3->src_area, bbox, dc, - &bitmapmask, rop3->rop3); - } else { - gdi_draw_bitmap(canvas->dc, &rop3->src_area, bbox, dc, - &bitmapmask, rop3->rop3); - } - SelectObject(dc, prev_bitmap); - DeleteObject(dc); - ReleaseMutex(pixman_data->mutex); - } else { - if (brush_lock) { - RecurciveLock b_lock(*brush_lock); - gdi_draw_image_rop3(canvas->dc, &rop3->src_area, bbox, surface, &bitmapmask, rop3->rop3, 0); - } else { - gdi_draw_image_rop3(canvas->dc, &rop3->src_area, bbox, surface, &bitmapmask, rop3->rop3, 0); - } - } - - unset_brush(canvas->dc, prev_hbrush); - pixman_image_unref(surface); - } - - free_mask(&bitmapmask); -} - -static void gdi_canvas_copy_bits(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos) -{ - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - RecurciveLock lock(*canvas->lock); - - set_clip(canvas, clip); - - BitBlt(canvas->dc, bbox->left, bbox->top, bbox->right - bbox->left, - bbox->bottom - bbox->top, canvas->dc, src_pos->x, src_pos->y, SRCCOPY); -} - -static void gdi_canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text) -{ - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - SpiceString *str; - RecurciveMutex *brush_lock; - - RecurciveLock lock(*canvas->lock); - set_clip(canvas, clip); - lock.unlock(); - - if (!rect_is_empty(&text->back_area)) { - HBRUSH prev_hbrush; - HBRUSH hbrush; - - RecurciveLock lock(*canvas->lock); - hbrush = get_brush(canvas, &text->back_brush, &brush_lock); - prev_hbrush = set_brush(canvas->dc, hbrush, &text->back_brush); - if (brush_lock) { - RecurciveLock b_lock(*brush_lock); - gdi_draw_bitmap_redrop(canvas->dc, bbox, bbox, canvas->dc, NULL, - text->back_mode, 1); - } else { - gdi_draw_bitmap_redrop(canvas->dc, bbox, bbox, canvas->dc, NULL, - text->back_mode, 1); - } - unset_brush(canvas->dc, prev_hbrush); - } - - str = (SpiceString *)SPICE_GET_ADDRESS(text->str); - - if (str->flags & SPICE_STRING_FLAGS_RASTER_A1) { - SpiceRect dest; - SpiceRect src; - - draw_str_mask_bitmap(canvas, str, 1, &dest, &src, &text->fore_brush); - } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A4) { - SpiceRect dest; - SpiceRect src; - - draw_str_mask_bitmap(canvas, str, 4, &dest, &src, &text->fore_brush); - } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A8) { - spice_warning("untested path A8 glyphs, doing nothing"); - if (0) { - SpiceRect dest; - SpiceRect src; - - draw_str_mask_bitmap(canvas, str, 8, &dest, &src, &text->fore_brush); - } - } else { - spice_warning("untested path vector glyphs, doing nothing"); - if (0) { - } - } -} - -static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, uint8_t nseg, SPICE_FIXED28_4* style, int start_is_gap) -{ - double offset = 0; - uint32_t *local_style; - int i; - - spice_return_val_if_fail(nseg != 0, NULL); - - local_style = spice_new(uint32_t , nseg); - - if (start_is_gap) { - offset = (uint32_t)fix_to_double(*style); - local_style[nseg - 1] = (uint32_t)fix_to_double(*style); - style++; - - for (i = 0; i < nseg - 1; i++, style++) { - local_style[i] = (uint32_t)fix_to_double(*style); - } - } else { - for (i = 0; i < nseg; i++, style++) { - local_style[i] = (uint32_t)fix_to_double(*style); - } - } - - return local_style; -} - -static void gdi_canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke) -{ - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - HPEN hpen; - HPEN prev_hpen; - LOGBRUSH logbrush; - uint32_t *user_style = NULL; - pixman_image_t *surface = NULL; - - if (stroke->brush.type == SPICE_BRUSH_TYPE_PATTERN) { - surface = canvas_get_image(&canvas->base, stroke->brush.u.pattern.pat, FALSE); - } - - RecurciveLock lock(*canvas->lock); - set_clip(canvas, clip); - - switch (stroke->fore_mode) { - case SPICE_ROPD_OP_WHITENESS: - SetROP2(canvas->dc, R2_WHITE); //0 - break; - case SPICE_ROPD_OP_BLACKNESS: - SetROP2(canvas->dc, R2_BLACK); //1 - break; - case SPICE_ROPD_OP_INVERS: - SetROP2(canvas->dc, R2_NOT); //Dn - break; - case SPICE_ROPD_OP_PUT: - SetROP2(canvas->dc, R2_COPYPEN); //P - break; - case SPICE_ROPD_OP_OR: - SetROP2(canvas->dc, R2_MERGEPEN); //DPo - break; - case SPICE_ROPD_OP_XOR: - SetROP2(canvas->dc, R2_XORPEN); //DPx - break; - case SPICE_ROPD_OP_AND: - SetROP2(canvas->dc, R2_MASKPEN); //DPa - break; - case SPICE_ROPD_INVERS_BRUSH | SPICE_ROPD_OP_PUT: //Pn - SetROP2(canvas->dc, R2_NOTCOPYPEN); - break; - case SPICE_ROPD_OP_XOR | SPICE_ROPD_INVERS_RES: - SetROP2(canvas->dc, R2_NOTXORPEN); //DPxn - break; - case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_RES: - SetROP2(canvas->dc, R2_NOTMERGEPEN); //DPon - break; - case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_RES: - SetROP2(canvas->dc, R2_NOTMASKPEN); //DPan - break; - case SPICE_ROPD_INVERS_DEST | SPICE_ROPD_OP_AND: - SetROP2(canvas->dc, R2_MASKPENNOT); //PDna - break; - case SPICE_ROPD_INVERS_BRUSH | SPICE_ROPD_OP_AND: - SetROP2(canvas->dc, R2_MASKNOTPEN); //DPna - break; - case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_BRUSH: - SetROP2(canvas->dc, R2_MERGENOTPEN); //DPno - break; - case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_DEST: - SetROP2(canvas->dc, R2_MERGEPENNOT); //PDno - break; - default: - SetROP2(canvas->dc, R2_NOP); //D - } - - - if (stroke->brush.type == SPICE_BRUSH_TYPE_SOLID) { - logbrush.lbStyle = BS_SOLID | DIB_RGB_COLORS; - logbrush.lbHatch = 0; - logbrush.lbColor = get_color_ref(canvas, stroke->brush.u.color); - } else if (stroke->brush.type == SPICE_BRUSH_TYPE_PATTERN) { -#if 0 - struct { - BITMAPINFO inf; - RGBQUAD palette[255]; - } bitmap_info; - GdiImage image; -#endif -#if 0 - spice_return_if_fail(surface != NULL) - surface_to_image(surface, &image); - - memset(&bitmap_info, 0, sizeof(bitmap_info)); - bitmap_info.inf.bmiHeader.biSize = sizeof(bitmap_info.inf.bmiHeader); - bitmap_info.inf.bmiHeader.biWidth = image.width; - if (image.stride < 0) { - bitmap_info.inf.bmiHeader.biHeight = image.height; - } else { - bitmap_info.inf.bmiHeader.biHeight = -image.height; - } - bitmap_info.inf.bmiHeader.biPlanes = 1; - bitmap_info.inf.bmiHeader.biBitCount = 32; - bitmap_info.inf.bmiHeader.biCompression = BI_RGB; - - if (image.stride < 0) { - logbrush.lbHatch = (LONG)GlobalAlloc(GMEM_MOVEABLE, - image.height * -image.stride + sizeof(BITMAPINFO)); - if (!logbrush.lbHatch) { - spice_critical("GlobalAlloc failed"); - return; - } - copy_bitmap(image.pixels - (image.height - 1) * -image.stride, - image.height, -image.stride, - (uint8_t *)logbrush.lbHatch, image.width); - } else { - logbrush.lbHatch = (LONG)GlobalAlloc(GMEM_MOVEABLE, - image.height * image.stride + sizeof(BITMAPINFO)); - if (!logbrush.lbHatch) { - spice_critical("GlobalAlloc failed"); - return; - } - copy_bitmap(image.pixels, image.height, image.stride, - (uint8_t *)logbrush.lbHatch, image.width); - } - - memcpy((void *)logbrush.lbHatch, &bitmap_info.inf, sizeof(BITMAPINFO)); - - logbrush.lbStyle = BS_DIBPATTERN | DIB_RGB_COLORS; - logbrush.lbColor = 0; -#endif - pixman_image_unref(surface); - } - - if (stroke->attr.flags & SPICE_LINE_FLAGS_STYLED) { - user_style = gdi_get_userstyle(canvas, stroke->attr.style_nseg, - stroke->attr.style, - !!(stroke->attr.flags & SPICE_LINE_FLAGS_START_WITH_GAP)); - hpen = ExtCreatePen(PS_COSMETIC | PS_USERSTYLE, - 1, - &logbrush, stroke->attr.style_nseg, (DWORD *)user_style); - } else { - hpen = ExtCreatePen(PS_COSMETIC, - 1, - &logbrush, 0, NULL); - } - prev_hpen = (HPEN)SelectObject(canvas->dc, hpen); - - set_path(canvas, stroke->path); - - StrokePath(canvas->dc); - - SelectObject(canvas->dc, prev_hpen); - DeleteObject(hpen); - -#if 0 - if (stroke->brush.type == SPICE_BRUSH_TYPE_PATTERN) { - GlobalFree((HGLOBAL)logbrush.lbHatch); - } -#endif - - if (user_style) { - free(user_style); - } -} - -static void gdi_canvas_clear(SpiceCanvas *spice_canvas) -{ -} - -static void gdi_canvas_destroy(SpiceCanvas *spice_canvas) -{ - GdiCanvas *canvas = (GdiCanvas *)spice_canvas; - if (!canvas) { - return; - } - canvas_base_destroy(&canvas->base); - free(canvas); -} - -static int need_init = 1; -static SpiceCanvasOps gdi_canvas_ops; - -SpiceCanvas *gdi_canvas_create(int width, int height, - HDC dc, RecurciveMutex* lock, uint32_t format -#ifdef SW_CANVAS_CACHE - , SpiceImageCache *bits_cache - , SpicePaletteCache *palette_cache -#elif defined(SW_CANVAS_IMAGE_CACHE) - , SpiceImageCache *bits_cache -#endif - , SpiceImageSurfaces *surfaces - , SpiceGlzDecoder *glz_decoder - , SpiceJpegDecoder *jpeg_decoder - , SpiceZlibDecoder *zlib_decoder - ) -{ - GdiCanvas *canvas; - int init_ok; - - if (need_init) { - return NULL; - } - canvas = spice_new0(GdiCanvas, 1); - init_ok = canvas_base_init(&canvas->base, &gdi_canvas_ops, - width, height, format -#ifdef SW_CANVAS_CACHE - ,bits_cache - ,palette_cache -#elif defined(SW_CANVAS_IMAGE_CACHE) - , bits_cache -#endif - , surfaces - , glz_decoder - , jpeg_decoder - , zlib_decoder); - canvas->dc = dc; - canvas->lock = lock; - return (SpiceCanvas *)canvas; -} - -void gdi_canvas_init() //unsafe global function -{ - if (!need_init) { - return; - } - need_init = 0; - - canvas_base_init_ops(&gdi_canvas_ops); - gdi_canvas_ops.draw_fill = gdi_canvas_draw_fill; - gdi_canvas_ops.draw_copy = gdi_canvas_draw_copy; - gdi_canvas_ops.draw_opaque = gdi_canvas_draw_opaque; - gdi_canvas_ops.copy_bits = gdi_canvas_copy_bits; - gdi_canvas_ops.draw_text = gdi_canvas_draw_text; - gdi_canvas_ops.draw_stroke = gdi_canvas_draw_stroke; - gdi_canvas_ops.draw_rop3 = gdi_canvas_draw_rop3; - gdi_canvas_ops.draw_blend = gdi_canvas_draw_blend; - gdi_canvas_ops.draw_blackness = gdi_canvas_draw_blackness; - gdi_canvas_ops.draw_whiteness = gdi_canvas_draw_whiteness; - gdi_canvas_ops.draw_invers = gdi_canvas_draw_invers; - gdi_canvas_ops.draw_transparent = gdi_canvas_draw_transparent; - gdi_canvas_ops.draw_alpha_blend = gdi_canvas_draw_alpha_blend; - gdi_canvas_ops.put_image = gdi_canvas_put_image; - gdi_canvas_ops.clear = gdi_canvas_clear; - gdi_canvas_ops.destroy = gdi_canvas_destroy; - - rop3_init(); -} - diff -Nru spice-gtk-0.9/common/gdi_canvas.h spice-gtk-0.12/common/gdi_canvas.h --- spice-gtk-0.9/common/gdi_canvas.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/gdi_canvas.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H__GDI_CANVAS -#define _H__GDI_CANVAS - -#include - -#include "pixman_utils.h" -#include "canvas_base.h" -#include "region.h" - -SpiceCanvas *gdi_canvas_create(int width, int height, - HDC dc, class RecurciveMutex *lock, uint32_t format, - SpiceImageCache *bits_cache, - SpicePaletteCache *palette_cache, - SpiceImageSurfaces *surfaces, - SpiceGlzDecoder *glz_decoder, - SpiceJpegDecoder *jpeg_decoder, - SpiceZlibDecoder *zlib_decoder); - -void gdi_canvas_init(); - -#endif diff -Nru spice-gtk-0.9/common/gl_canvas.c spice-gtk-0.12/common/gl_canvas.c --- spice-gtk-0.9/common/gl_canvas.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/gl_canvas.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,909 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#include -#include -#include - -#include "gl_canvas.h" -#include "quic.h" -#include "rop3.h" -#include "region.h" - -#define GL_CANVAS -#include "canvas_base.c" - -typedef struct GLCanvas GLCanvas; - -struct GLCanvas { - CanvasBase base; - GLCCtx glc; - void *private_data; - int private_data_size; - int textures_lost; -}; - -static inline uint8_t *copy_opposite_image(GLCanvas *canvas, void *data, int stride, int height) -{ - uint8_t *ret_data = (uint8_t *)data; - uint8_t *dest; - uint8_t *src; - int i; - - if (!canvas->private_data) { - canvas->private_data = spice_malloc_n(height, stride); - if (!canvas->private_data) { - return ret_data; - } - canvas->private_data_size = stride * height; - } - - if (canvas->private_data_size < (stride * height)) { - free(canvas->private_data); - canvas->private_data = spice_malloc_n(height, stride); - if (!canvas->private_data) { - return ret_data; - } - canvas->private_data_size = stride * height; - } - - dest = (uint8_t *)canvas->private_data; - src = (uint8_t *)data + (height - 1) * stride; - - for (i = 0; i < height; ++i) { - memcpy(dest, src, stride); - dest += stride; - src -= stride; - } - return (uint8_t *)canvas->private_data; -} - -static pixman_image_t *canvas_surf_to_trans_surf(GLCImage *image, - uint32_t trans_color) -{ - int width = image->width; - int height = image->height; - uint8_t *src_line; - uint8_t *end_src_line; - int src_stride; - uint8_t *dest_line; - int dest_stride; - pixman_image_t *ret; - int i; - - ret = pixman_image_create_bits(PIXMAN_a8r8g8b8, width, height, NULL, 0); - if (ret == NULL) { - spice_critical("create surface failed"); - return NULL; - } - - src_line = image->pixels; - src_stride = image->stride; - end_src_line = src_line + src_stride * height; - - dest_line = (uint8_t *)pixman_image_get_data(ret); - dest_stride = pixman_image_get_stride(ret); - - for (; src_line < end_src_line; src_line += src_stride, dest_line += dest_stride) { - for (i = 0; i < width; i++) { - if ((((uint32_t*)src_line)[i] & 0x00ffffff) == trans_color) { - ((uint32_t*)dest_line)[i] = 0; - } else { - ((uint32_t*)dest_line)[i] = (((uint32_t*)src_line)[i]) | 0xff000000; - } - } - } - - return ret; -} - -static GLCPath get_path(GLCanvas *canvas, SpicePath *s) -{ - GLCPath path = glc_path_create(canvas->glc); - int i; - - for (i = 0; i < s->num_segments; i++) { - SpicePathSeg* seg = s->segments[i]; - SpicePointFix* point = seg->points; - SpicePointFix* end_point = point + seg->count; - - if (seg->flags & SPICE_PATH_BEGIN) { - glc_path_move_to(path, fix_to_double(point->x), fix_to_double(point->y)); - point++; - } - - if (seg->flags & SPICE_PATH_BEZIER) { - spice_return_val_if_fail((point - end_point) % 3 == 0, path); - for (; point + 2 < end_point; point += 3) { - glc_path_curve_to(path, - fix_to_double(point[0].x), fix_to_double(point[0].y), - fix_to_double(point[1].x), fix_to_double(point[1].y), - fix_to_double(point[2].x), fix_to_double(point[2].y)); - } - } else { - for (; point < end_point; point++) { - glc_path_line_to(path, fix_to_double(point->x), fix_to_double(point->y)); - } - } - if (seg->flags & SPICE_PATH_END) { - if (seg->flags & SPICE_PATH_CLOSE) { - glc_path_close(path); - } - } - } - - return path; -} - -#define SET_GLC_RECT(dest, src) { \ - (dest)->x = (src)->left; \ - (dest)->y = (src)->top; \ - (dest)->width = (src)->right - (src)->left; \ - (dest)->height = (src)->bottom - (src)->top; \ -} - -#define SET_GLC_BOX(dest, src) { \ - (dest)->x = (src)->x1; \ - (dest)->y = (src)->y1; \ - (dest)->width = (src)->x2 - (src)->x1; \ - (dest)->height = (src)->y2 - (src)->y1; \ -} - -static void set_clip(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip) -{ - GLCRect rect; - glc_clip_reset(canvas->glc); - - switch (clip->type) { - case SPICE_CLIP_TYPE_NONE: - break; - case SPICE_CLIP_TYPE_RECTS: { - uint32_t n = clip->rects->num_rects; - SpiceRect *now = clip->rects->rects; - SpiceRect *end = now + n; - - if (n == 0) { - rect.x = rect.y = 0; - rect.width = rect.height = 0; - glc_clip_rect(canvas->glc, &rect, GLC_CLIP_OP_SET); - break; - } else { - SET_GLC_RECT(&rect, now); - glc_clip_rect(canvas->glc, &rect, GLC_CLIP_OP_SET); - } - - for (now++; now < end; now++) { - SET_GLC_RECT(&rect, now); - glc_clip_rect(canvas->glc, &rect, GLC_CLIP_OP_OR); - } - break; - } - default: - spice_warn_if_reached(); - return; - } -} - -static void set_mask(GLCanvas *canvas, SpiceQMask *mask, int x, int y) -{ - pixman_image_t *image; - - if (!(image = canvas_get_mask(&canvas->base, mask, NULL))) { - glc_clear_mask(canvas->glc, GLC_MASK_A); - return; - } - - - glc_set_mask(canvas->glc, x - mask->pos.x, y - mask->pos.y, - pixman_image_get_width(image), - pixman_image_get_height(image), - pixman_image_get_stride(image), - (uint8_t *)pixman_image_get_data(image), GLC_MASK_A); -} - -static inline void surface_to_image(GLCanvas *canvas, pixman_image_t *surface, GLCImage *image, - int ignore_stride) -{ - int depth = pixman_image_get_depth(surface); - - spice_return_if_fail(depth == 32 || depth == 24); - image->format = (depth == 24) ? GLC_IMAGE_RGB32 : GLC_IMAGE_ARGB32; - image->width = pixman_image_get_width(surface); - image->height = pixman_image_get_height(surface); - image->stride = pixman_image_get_stride(surface); - image->pixels = (uint8_t *)pixman_image_get_data(surface); - image->pallet = NULL; - if (ignore_stride) { - return; - } - if (image->stride < 0) { - image->stride = -image->stride; - image->pixels = image->pixels - (image->height - 1) * image->stride; - } else { - image->pixels = copy_opposite_image(canvas, image->pixels, image->stride, image->height); - } -} - -static void set_brush(GLCanvas *canvas, SpiceBrush *brush) -{ - switch (brush->type) { - case SPICE_BRUSH_TYPE_SOLID: { - uint32_t color = brush->u.color; - double r, g, b; - - b = (double)(color & canvas->base.color_mask) / canvas->base.color_mask; - color >>= canvas->base.color_shift; - g = (double)(color & canvas->base.color_mask) / canvas->base.color_mask; - color >>= canvas->base.color_shift; - r = (double)(color & canvas->base.color_mask) / canvas->base.color_mask; - glc_set_rgb(canvas->glc, r, g, b); - break; - } - case SPICE_BRUSH_TYPE_PATTERN: { - GLCImage image; - GLCPattern pattern; - pixman_image_t *surface; - - surface = canvas_get_image(&canvas->base, brush->u.pattern.pat, FALSE); - surface_to_image(canvas, surface, &image, 0); - - pattern = glc_pattern_create(canvas->glc, -brush->u.pattern.pos.x, - -brush->u.pattern.pos.y, &image); - - glc_set_pattern(canvas->glc, pattern); - glc_pattern_destroy(pattern); - pixman_image_unref (surface); - } - case SPICE_BRUSH_TYPE_NONE: - return; - default: - spice_warn_if_reached(); - return; - } -} - -static void set_op(GLCanvas *canvas, uint16_t rop_decriptor) -{ - GLCOp op; - - switch (rop_decriptor) { - case SPICE_ROPD_OP_PUT: - op = GLC_OP_COPY; - break; - case SPICE_ROPD_OP_XOR: - op = GLC_OP_XOR; - break; - case SPICE_ROPD_OP_BLACKNESS: - op = GLC_OP_CLEAR; - break; - case SPICE_ROPD_OP_WHITENESS: - op = GLC_OP_SET; - break; - case SPICE_ROPD_OP_PUT | SPICE_ROPD_INVERS_BRUSH: - case SPICE_ROPD_OP_PUT | SPICE_ROPD_INVERS_SRC: - op = GLC_OP_COPY_INVERTED; - break; - case SPICE_ROPD_OP_INVERS: - op = GLC_OP_INVERT; - break; - case SPICE_ROPD_OP_AND: - op = GLC_OP_AND; - break; - case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_RES: - op = GLC_OP_NAND; - break; - case SPICE_ROPD_OP_OR: - op = GLC_OP_OR; - break; - case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_RES: - op = GLC_OP_NOR; - break; - case SPICE_ROPD_OP_XOR | SPICE_ROPD_INVERS_RES: - op = GLC_OP_EQUIV; - break; - case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_DEST: - op = GLC_OP_AND_REVERSE; - break; - case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_BRUSH: - case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_SRC: - op = GLC_OP_AND_INVERTED; - break; - case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_DEST: - op = GLC_OP_OR_REVERSE; - break; - case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_BRUSH: - case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_SRC: - op = GLC_OP_OR_INVERTED; - break; - default: - spice_warning("GLC_OP_NOOP"); - op = GLC_OP_NOOP; - } - glc_set_op(canvas->glc, op); -} - -static void gl_canvas_draw_fill(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - GLCRect rect; - set_clip(canvas, bbox, clip); - set_mask(canvas, &fill->mask, bbox->left, bbox->top); - set_brush(canvas, &fill->brush); - set_op(canvas, fill->rop_descriptor); - SET_GLC_RECT(&rect, bbox); - - glc_fill_rect(canvas->glc, &rect); - glc_flush(canvas->glc); -} - -static void gl_canvas_draw_copy(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - pixman_image_t *surface; - GLCRecti src; - GLCRecti dest; - GLCImage image; - - set_clip(canvas, bbox, clip); - set_mask(canvas, ©->mask, bbox->left, bbox->top); - set_op(canvas, copy->rop_descriptor); - - //todo: optimize get_image (use ogl conversion + remove unnecessary copy of 32bpp) - surface = canvas_get_image(&canvas->base, copy->src_bitmap, FALSE); - surface_to_image(canvas, surface, &image, 0); - SET_GLC_RECT(&dest, bbox); - SET_GLC_RECT(&src, ©->src_area); - glc_draw_image(canvas->glc, &dest, &src, &image, 0, 1); - - pixman_image_unref(surface); - glc_flush(canvas->glc); -} - -static void gl_canvas_draw_opaque(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - pixman_image_t *surface; - GLCRecti src; - GLCRecti dest; - GLCRect fill_rect; - GLCImage image; - - set_clip(canvas, bbox, clip); - set_mask(canvas, &opaque->mask, bbox->left, bbox->top); - - glc_set_op(canvas->glc, (opaque->rop_descriptor & SPICE_ROPD_INVERS_SRC) ? GLC_OP_COPY_INVERTED : - GLC_OP_COPY); - surface = canvas_get_image(&canvas->base, opaque->src_bitmap, FALSE); - surface_to_image(canvas, surface, &image, 0); - SET_GLC_RECT(&dest, bbox); - SET_GLC_RECT(&src, &opaque->src_area); - glc_draw_image(canvas->glc, &dest, &src, &image, 0, 1); - pixman_image_unref(surface); - - set_brush(canvas, &opaque->brush); - set_op(canvas, opaque->rop_descriptor & ~SPICE_ROPD_INVERS_SRC); - SET_GLC_RECT(&fill_rect, bbox); - glc_fill_rect(canvas->glc, &fill_rect); - - glc_flush(canvas->glc); -} - -static void gl_canvas_draw_alpha_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlend *alpha_blend) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - pixman_image_t *surface; - GLCRecti src; - GLCRecti dest; - GLCImage image; - - set_clip(canvas, bbox, clip); - glc_clear_mask(canvas->glc, GLC_MASK_A); - glc_set_op(canvas->glc, GLC_OP_COPY); - - surface = canvas_get_image(&canvas->base, alpha_blend->src_bitmap, FALSE); - surface_to_image(canvas, surface, &image, 0); - SET_GLC_RECT(&dest, bbox); - SET_GLC_RECT(&src, &alpha_blend->src_area); - glc_draw_image(canvas->glc, &dest, &src, &image, 0, (double)alpha_blend->alpha / 0xff); - - pixman_image_unref(surface); - glc_flush(canvas->glc); -} - -static void gl_canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - pixman_image_t *surface; - GLCRecti src; - GLCRecti dest; - GLCImage image; - - set_clip(canvas, bbox, clip); - set_mask(canvas, &blend->mask, bbox->left, bbox->top); - set_op(canvas, blend->rop_descriptor); - - surface = canvas_get_image(&canvas->base, blend->src_bitmap, FALSE); - SET_GLC_RECT(&dest, bbox); - SET_GLC_RECT(&src, &blend->src_area); - surface_to_image(canvas, surface, &image, 0); - glc_draw_image(canvas->glc, &dest, &src, &image, 0, 1); - - pixman_image_unref(surface); - glc_flush(canvas->glc); -} - -static void gl_canvas_draw_transparent(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent *transparent) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - pixman_image_t *surface; - pixman_image_t *trans_surf; - GLCImage image; - GLCRecti src; - GLCRecti dest; - - set_clip(canvas, bbox, clip); - glc_clear_mask(canvas->glc, GLC_MASK_A); - glc_set_op(canvas->glc, GLC_OP_COPY); - - surface = canvas_get_image(&canvas->base, transparent->src_bitmap, FALSE); - surface_to_image(canvas, surface, &image, 0); - - trans_surf = canvas_surf_to_trans_surf(&image, transparent->true_color); - pixman_image_unref(surface); - - surface_to_image(canvas, trans_surf, &image, 1); - SET_GLC_RECT(&dest, bbox); - SET_GLC_RECT(&src, &transparent->src_area); - glc_draw_image(canvas->glc, &dest, &src, &image, 0, 1); - - pixman_image_unref(trans_surf); - glc_flush(canvas->glc); -} - -static inline void fill_common(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceQMask * mask, GLCOp op) -{ - GLCRect rect; - - set_clip(canvas, bbox, clip); - set_mask(canvas, mask, bbox->left, bbox->top); - glc_set_op(canvas->glc, op); - SET_GLC_RECT(&rect, bbox); - glc_fill_rect(canvas->glc, &rect); -} - -static void gl_canvas_draw_whiteness(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - fill_common(canvas, bbox, clip, &whiteness->mask, GLC_OP_SET); -} - -static void gl_canvas_draw_blackness(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - fill_common(canvas, bbox, clip, &blackness->mask, GLC_OP_CLEAR); -} - -static void gl_canvas_draw_invers(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - fill_common(canvas, bbox, clip, &invers->mask, GLC_OP_INVERT); -} - -static void gl_canvas_draw_rop3(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - pixman_image_t *d; - pixman_image_t *s; - GLCImage image; - SpicePoint src_pos; - uint8_t *data_opp; - int src_stride; - - set_clip(canvas, bbox, clip); - set_mask(canvas, &rop3->mask, bbox->left, bbox->top); - - glc_set_op(canvas->glc, GLC_OP_COPY); - - image.format = GLC_IMAGE_RGB32; - image.width = bbox->right - bbox->left; - image.height = bbox->bottom - bbox->top; - - image.pallet = NULL; - - d = pixman_image_create_bits(PIXMAN_x8r8g8b8, image.width, image.height, NULL, 0); - if (d == NULL) { - spice_critical("create surface failed"); - return; - } - image.pixels = (uint8_t *)pixman_image_get_data(d); - image.stride = pixman_image_get_stride(d); - - glc_read_pixels(canvas->glc, bbox->left, bbox->top, &image); - data_opp = copy_opposite_image(canvas, image.pixels, - image.stride, - pixman_image_get_height(d)); - memcpy(image.pixels, data_opp, - image.stride * pixman_image_get_height(d)); - - s = canvas_get_image(&canvas->base, rop3->src_bitmap, FALSE); - src_stride = pixman_image_get_stride(s); - if (src_stride > 0) { - data_opp = copy_opposite_image(canvas, (uint8_t *)pixman_image_get_data(s), - src_stride, pixman_image_get_height(s)); - memcpy((uint8_t *)pixman_image_get_data(s), data_opp, - src_stride * pixman_image_get_height(s)); - } - - if (!rect_is_same_size(bbox, &rop3->src_area)) { - pixman_image_t *scaled_s = canvas_scale_surface(s, &rop3->src_area, image.width, - image.height, rop3->scale_mode); - pixman_image_unref(s); - s = scaled_s; - src_pos.x = 0; - src_pos.y = 0; - } else { - src_pos.x = rop3->src_area.left; - src_pos.y = rop3->src_area.top; - } - - if (pixman_image_get_width(s) - src_pos.x < image.width || - pixman_image_get_height(s) - src_pos.y < image.height) { - spice_critical("bad src bitmap size"); - return; - } - - if (rop3->brush.type == SPICE_BRUSH_TYPE_PATTERN) { - pixman_image_t *p = canvas_get_image(&canvas->base, rop3->brush.u.pattern.pat, FALSE); - SpicePoint pat_pos; - - pat_pos.x = (bbox->left - rop3->brush.u.pattern.pos.x) % pixman_image_get_width(p); - - pat_pos.y = (bbox->top - rop3->brush.u.pattern.pos.y) % pixman_image_get_height(p); - - //for now (bottom-top) - if (pat_pos.y < 0) { - pat_pos.y = pixman_image_get_height(p) + pat_pos.y; - } - pat_pos.y = (image.height + pat_pos.y) % pixman_image_get_height(p); - pat_pos.y = pixman_image_get_height(p) - pat_pos.y; - - do_rop3_with_pattern(rop3->rop3, d, s, &src_pos, p, &pat_pos); - pixman_image_unref(p); - } else { - uint32_t color = (canvas->base.color_shift) == 8 ? rop3->brush.u.color : - canvas_16bpp_to_32bpp(rop3->brush.u.color); - do_rop3_with_color(rop3->rop3, d, s, &src_pos, color); - } - - pixman_image_unref(s); - - GLCRecti dest; - GLCRecti src; - dest.x = bbox->left; - dest.y = bbox->top; - - image.pixels = copy_opposite_image(canvas, image.pixels, pixman_image_get_stride(d), - pixman_image_get_height(d)); - - src.x = src.y = 0; - dest.width = src.width = image.width; - dest.height = src.height = image.height; - glc_draw_image(canvas->glc, &dest, &src, &image, 0, 1); - pixman_image_unref(d); -} - -static void gl_canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - GLCPath path; - - set_clip(canvas, bbox, clip); - glc_clear_mask(canvas->glc, GLC_MASK_A); - set_op(canvas, stroke->fore_mode); - set_brush(canvas, &stroke->brush); - - if (stroke->attr.flags & SPICE_LINE_FLAGS_STYLED) { - spice_warning("SPICE_LINE_FLAGS_STYLED"); - } - glc_set_line_width(canvas->glc, 1.0); - - path = get_path(canvas, stroke->path); - glc_stroke_path(canvas->glc, path); - glc_path_destroy(path); -} - -static void gl_canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - GLCRect rect; - SpiceString *str; - - set_clip(canvas, bbox, clip); - glc_clear_mask(canvas->glc, GLC_MASK_A); - - if (!rect_is_empty(&text->back_area)) { - set_brush(canvas, &text->back_brush); - set_op(canvas, text->back_mode); - SET_GLC_RECT(&rect, bbox); - glc_fill_rect(canvas->glc, &rect); - } - - str = (SpiceString *)SPICE_GET_ADDRESS(text->str); - set_brush(canvas, &text->fore_brush); - set_op(canvas, text->fore_mode); - if (str->flags & SPICE_STRING_FLAGS_RASTER_A1) { - SpicePoint pos; - pixman_image_t *mask = canvas_get_str_mask(&canvas->base, str, 1, &pos); - _glc_fill_mask(canvas->glc, pos.x, pos.y, - pixman_image_get_width(mask), - pixman_image_get_height(mask), - pixman_image_get_stride(mask), - (uint8_t *)pixman_image_get_data(mask)); - pixman_image_unref(mask); - } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A4) { - SpicePoint pos; - pixman_image_t *mask = canvas_get_str_mask(&canvas->base, str, 4, &pos); - glc_fill_alpha(canvas->glc, pos.x, pos.y, - pixman_image_get_width(mask), - pixman_image_get_height(mask), - pixman_image_get_stride(mask), - (uint8_t *)pixman_image_get_data(mask)); - - pixman_image_unref(mask); - } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A8) { - spice_warning("untested path A8 glyphs, doing nothing"); - if (0) { - SpicePoint pos; - pixman_image_t *mask = canvas_get_str_mask(&canvas->base, str, 8, &pos); - glc_fill_alpha(canvas->glc, pos.x, pos.y, - pixman_image_get_width(mask), - pixman_image_get_height(mask), - pixman_image_get_stride(mask), - (uint8_t *)pixman_image_get_data(mask)); - pixman_image_unref(mask); - } - } else { - spice_warning("untested path vector glyphs, doing nothing"); - if (0) { - //draw_vector_str(canvas, str, &text->fore_brush, text->fore_mode); - } - } - glc_flush(canvas->glc); -} - -static void gl_canvas_clear(SpiceCanvas *spice_canvas) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - glc_clear(canvas->glc); - glc_flush(canvas->glc); -} - -static void gl_canvas_copy_bits(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - set_clip(canvas, bbox, clip); - glc_clear_mask(canvas->glc, GLC_MASK_A); - glc_set_op(canvas->glc, GLC_OP_COPY); - glc_copy_pixels(canvas->glc, bbox->left, bbox->top, src_pos->x, src_pos->y, - bbox->right - bbox->left, bbox->bottom - bbox->top); -} - -static void gl_canvas_read_bits(SpiceCanvas *spice_canvas, uint8_t *dest, int dest_stride, const SpiceRect *area) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - GLCImage image; - - spice_return_if_fail(dest_stride > 0); - - image.format = GLC_IMAGE_RGB32; - image.height = area->bottom - area->top; - image.width = area->right - area->left; - image.pixels = dest; - image.stride = dest_stride; - glc_read_pixels(canvas->glc, area->left, area->top, &image); -} - -static void gl_canvas_group_start(SpiceCanvas *spice_canvas, QRegion *region) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - GLCRect *glc_rects; - GLCRect *now, *end; - int num_rect; - pixman_box32_t *rects; - - canvas_base_group_start(spice_canvas, region); - - rects = pixman_region32_rectangles(region, &num_rect); - - glc_rects = spice_new(GLCRect, num_rect); - now = glc_rects; - end = glc_rects + num_rect; - - for (; now < end; now++, rects++) { - SET_GLC_BOX(now, rects); - } - glc_mask_rects(canvas->glc, num_rect, glc_rects, GLC_MASK_B); - - free(glc_rects); -} - -static void gl_canvas_put_image(SpiceCanvas *spice_canvas, const SpiceRect *dest, const uint8_t *src_data, - uint32_t src_width, uint32_t src_height, int src_stride, - const QRegion *clip) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - GLCRecti src; - GLCRecti gldest; - GLCImage image; - uint32_t i; - - spice_return_if_fail(src_stride <= 0) - - glc_clip_reset(canvas->glc); - - if (clip) { - int num_rects; - pixman_box32_t *rects = pixman_region32_rectangles((pixman_region32_t *)clip, - &num_rects); - GLCRect rect; - if (num_rects == 0) { - rect.x = rect.y = rect.width = rect.height = 0; - glc_clip_rect(canvas->glc, &rect, GLC_CLIP_OP_SET); - } else { - SET_GLC_BOX(&rect, rects); - glc_clip_rect(canvas->glc, &rect, GLC_CLIP_OP_SET); - for (i = 1; i < num_rects; i++) { - SET_GLC_BOX(&rect, rects + i); - glc_clip_rect(canvas->glc, &rect, GLC_CLIP_OP_OR); - } - } - } - - SET_GLC_RECT(&gldest, dest); - src.x = src.y = 0; - src.width = src_width; - src.height = src_height; - - image.format = GLC_IMAGE_RGB32; - image.width = src_width; - image.height = src_height; - src_stride = -src_stride; - image.stride = src_stride; - image.pixels = (uint8_t *)src_data - (src_height - 1) * src_stride; - image.pallet = NULL; - glc_draw_image(canvas->glc, &gldest, &src, &image, 0, 1); - - glc_flush(canvas->glc); -} - -static void gl_canvas_group_end(SpiceCanvas *spice_canvas) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - - canvas_base_group_end(spice_canvas); - glc_clear_mask(canvas->glc, GLC_MASK_B); -} - -static int need_init = 1; -static SpiceCanvasOps gl_canvas_ops; - -SpiceCanvas *gl_canvas_create(int width, int height, uint32_t format -#ifdef SW_CANVAS_CACHE - , SpiceImageCache *bits_cache - , SpicePaletteCache *palette_cache -#elif defined(SW_CANVAS_IMAGE_CACHE) - , SpiceImageCache *bits_cache -#endif - , SpiceImageSurfaces *surfaces - , SpiceGlzDecoder *glz_decoder - , SpiceJpegDecoder *jpeg_decoder - , SpiceZlibDecoder *zlib_decoder - ) -{ - GLCanvas *canvas; - int init_ok; - - if (need_init) { - return NULL; - } - canvas = spice_new0(GLCanvas, 1); - - if (!(canvas->glc = glc_create(width, height))) { - goto error_1; - } - canvas->private_data = NULL; - init_ok = canvas_base_init(&canvas->base, &gl_canvas_ops, - width, height, format -#ifdef SW_CANVAS_CACHE - , bits_cache - , palette_cache -#elif defined(SW_CANVAS_IMAGE_CACHE) - , bits_cache -#endif - , surfaces - , glz_decoder - , jpeg_decoder - , zlib_decoder - ); - if (!init_ok) { - goto error_2; - } - - return (SpiceCanvas *)canvas; - -error_2: - glc_destroy(canvas->glc, 0); -error_1: - free(canvas); - - return NULL; -} - -void gl_canvas_set_textures_lost(SpiceCanvas *spice_canvas, - int textures_lost) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - - canvas->textures_lost = textures_lost; -} - -static void gl_canvas_destroy(SpiceCanvas *spice_canvas) -{ - GLCanvas *canvas = (GLCanvas *)spice_canvas; - - if (!canvas) { - return; - } - canvas_base_destroy(&canvas->base); - glc_destroy(canvas->glc, canvas->textures_lost); - if (canvas->private_data) { - free(canvas->private_data); - } - free(canvas); -} - -void gl_canvas_init() //unsafe global function -{ - if (!need_init) { - return; - } - need_init = 0; - - canvas_base_init_ops(&gl_canvas_ops); - gl_canvas_ops.draw_fill = gl_canvas_draw_fill; - gl_canvas_ops.draw_copy = gl_canvas_draw_copy; - gl_canvas_ops.draw_opaque = gl_canvas_draw_opaque; - gl_canvas_ops.copy_bits = gl_canvas_copy_bits; - gl_canvas_ops.draw_text = gl_canvas_draw_text; - gl_canvas_ops.draw_stroke = gl_canvas_draw_stroke; - gl_canvas_ops.draw_rop3 = gl_canvas_draw_rop3; - gl_canvas_ops.draw_blend = gl_canvas_draw_blend; - gl_canvas_ops.draw_blackness = gl_canvas_draw_blackness; - gl_canvas_ops.draw_whiteness = gl_canvas_draw_whiteness; - gl_canvas_ops.draw_invers = gl_canvas_draw_invers; - gl_canvas_ops.draw_transparent = gl_canvas_draw_transparent; - gl_canvas_ops.draw_alpha_blend = gl_canvas_draw_alpha_blend; - gl_canvas_ops.put_image = gl_canvas_put_image; - gl_canvas_ops.clear = gl_canvas_clear; - gl_canvas_ops.read_bits = gl_canvas_read_bits; - gl_canvas_ops.group_start = gl_canvas_group_start; - gl_canvas_ops.group_end = gl_canvas_group_end; - gl_canvas_ops.destroy = gl_canvas_destroy; - - rop3_init(); -} diff -Nru spice-gtk-0.9/common/gl_canvas.h spice-gtk-0.12/common/gl_canvas.h --- spice-gtk-0.9/common/gl_canvas.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/gl_canvas.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#include "glc.h" -#include "canvas_base.h" -#include "region.h" - -SpiceCanvas *gl_canvas_create(int width, int height, uint32_t format -#ifdef SW_CANVAS_CACHE - , SpiceImageCache *bits_cache - , SpicePaletteCache *palette_cache -#elif defined(SW_CANVAS_IMAGE_CACHE) - , SpiceImageCache *bits_cache -#endif - , SpiceImageSurfaces *surfaces - , SpiceGlzDecoder *glz_decoder - , SpiceJpegDecoder *jpeg_decoder - , SpiceZlibDecoder *zlib_decoder - ); -void gl_canvas_set_textures_lost(SpiceCanvas *canvas, int textures_lost); -void gl_canvas_init(); - diff -Nru spice-gtk-0.9/common/glc.c spice-gtk-0.12/common/glc.c --- spice-gtk-0.9/common/glc.c 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/glc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1521 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include -#include -#include -#include -#include - -#include -#include -#include - -#ifdef WIN32 -#include "glext.h" -#include "wglext.h" -#endif - -#include "mem.h" -#include "glc.h" -#include "gl_utils.h" - -#define ASSERT(x) if (!(x)) {printf("%s: assert failed %s\n", __FUNCTION__, #x); abort();} - -#define WARN_ONCE(x) { \ - static int warn = TRUE; \ - if (warn) { \ - printf x; \ - warn = FALSE; \ - } \ -} - -#define TESS_VERTEX_ALLOC_BUNCH 20 - -typedef struct InternaCtx InternaCtx; -typedef struct InternalPat { - InternaCtx *owner; - int refs; - GLuint texture; - int x_orign; - int y_orign; - int width; - int height; -} InternalPat; - -typedef struct Pathpath { - int start_point; - int num_segments; -} Path; - -enum { - GLC_PATH_SEG_LINES, - GLC_PATH_SEG_BEIZER, -}; - -//todo: flatten cache -typedef struct PathSegment { - int type; - int count; -} PathSegment; - -typedef struct PathPoint { - double x; - double y; - double z; -} PathPoint; - -typedef GLdouble Vertex[3]; - -typedef struct InternalPath { - InternaCtx *owner; - - Path *paths; - int paths_size; - int paths_pos; - - PathSegment *segments; - int segments_size; - int segments_pos; - - PathPoint *points; - int points_size; - int points_pos; - - Path *current_path; - PathSegment *current_segment; -} InternalPath; - -typedef struct TassVertex TassVertex; -struct TassVertex { - PathPoint point; - TassVertex *list_link; - TassVertex *next; -}; - -typedef struct TassVertexBuf TassVertexBuf; -struct TassVertexBuf { - TassVertexBuf *next; - TassVertex vertexs[0]; -}; - -#define USE_LINE_ANTIALIAS 0 - -typedef struct LineDash { - double *dashes; - int num_dashes; - double offset; - int cur_dash; - double dash_pos; -} LineDash; - -enum { - GLC_STROKE_NONACTIVE, - GLC_STROKE_FIRST, - GLC_STROKE_ACTIVE, -}; - -typedef struct PathStroke { - double x; - double y; - int state; -} PathStroke; - -struct InternaCtx { - int draw_mode; - int stencil_refs; - int stencil_mask; - int width; - int height; - GLfloat line_width; - LineDash line_dash; - PathStroke path_stroke; - InternalPat *pat; - int max_texture_size; - GLUtesselator* tesselator; - TassVertex *free_tess_vertex; - TassVertex *used_tess_vertex; - TassVertexBuf *vertex_bufs; - int private_tex_width; - int private_tex_height; - GLuint private_tex; -#ifdef WIN32 - PFNGLBLENDEQUATIONPROC glBlendEquation; -#endif -}; - -#define Y(y) -(y) -#define VERTEX2(x, y) glVertex2d(x, Y(y)) - -static void fill_rect(InternaCtx *ctx, void *rect); -static void fill_path(InternaCtx *ctx, void *path); -static void fill_mask(InternaCtx *ctx, int x_dest, int y_dest, int width, int height, int stride, - const uint8_t *bitmap); -static void set_pat(InternaCtx *ctx, InternalPat *pat); - -static inline void set_raster_pos(InternaCtx *ctx, int x, int y) -{ - if (x >= 0 && y >= 0 && x < ctx->width && y < ctx->height) { - glRasterPos2i(x, Y(y)); - return; - } - glRasterPos2i(0, 0); - glBitmap(0, 0, 0, 0, (GLfloat)x, (GLfloat)Y(y), NULL); -} - -static TassVertex *alloc_tess_vertex(InternaCtx *ctx) -{ - TassVertex *vertex; - - if (!ctx->free_tess_vertex) { - TassVertexBuf *buf; - int i; - - buf = (TassVertexBuf *)spice_malloc(sizeof(TassVertexBuf) + - sizeof(TassVertex) * TESS_VERTEX_ALLOC_BUNCH); - buf->next = ctx->vertex_bufs; - ctx->vertex_bufs = buf; - for (i = 0; i < TESS_VERTEX_ALLOC_BUNCH; i++) { - buf->vertexs[i].point.z = 0; - buf->vertexs[i].next = ctx->free_tess_vertex; - ctx->free_tess_vertex = &buf->vertexs[i]; - } - } - - vertex = ctx->free_tess_vertex; - ctx->free_tess_vertex = vertex->next; - vertex->next = ctx->used_tess_vertex; - ctx->used_tess_vertex = vertex; - return vertex; -} - -static void reset_tass_vertex(InternaCtx *ctx) -{ - TassVertex *vertex; - while ((vertex = ctx->used_tess_vertex)) { - ctx->used_tess_vertex = vertex->next; - vertex->next = ctx->free_tess_vertex; - ctx->free_tess_vertex = vertex; - } -} - -static void free_tass_vertex_bufs(InternaCtx *ctx) -{ - TassVertexBuf *buf; - - ctx->used_tess_vertex = NULL; - ctx->free_tess_vertex = NULL; - while ((buf = ctx->vertex_bufs)) { - ctx->vertex_bufs = buf->next; - free(buf); - } -} - -//naive bezier flattener -static TassVertex *bezier_flattener(InternaCtx *ctx, PathPoint *points) -{ - double ax, bx, cx; - double ay, by, cy; - const int num_points = 30; - double dt; - int i; - - TassVertex *vertex_list = NULL; - TassVertex *curr_vertex; - - for (i = 0; i < num_points - 2; i++) { - TassVertex *vertex; - - vertex = alloc_tess_vertex(ctx); - vertex->list_link = vertex_list; - vertex_list = vertex; - } - - curr_vertex = vertex_list; - - cx = 3.0 * (points[1].x - points[0].x); - bx = 3.0 * (points[2].x - points[1].x) - cx; - ax = points[3].x - points[0].x - cx - bx; - - cy = 3.0 * (points[1].y - points[0].y); - by = 3.0 * (points[2].y - points[1].y) - cy; - ay = points[3].y - points[0].y - cy - by; - - dt = 1.0 / (num_points - 1); - - for (i = 1; i < num_points - 1; i++, curr_vertex = curr_vertex->list_link) { - double tSquared, tCubed; - double t; - t = i * dt; - - tSquared = t * t; - tCubed = tSquared * t; - - curr_vertex->point.x = (ax * tCubed) + (bx * tSquared) + (cx * t) + points[0].x; - curr_vertex->point.y = (ay * tCubed) + (by * tSquared) + (cy * t) + points[0].y; - } - - return vertex_list; -} - -#define MORE_X(path, Type, name) { \ - Type *name; \ - \ - name = spice_new0(Type, path->name##_size * 2); \ - memcpy(name, path->name, sizeof(*name) * path->name##_size); \ - free(path->name); \ - path->name = name; \ - path->name##_size *= 2; \ -} - -static void more_points(InternalPath *path) -{ - MORE_X(path, PathPoint, points); -} - -static void more_segments(InternalPath *path) -{ - MORE_X(path, PathSegment, segments); -} - -static void more_paths(InternalPath *path) -{ - MORE_X(path, Path, paths); -} - -static inline void put_point(InternalPath *path, double x, double y) -{ - path->points[path->points_pos].x = x; - path->points[path->points_pos].y = Y(y + 0.5); - path->points[path->points_pos++].z = 0; -} - -void glc_path_move_to(GLCPath path, double x, double y) -{ - InternalPath *internal = (InternalPath *)path; - - ASSERT(internal); - - if (internal->current_segment) { - internal->current_segment = NULL; - internal->current_path = NULL; - if (internal->points_pos == internal->points_size) { - more_points(internal); - } - internal->points_pos++; - } - internal->points[internal->points_pos - 1].x = x; - internal->points[internal->points_pos - 1].y = Y(y + 0.5); - internal->points[internal->points_pos - 1].z = 0; -} - -static void add_segment_common(InternalPath *internal, int type, int num_points) -{ - if (internal->points_size - internal->points_pos < num_points) { - more_points(internal); - } - - if (internal->current_segment) { - if (internal->current_segment->type == type) { - internal->current_segment->count++; - return; - } - if (internal->segments_pos == internal->segments_size) { - more_segments(internal); - } - internal->current_segment = &internal->segments[internal->segments_pos++]; - internal->current_segment->type = type; - internal->current_segment->count = 1; - internal->current_path->num_segments++; - return; - } - - if (internal->paths_pos == internal->paths_size) { - more_paths(internal); - } - - if (internal->segments_pos == internal->segments_size) { - more_segments(internal); - } - - internal->current_path = &internal->paths[internal->paths_pos++]; - internal->current_path->start_point = internal->points_pos - 1; - internal->current_path->num_segments = 1; - internal->current_segment = &internal->segments[internal->segments_pos++]; - internal->current_segment->type = type; - internal->current_segment->count = 1; -} - -void glc_path_line_to(GLCPath path, double x, double y) -{ - InternalPath *internal = (InternalPath *)path; - - ASSERT(internal); - - add_segment_common(internal, GLC_PATH_SEG_LINES, 1); - put_point(internal, x, y); -} - -void glc_path_curve_to(GLCPath path, double p1_x, double p1_y, double p2_x, double p2_y, - double p3_x, double p3_y) -{ - InternalPath *internal = (InternalPath *)path; - - ASSERT(internal); - - add_segment_common(internal, GLC_PATH_SEG_BEIZER, 3); - put_point(internal, p1_x, p1_y); - put_point(internal, p2_x, p2_y); - put_point(internal, p3_x, p3_y); -} - -void glc_path_close(GLCPath path) -{ - InternalPath *internal = (InternalPath *)path; - - ASSERT(internal); - if (!internal->current_path) { - return; - } - PathPoint *end_point = &internal->points[internal->current_path->start_point]; - glc_path_line_to(path, end_point->x, Y(end_point->y)); - glc_path_move_to(path, end_point->x, Y(end_point->y)); -} - -void glc_path_cleare(GLCPath path) -{ - InternalPath *internal = (InternalPath *)path; - - ASSERT(internal); - internal->paths_pos = internal->segments_pos = 0; - internal->current_segment = NULL; - internal->current_path = NULL; - - internal->points[0].x = 0; - internal->points[0].y = 0; - internal->points_pos = 1; -} - -GLCPath glc_path_create(GLCCtx glc) -{ - InternaCtx *ctx = (InternaCtx *)glc; - InternalPath *path; - - ASSERT(ctx); - path = spice_new0(InternalPath, 1); - path->paths_size = 2; - path->paths = spice_new(Path, path->paths_size); - - path->segments_size = 4; - path->segments = spice_new(PathSegment, path->segments_size); - - path->points_size = 20; - path->points = spice_new(PathPoint, path->points_size); - - path->owner = ctx; - path->points_pos = 1; - return path; -} - -void glc_path_destroy(GLCPath path) -{ - InternalPath *internal = (InternalPath *)path; - - if (!path) { - return; - } - - free(internal->points); - free(internal->segments); - free(internal->paths); - free(internal); -} - -static inline void unref_pat(InternalPat *pat) -{ - if (!pat) { - return; - } - ASSERT(pat->refs > 0); - if (--pat->refs == 0) { - glFinish(); - glDeleteTextures(1, &pat->texture); - free(pat); - } - GLC_ERROR_TEST_FLUSH; -} - -static inline InternalPat *ref_pat(InternalPat *pat) -{ - pat->refs++; - return pat; -} - -static void scale(uint32_t *dest, uint32_t dest_width, uint32_t dest_height, - uint32_t *src, uint32_t src_width, uint32_t src_height, int src_stride) -{ - double x_scale = (double)src_width / dest_width; - double y_scale = (double)src_height / dest_height; - uint32_t i; - uint32_t j; - int prev_row = -1; - - for (i = 0; i < dest_height; i++) { - int row = (int)(y_scale * i); - if (row == prev_row) { - memcpy(dest, dest - dest_width, dest_width * sizeof(uint32_t)); - dest += dest_width; - continue; - } - for (j = 0; j < dest_width; j++) { - int col = (int)(x_scale * j); - *(dest++) = *(src + col); - } - prev_row = row; - src = (uint32_t *)((uint8_t *)src + src_stride); - } -} - -static inline void init_pattern(InternalPat *pat, int x_orign, int y_orign, const GLCImage *image) -{ - InternaCtx *ctx = pat->owner; - uint32_t *tmp_pixmap = NULL; - int width; - int height; - int width2; - int height2; - - const int pix_bytes = 4; - - ASSERT(image->format == GLC_IMAGE_RGB32); //for now - - width = image->width; - height = image->height; - width2 = gl_get_to_power_two(width); - height2 = gl_get_to_power_two(height); - - ASSERT(width > 0 && height > 0); - ASSERT(width > 0 && width <= pat->owner->max_texture_size); - ASSERT(height > 0 && height <= pat->owner->max_texture_size); - - if (width2 != width || height2 != height) { - tmp_pixmap = (uint32_t *)spice_malloc(width2 * height2 * sizeof(uint32_t)); - scale(tmp_pixmap, width2, height2, (uint32_t *)image->pixels, width, height, image->stride); - } - - glBindTexture(GL_TEXTURE_2D, pat->texture); - - //glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - - if (tmp_pixmap) { - glPixelStorei(GL_UNPACK_ROW_LENGTH, width2); - glTexImage2D(GL_TEXTURE_2D, 0, 4, width2, height2, 0, GL_BGRA, GL_UNSIGNED_BYTE, - tmp_pixmap); - free(tmp_pixmap); - } else { - ASSERT(image->stride % pix_bytes == 0); - glPixelStorei(GL_UNPACK_ROW_LENGTH, image->stride / pix_bytes); - glTexImage2D(GL_TEXTURE_2D, 0, 4, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, - image->pixels); - } - - GLC_ERROR_TEST_FLUSH; - pat->x_orign = x_orign % width; - pat->y_orign = y_orign % height; - pat->width = width; - pat->height = height; - - if (ctx->pat == pat) { - set_pat(pat->owner, pat); - } else if (ctx->pat) { - glBindTexture(GL_TEXTURE_2D, ctx->pat->texture); - } -} - -GLCPattern glc_pattern_create(GLCCtx glc, int x_orign, int y_orign, const GLCImage *image) -{ - InternaCtx *ctx = (InternaCtx *)glc; - InternalPat *pat; - - ASSERT(ctx && image); - - pat = spice_new0(InternalPat, 1); - pat->refs = 1; - pat->owner = ctx; - glGenTextures(1, &pat->texture); - init_pattern(pat, x_orign, y_orign, image); - return pat; -} - -void glc_pattern_set(GLCPattern pattern, int x_orign, int y_orign, const GLCImage *image) -{ - InternalPat *pat = (InternalPat *)pattern; - ASSERT(pat && pat->owner); - - glFinish(); - init_pattern(pat, x_orign, y_orign, image); -} - -void glc_pattern_destroy(GLCPattern pat) -{ - unref_pat((InternalPat *)pat); - GLC_ERROR_TEST_FLUSH; -} - -static void set_pat(InternaCtx *ctx, InternalPat *pat) -{ - pat = ref_pat(pat); - unref_pat(ctx->pat); - ctx->pat = pat; - - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, pat->texture); - - GLfloat s_gen_params[] = { (GLfloat)1.0 / pat->width, 0, 0, 0 }; - GLfloat t_gen_params[] = { 0, (GLfloat)1.0 / (GLfloat)pat->height, 0, 0 }; - glTexGenfv(GL_S, GL_OBJECT_PLANE, s_gen_params); - glTexGenfv(GL_T, GL_OBJECT_PLANE, t_gen_params); - - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glTranslatef((float)pat->x_orign / pat->width, (float)Y(pat->y_orign) / pat->height, 0); - GLC_ERROR_TEST_FLUSH; -} - -void glc_set_pattern(GLCCtx glc, GLCPattern pattern) -{ - InternaCtx *ctx = (InternaCtx *)glc; - InternalPat *pat = (InternalPat *)pattern; - - ASSERT(ctx && pat && pat->owner == ctx); - set_pat(ctx, pat); -} - -void glc_set_rgb(GLCCtx glc, double red, double green, double blue) -{ - InternaCtx *ctx = (InternaCtx *)glc; - - ASSERT(ctx); - - glDisable(GL_TEXTURE_2D); - unref_pat(ctx->pat); - ctx->pat = NULL; - glColor4d(red, green, blue, 1); - GLC_ERROR_TEST_FLUSH; -} - -void glc_set_op(GLCCtx glc, GLCOp op) -{ - if (op == GL_COPY) { - glDisable(GL_COLOR_LOGIC_OP); - return; - } - glLogicOp(op); - glEnable(GL_COLOR_LOGIC_OP); -} - -void glc_set_line_width(GLCCtx glc, double width) -{ - InternaCtx *ctx = (InternaCtx *)glc; - - ASSERT(ctx); - ctx->line_width = (GLfloat)width; - if (ctx->line_width > 0) { - glLineWidth(ctx->line_width); - } else { - ctx->line_width = 0; - } - GLC_ERROR_TEST_FLUSH; -} - -void glc_set_line_dash(GLCCtx glc, const double *dashes, int num_dashes, double offset) -{ - InternaCtx *ctx = (InternaCtx *)glc; - - ASSERT(ctx); - if (dashes && num_dashes >= 0 && offset >= 0) { - ctx->line_dash.dashes = spice_new(double, num_dashes); - memcpy(ctx->line_dash.dashes, dashes, sizeof(double) * num_dashes); - ctx->line_dash.num_dashes = num_dashes; - ctx->line_dash.offset = offset; - ctx->line_dash.cur_dash = offset ? -1 : 0; - ctx->line_dash.dash_pos = 0; - } else { - free(ctx->line_dash.dashes); - memset(&ctx->line_dash, 0, sizeof(ctx->line_dash)); - } -} - -void glc_set_fill_mode(GLCCtx glc, GLCFillMode fill_mode) -{ - InternaCtx *ctx = (InternaCtx *)glc; - - ASSERT(ctx); - int mode; - switch (fill_mode) { - case GLC_FILL_MODE_WINDING_ODD: - mode = GLU_TESS_WINDING_ODD; - break; - case GLC_FILL_MODE_WINDING_NONZERO: - mode = GLU_TESS_WINDING_NONZERO; - break; - default: - //warn - return; - } - gluTessProperty(ctx->tesselator, GLU_TESS_WINDING_RULE, mode); -} - -static inline void add_stencil_client(InternaCtx *ctx) -{ - if (!ctx->stencil_refs) { - glEnable(GL_STENCIL_TEST); - } - ctx->stencil_refs++; -} - -static inline void remove_stencil_client(InternaCtx *ctx) -{ - ctx->stencil_refs--; - if (!ctx->stencil_refs) { - glDisable(GL_STENCIL_TEST); - } -} - -void glc_set_mask(GLCCtx glc, int x_dest, int y_dest, int width, int height, - int stride, const uint8_t *bitmap, GLCMaskID id) -{ - InternaCtx *ctx = (InternaCtx *)glc; - uint32_t mask = (id == GLC_MASK_A) ? 0x04 : 0x08; - ASSERT(ctx && bitmap); - ASSERT(id == GLC_MASK_A || id == GLC_MASK_B); - - if (ctx->pat) { - glDisable(GL_TEXTURE_2D); - } - - glDisable(GL_BLEND); - - if (!(ctx->stencil_mask & mask)) { - add_stencil_client(ctx); - ctx->stencil_mask |= mask; - } - - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - ctx->draw_mode = FALSE; - glStencilMask(mask); - glClear(GL_STENCIL_BUFFER_BIT); - - glStencilFunc(GL_ALWAYS, mask, mask); - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - fill_mask(ctx, x_dest, y_dest, width, height, stride, bitmap); -} - -void glc_mask_rects(GLCCtx glc, int num_rect, GLCRect *rects, GLCMaskID id) -{ - InternaCtx *ctx = (InternaCtx *)glc; - uint32_t mask = (id == GLC_MASK_A) ? 0x04 : 0x08; - GLCRect *end; - ASSERT(ctx && rects); - ASSERT(id == GLC_MASK_A || id == GLC_MASK_B); - - if (ctx->pat) { - glDisable(GL_TEXTURE_2D); - } - - glDisable(GL_BLEND); - - if (!(ctx->stencil_mask & mask)) { - add_stencil_client(ctx); - ctx->stencil_mask |= mask; - } - - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - ctx->draw_mode = FALSE; - glStencilMask(mask); - glClear(GL_STENCIL_BUFFER_BIT); - - glStencilFunc(GL_ALWAYS, mask, mask); - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - end = rects + num_rect; - for (; rects < end; rects++) { - fill_rect(ctx, rects); - } -} - -void glc_clear_mask(GLCCtx glc, GLCMaskID id) -{ - InternaCtx *ctx = (InternaCtx *)glc; - uint32_t mask = (id == GLC_MASK_A) ? 0x04 : 0x08; - ASSERT(ctx); - ASSERT(id == GLC_MASK_A || id == GLC_MASK_B); - - if ((ctx->stencil_mask & mask)) { - ctx->stencil_mask &= ~mask; - remove_stencil_client(ctx); - } -} - -void glc_clip_reset(GLCCtx glc) -{ - InternaCtx *ctx = (InternaCtx *)glc; - - if (!(ctx->stencil_mask & 0x03)) { - return; - } - remove_stencil_client(ctx); - ctx->stencil_mask &= ~0x03; - glStencilMask(0x03); - glClear(GL_STENCIL_BUFFER_BIT); - GLC_ERROR_TEST_FLUSH; -} - -static void clip_common(InternaCtx *ctx, GLCClipOp op, void (*fill_func)(InternaCtx *, void *), - void *data) -{ - int stencil_val; - - if (ctx->pat) { - glDisable(GL_TEXTURE_2D); - } - glDisable(GL_BLEND); - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - ctx->draw_mode = FALSE; - - if (op == GLC_CLIP_OP_SET) { - glc_clip_reset(ctx); - add_stencil_client(ctx); - ctx->stencil_mask |= 0x01; - } else if (!(ctx->stencil_mask & 0x03)) { - GLCRect area; - if (op == GLC_CLIP_OP_OR) { - return; - } - area.x = area.y = 0; - area.width = ctx->width; - area.height = ctx->height; - clip_common(ctx, GLC_CLIP_OP_SET, fill_rect, &area); - } - glStencilMask(0x03); - switch (op) { - case GLC_CLIP_OP_SET: - case GLC_CLIP_OP_OR: - stencil_val = ctx->stencil_mask & 0x03; - glStencilFunc(GL_ALWAYS, stencil_val, stencil_val); - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - fill_func(ctx, data); - break; - case GLC_CLIP_OP_AND: { - int clear_mask; - stencil_val = ctx->stencil_mask & 0x03; - glStencilFunc(GL_EQUAL, stencil_val, stencil_val); - if (stencil_val == 0x01) { - glStencilOp(GL_ZERO, GL_INCR, GL_INCR); - stencil_val = 0x02; - clear_mask = 0x01; - } else { - glStencilOp(GL_ZERO, GL_DECR, GL_DECR); - stencil_val = 0x01; - clear_mask = 0x02; - } - fill_func(ctx, data); - - glStencilMask(clear_mask); - glClear(GL_STENCIL_BUFFER_BIT); - ctx->stencil_mask = (ctx->stencil_mask & ~clear_mask) | stencil_val; - break; - } - case GLC_CLIP_OP_EXCLUDE: - stencil_val = ctx->stencil_mask & 0x03; - glStencilFunc(GL_EQUAL, stencil_val, stencil_val); - glStencilOp(GL_KEEP, GL_ZERO, GL_ZERO); - fill_func(ctx, data); - break; - } - GLC_ERROR_TEST_FLUSH; -} - -void glc_clip_rect(GLCCtx glc, const GLCRect *rect, GLCClipOp op) -{ - InternaCtx *ctx = (InternaCtx *)glc; - - ASSERT(ctx && rect); - clip_common(ctx, op, fill_rect, (void *)rect); -} - -void glc_clip_path(GLCCtx glc, GLCPath path, GLCClipOp op) -{ - InternaCtx *ctx = (InternaCtx *)glc; - - ASSERT(ctx && path); - clip_common(ctx, op, fill_path, path); -} - -typedef struct FillMaskInfo { - int x_dest; - int y_dest; - int width; - int height; - int stride; - const uint8_t *bitmap; -} FillMaskInfo; - -static void __fill_mask(InternaCtx *ctx, void *data) -{ - FillMaskInfo *info = (FillMaskInfo *)data; - fill_mask(ctx, info->x_dest, info->y_dest, info->width, info->height, info->stride, - info->bitmap); -} - -void glc_clip_mask(GLCCtx glc, int x_dest, int y_dest, int width, int height, - int stride, const uint8_t *bitmap, GLCClipOp op) -{ - InternaCtx *ctx = (InternaCtx *)glc; - FillMaskInfo mask_info; - - ASSERT(ctx && bitmap); - mask_info.x_dest = x_dest; - mask_info.y_dest = y_dest; - mask_info.width = width; - mask_info.height = height; - mask_info.stride = stride; - mask_info.bitmap = bitmap; - clip_common(ctx, op, __fill_mask, &mask_info); -} - -static inline void start_draw(InternaCtx *ctx) -{ - if (ctx->draw_mode) { - return; - } - ctx->draw_mode = TRUE; - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glStencilFunc(GL_EQUAL, ctx->stencil_mask, ctx->stencil_mask); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - if (ctx->pat) { - glEnable(GL_TEXTURE_2D); - } else { - glDisable(GL_TEXTURE_2D); - } - GLC_ERROR_TEST_FLUSH; -} - -static void fill_rect(InternaCtx *ctx, void *r) -{ - GLCRect *rect = (GLCRect *)r; - glRectd(rect->x, Y(rect->y), rect->x + rect->width, Y(rect->y + rect->height)); - /*glBegin(GL_POLYGON); - VERTEX2(rect->x, rect->y); - VERTEX2 (rect->x + rect->width, rect->y); - VERTEX2 (rect->x + rect->width, rect->y + rect->height); - VERTEX2 (rect->x , rect->y + rect->height); - glEnd();*/ - GLC_ERROR_TEST_FLUSH; -} - -void glc_fill_rect(GLCCtx glc, const GLCRect *rect) -{ - InternaCtx *ctx = (InternaCtx *)glc; - GLCRect *r = (GLCRect *)rect; // to avoid bugs in gcc older than 4.3 - - ASSERT(ctx); - start_draw(ctx); - fill_rect(ctx, (void *)r); - GLC_ERROR_TEST_FLUSH; -} - -static void fill_path(InternaCtx *ctx, void *p) -{ - InternalPath *path = (InternalPath *)p; - - PathPoint *current_point = path->points; - PathSegment *current_segment = path->segments; - Path *current_path = path->paths; - Path *end_path = current_path + path->paths_pos; - reset_tass_vertex(ctx); - gluTessBeginPolygon(ctx->tesselator, ctx); - for (; current_path < end_path; current_path++) { - gluTessBeginContour(ctx->tesselator); - PathSegment *end_segment = current_segment + current_path->num_segments; - gluTessVertex(ctx->tesselator, (GLdouble *)current_point, current_point); - current_point++; - for (; current_segment < end_segment; current_segment++) { - PathPoint *end_point; - if (current_segment->type == GLC_PATH_SEG_BEIZER) { - end_point = current_point + current_segment->count * 3; - for (; current_point < end_point; current_point += 3) { - TassVertex *vertex = bezier_flattener(ctx, current_point - 1); - while (vertex) { - gluTessVertex(ctx->tesselator, (GLdouble *)&vertex->point, - (GLdouble *)&vertex->point); - vertex = vertex->list_link; - } - gluTessVertex(ctx->tesselator, (GLdouble *)¤t_point[2], - (GLdouble *)¤t_point[2]); - } - } else { - ASSERT(current_segment->type == GLC_PATH_SEG_LINES); - end_point = current_point + current_segment->count; - for (; current_point < end_point; current_point++) { - gluTessVertex(ctx->tesselator, (GLdouble *)current_point, - (GLdouble *)current_point); - } - } - } - gluTessEndContour(ctx->tesselator); - } - gluTessEndPolygon(ctx->tesselator); -} - -void glc_fill_path(GLCCtx glc, GLCPath path_ref) -{ - InternaCtx *ctx = (InternaCtx *)glc; - - ASSERT(ctx && path_ref); - start_draw(ctx); - fill_path(ctx, path_ref); -} - -static void fill_mask(InternaCtx *ctx, int x_dest, int y_dest, int width, int height, - int stride, const uint8_t *bitmap) -{ - set_raster_pos(ctx, x_dest, y_dest + height); - glPixelStorei(GL_UNPACK_ROW_LENGTH, stride * 8); - glBitmap(width, height, 0, 0, 0, 0, bitmap); -} - -void _glc_fill_mask(GLCCtx glc, int x_dest, int y_dest, int width, int height, int stride, - const uint8_t *bitmap) -{ - InternaCtx *ctx = (InternaCtx *)glc; - - ASSERT(ctx && bitmap); - start_draw(ctx); - if (ctx->pat) { - WARN_ONCE(("%s: unimplemented fill mask with pattern\n", __FUNCTION__)); - } - fill_mask(ctx, x_dest, y_dest, width, height, stride, bitmap); -} - -void glc_fill_alpha(GLCCtx glc, int x_dest, int y_dest, int width, int height, int stride, - const uint8_t *alpha_mask) -{ - InternaCtx *ctx = (InternaCtx *)glc; - GLCRect r; - - ASSERT(ctx); - start_draw(ctx); - - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); - set_raster_pos(ctx, x_dest, y_dest + height); - glPixelStorei(GL_UNPACK_ROW_LENGTH, stride); - glPixelZoom(1, 1); - glDrawPixels(width, height, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_mask); - - r.x = x_dest; - r.y = y_dest; - r.width = width; - r.height = height; - - //todo: support color/texture alpah vals (GL_MODULATE) - glEnable(GL_BLEND); - glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - fill_rect(ctx, &r); - glDisable(GL_BLEND); -} - -void glc_stroke_rect(GLCCtx glc, const GLCRect *rect) -{ - InternaCtx *ctx = (InternaCtx *)glc; - - ASSERT(ctx); - if (ctx->line_width == 0) { - return; - } - - start_draw(ctx); - - glBegin(GL_LINES); - VERTEX2(rect->x, rect->y + 0.5); - VERTEX2(rect->x + rect->width, rect->y + 0.5); - VERTEX2(rect->x + rect->width - 0.5, rect->y); - VERTEX2(rect->x + rect->width - 0.5, rect->y + rect->height); - VERTEX2(rect->x + rect->width, rect->y + rect->height - 0.5); - VERTEX2(rect->x, rect->y + rect->height - 0.5); - VERTEX2(rect->x + 0.5, rect->y + rect->height); - VERTEX2(rect->x + 0.5, rect->y); - glEnd(); - GLC_ERROR_TEST_FLUSH; -} - -static void glc_stroke_line(double x1, double y1, double x2, double y2, double width) -{ - double ax, ay, bx, by, cx, cy, dx, dy; - double norm, tx; - - if (width == 1 || y1 == y2 || x1 == x2) { - glBegin(GL_LINES); - glVertex2d(x1, y1); - glVertex2d(x2, y2); - glEnd(); - return; - } - norm = (x1 - x2) / (y2 - y1); - tx = width / (2 * sqrt(1 + norm * norm)); - ax = x1 + tx; - ay = y1 + norm * (ax - x1); - bx = x2 + tx; - by = y2 + norm * (bx - x2); - cx = x2 - tx; - cy = y2 + norm * (cx - x2); - dx = x1 - tx; - dy = y1 + norm * (dx - x1); - glBegin(GL_POLYGON); - glVertex2d(ax, ay); - glVertex2d(bx, by); - glVertex2d(cx, cy); - glVertex2d(dx, dy); - glEnd(); -} - -static double glc_stroke_line_dash(double x1, double y1, double x2, double y2, - double width, LineDash *dash) -{ - double ax, ay, bx, by; - double mx, my, len; - double dash_len, total = 0; - - len = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)); - if (!dash->dashes || !dash->num_dashes) { - glc_stroke_line(x1, y1, x2, y2, width); - return len; - } - mx = (x2 - x1) / len; - my = (y2 - y1) / len; - ax = x1; - ay = y1; - while (total < len) { - if (dash->cur_dash >= 0) { - dash_len = dash->dashes[dash->cur_dash % dash->num_dashes] - dash->dash_pos; - } else { - dash_len = dash->offset - dash->dash_pos; - } - total += dash_len; - if (total < len) { - bx = x1 + mx * total; - by = y1 + my * total; - dash->dash_pos = 0; - } else { - bx = x2; - by = y2; - dash->dash_pos = dash->dashes[dash->cur_dash % dash->num_dashes] - (total - len); - } - if (dash->cur_dash % 2 == 0) { - glc_stroke_line(ax, ay, bx, by, width); - } - if (dash->dash_pos == 0) { - dash->cur_dash = (dash->cur_dash + 1) % (2 * dash->num_dashes); - } - ax = bx; - ay = by; - } - return len; -} - -static void glc_vertex2d(InternaCtx *ctx, double x, double y) -{ - double len; - if (ctx->path_stroke.state == GLC_STROKE_ACTIVE) { - len = glc_stroke_line_dash(ctx->path_stroke.x, ctx->path_stroke.y, x, y, - ctx->line_width, &ctx->line_dash); - ctx->path_stroke.x = x; - ctx->path_stroke.y = y; - } else if (ctx->path_stroke.state == GLC_STROKE_FIRST) { - ctx->path_stroke.x = x; - ctx->path_stroke.y = y; - ctx->path_stroke.state = GLC_STROKE_ACTIVE; - } else { - ASSERT(ctx->path_stroke.state == GLC_STROKE_NONACTIVE); - //error - } -} - -static void glc_begin_path(InternaCtx *ctx) -{ - ctx->path_stroke.state = GLC_STROKE_FIRST; - ctx->line_dash.cur_dash = ctx->line_dash.offset ? -1 : 0; - ctx->line_dash.dash_pos = 0; -} - -static void glc_end_path(InternaCtx *ctx) -{ - ctx->path_stroke.state = GLC_STROKE_NONACTIVE; -} - -void glc_stroke_path(GLCCtx glc, GLCPath path_ref) -{ - InternaCtx *ctx = (InternaCtx *)glc; - InternalPath *path = (InternalPath *)path_ref; - - ASSERT(ctx && path); - if (ctx->line_width == 0) { - return; - } - start_draw(ctx); - - reset_tass_vertex(ctx); - PathPoint *current_point = path->points; - PathSegment *current_segment = path->segments; - Path *current_path = path->paths; - Path *end_path = current_path + path->paths_pos; - for (; current_path < end_path; current_path++) { - glc_begin_path(ctx); - PathSegment *end_segment = current_segment + current_path->num_segments; - glc_vertex2d(ctx, current_point->x, current_point->y); - current_point++; - for (; current_segment < end_segment; current_segment++) { - PathPoint *end_point; - if (current_segment->type == GLC_PATH_SEG_BEIZER) { - end_point = current_point + current_segment->count * 3; - for (; current_point < end_point; current_point += 3) { - TassVertex *vertex = bezier_flattener(ctx, current_point - 1); - while (vertex) { - glc_vertex2d(ctx, vertex->point.x, vertex->point.y); - vertex = vertex->list_link; - } - glc_vertex2d(ctx, current_point[2].x, current_point[2].y); - } - } else { - ASSERT(current_segment->type == GLC_PATH_SEG_LINES); - end_point = current_point + current_segment->count; - for (; current_point < end_point; current_point++) { - glc_vertex2d(ctx, current_point->x, current_point->y); - } - } - } - glc_end_path(ctx); - } -} - -void glc_draw_image(GLCCtx glc, const GLCRecti *dest, const GLCRecti *src, const GLCImage *image, - int scale_mode, double alpha) -{ - InternaCtx *ctx = (InternaCtx *)glc; - uint8_t *pixels; - const int pix_bytes = 4; - - ASSERT(ctx && image); - ASSERT(src->width > 0 && src->height > 0); - - ASSERT(image->format == GLC_IMAGE_RGB32 || image->format == GLC_IMAGE_ARGB32); //for now - start_draw(ctx); - if (ctx->pat) { - glDisable(GL_TEXTURE_2D); - } - set_raster_pos(ctx, dest->x, dest->y + dest->height); - - if (dest->width == src->width && src->height == dest->height) { - glPixelZoom(1, 1); - } else { - glPixelZoom((float)dest->width / src->width, (float)dest->height / src->height); - } - - pixels = image->pixels + src->x * 4 + (image->height - (src->y + src->height)) * image->stride; - if (image->format == GLC_IMAGE_ARGB32 || alpha != 1) { - glPixelTransferf(GL_ALPHA_SCALE, (GLfloat)alpha); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - } - ASSERT(image->stride % pix_bytes == 0); - glPixelStorei(GL_UNPACK_ROW_LENGTH, image->stride / pix_bytes); - glDrawPixels(src->width, src->height, GL_BGRA, GL_UNSIGNED_BYTE, pixels); - - if (image->format == GLC_IMAGE_ARGB32 || alpha != 1) { - glDisable(GL_BLEND); - } - - if (ctx->pat) { - glEnable(GL_TEXTURE_2D); - } - GLC_ERROR_TEST_FLUSH; -} - -void glc_copy_pixels(GLCCtx glc, int x_dest, int y_dest, int x_src, int y_src, int width, - int height) -{ - InternaCtx *ctx = (InternaCtx *)glc; - int recreate = 0; - - ASSERT(ctx); -#ifdef USE_COPY_PIXELS - start_draw(ctx); - if (ctx->pat) { - glDisable(GL_TEXTURE_2D); - } - set_raster_pos(ctx, x_dest, y_dest + height); - glPixelZoom(1, 1); - glCopyPixels(x_src, ctx->height - (y_src + height), width, height, GL_COLOR); - if (ctx->pat) { - glEnable(GL_TEXTURE_2D); - } -#else - int width2 = gl_get_to_power_two(width); - int height2 = gl_get_to_power_two(height); - - start_draw(ctx); - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, 0); - - if (width2 > ctx->private_tex_width) { - ctx->private_tex_width = width2; - recreate = 1; - } - if (height2 > ctx->private_tex_height) { - ctx->private_tex_height = height2; - recreate = 1; - } - if (recreate) { - glDeleteTextures(1, &ctx->private_tex); - glGenTextures(1, &ctx->private_tex); - glBindTexture(GL_TEXTURE_2D, ctx->private_tex); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - ctx->private_tex_width = gl_get_to_power_two(width); - ctx->private_tex_height = gl_get_to_power_two(height); - glTexImage2D(GL_TEXTURE_2D, 0, 4, ctx->private_tex_width, - ctx->private_tex_height, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); - } - ASSERT(ctx->private_tex); - glBindTexture(GL_TEXTURE_2D, ctx->private_tex); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, x_src, ctx->height - (y_src + height), - width2, height2, 0); - - GLfloat s_gen_params[] = { (GLfloat)1.0 / width2, 0, 0, 0 }; - GLfloat t_gen_params[] = { 0, (GLfloat)1.0 / height2, 0, 0 }; - glTexGenfv(GL_S, GL_OBJECT_PLANE, s_gen_params); - glTexGenfv(GL_T, GL_OBJECT_PLANE, t_gen_params); - - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glTranslatef((float)-x_dest / width2, (float)-Y(y_dest + height) / height2, 0); - - glRecti(x_dest, Y(y_dest), x_dest + width, Y(y_dest + height)); - glFlush(); - if (!ctx->pat) { - glDisable(GL_TEXTURE_2D); - } else { - set_pat(ctx, ctx->pat); - } -#endif - GLC_ERROR_TEST_FLUSH; -} - -void glc_read_pixels(GLCCtx glc, int x, int y, GLCImage *image) -{ - InternaCtx *ctx = (InternaCtx *)glc; - - ASSERT(ctx && image); - ASSERT(image->format == GLC_IMAGE_RGB32); //for now - ASSERT((image->stride % 4) == 0); //for now - glPixelStorei(GL_PACK_ROW_LENGTH, image->stride / 4); - glReadPixels(x, ctx->height - (y + image->height), image->width, image->height, - GL_BGRA, GL_UNSIGNED_BYTE, image->pixels); -} - -void glc_clear(GLCCtx glc) -{ - InternaCtx *ctx = (InternaCtx *)glc; - - ASSERT(ctx); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glClear(GL_COLOR_BUFFER_BIT); -} - -void glc_flush(GLCCtx glc) -{ - glFlush(); - - GLC_ERROR_TEST_FLUSH; -} - -static void tessellation_combine(GLdouble coords[3], GLdouble *vertex_data[4], GLfloat weight[4], - GLdouble **data_out, void *usr_data) -{ - TassVertex *vertex; - - vertex = alloc_tess_vertex((InternaCtx *)usr_data); - vertex->point.x = coords[0]; - vertex->point.y = coords[1]; - //vertex->point.z = coords[2]; - *data_out = (GLdouble *)&vertex->point; -} - -static void tessellation_error(GLenum errorCode) -{ - printf("%s: %s\n", __FUNCTION__, gluErrorString(errorCode)); -} - -#ifdef WIN32 -#define TESS_CALL_BACK_TYPE void(CALLBACK *)() -#else -#define TESS_CALL_BACK_TYPE void(*)() -#endif - -static int init(InternaCtx *ctx, int width, int height) -{ -#ifdef WIN32 - if (!(ctx->glBlendEquation = (PFNGLBLENDEQUATIONPROC)wglGetProcAddress("glBlendEquation"))) { - return FALSE; - } -#endif - ctx->width = width; - ctx->height = height; - ctx->line_width = 1; - - glClearColor(0, 0, 0, 0); - glClearStencil(0); - - if (!(ctx->tesselator = gluNewTess())) { - return FALSE; - } - - glGenTextures(1, &ctx->private_tex); - glBindTexture(GL_TEXTURE_2D, ctx->private_tex); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - glTexImage2D(GL_TEXTURE_2D, 0, 4, gl_get_to_power_two(width), - gl_get_to_power_two(height), 0, - GL_BGRA, GL_UNSIGNED_BYTE, NULL); - ctx->private_tex_width = gl_get_to_power_two(width); - ctx->private_tex_height = gl_get_to_power_two(height); - glBindTexture(GL_TEXTURE_2D, 0); - - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, width, 0, height, -1, 1); - - gluTessProperty(ctx->tesselator, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD); - gluTessCallback(ctx->tesselator, GLU_BEGIN, (TESS_CALL_BACK_TYPE)glBegin); - gluTessCallback(ctx->tesselator, GLU_VERTEX, (TESS_CALL_BACK_TYPE)glVertex3dv); - gluTessCallback(ctx->tesselator, GLU_END, (TESS_CALL_BACK_TYPE)glEnd); - gluTessCallback(ctx->tesselator, GLU_TESS_COMBINE_DATA, - (TESS_CALL_BACK_TYPE)tessellation_combine); - gluTessCallback(ctx->tesselator, GLU_TESS_ERROR, (TESS_CALL_BACK_TYPE)tessellation_error); - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0, (GLfloat)height, 0); - - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &ctx->max_texture_size); - - glPixelStorei(GL_PACK_ALIGNMENT, 1); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); - glPixelTransferf(GL_ALPHA_BIAS, 0); -#ifdef WIN32 - ctx->glBlendEquation(GL_FUNC_ADD); -#else - glBlendEquation(GL_FUNC_ADD); -#endif - - glStencilMask(0xff); - glClear(GL_STENCIL_BUFFER_BIT); - - glClear(GL_COLOR_BUFFER_BIT); - - return TRUE; -} - -GLCCtx glc_create(int width, int height) -{ - InternaCtx *ctx; - - ASSERT(sizeof(PathPoint) == sizeof(Vertex)); - - ctx = spice_new0(InternaCtx, 1); - if (!init(ctx, width, height)) { - free(ctx); - return NULL; - } - return ctx; -} - -/* - * In glx video mode change the textures will be destroyed, therefore - * if we will try to glDeleteTextures() them we might get seagfault. - * (this why we use the textures_lost parameter) - */ -void glc_destroy(GLCCtx glc, int textures_lost) -{ - InternaCtx *ctx; - - if (!(ctx = (InternaCtx *)glc)) { - return; - } - - if (!textures_lost) { - unref_pat(ctx->pat); - ctx->pat = NULL; - if (ctx->private_tex) { - glDeleteTextures(1, &ctx->private_tex); - } - } - - free_tass_vertex_bufs(ctx); - free(ctx->line_dash.dashes); - free(ctx); - GLC_ERROR_TEST_FINISH; -} - -/* - todo: - 1. test double vs float in gl calls - 2. int vs flat raster position - 3. pixels stride vs bytes stride - 4. improve non power of two. - glGetString(GL_EXTENSIONS); - ARB_texture_non_power_of_two - ARB_texture_rectangle - GL_TEXTURE_RECTANGLE_ARB - 5. scale - 6. origin - 7. fonts - 8. support more image formats - 9. use GLCImage in mask ops? -*/ - diff -Nru spice-gtk-0.9/common/glc.h spice-gtk-0.12/common/glc.h --- spice-gtk-0.9/common/glc.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/glc.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,159 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef _H_GL_CANVASE -#define _H_GL_CANVASE - -#include - -typedef void * GLCCtx; -typedef void * GLCPattern; -typedef void * GLCPath; - -typedef struct GLCRect { - double x; - double y; - double width; - double height; -} GLCRect; - -typedef struct GLCRecti { - int x; - int y; - int width; - int height; -} GLCRecti; - -typedef enum { - GLC_IMAGE_RGB32, - GLC_IMAGE_ARGB32, -} GLCImageFormat; - -typedef struct GLCPImage { - GLCImageFormat format; - int width; - int height; - int stride; - uint8_t *pixels; - uint32_t *pallet; -} GLCImage; - -GLCPattern glc_pattern_create(GLCCtx glc, int x_orign, int y_orign, const GLCImage *image); -void glc_pattern_set(GLCPattern pattern, int x_orign, int y_orign, const GLCImage *image); -void glc_pattern_destroy(GLCPattern pattern); - -void glc_path_move_to(GLCPath path, double x, double y); -void glc_path_line_to(GLCPath path, double x, double y); -void glc_path_curve_to(GLCPath path, double p1_x, double p1_y, double p2_x, double p2_y, - double p3_x, double p3_y); -void glc_path_rel_move_to(GLCPath path, double x, double y); -void glc_path_rel_line_to(GLCPath path, double x, double y); -void glc_path_rel_curve_to(GLCPath path, double p1_x, double p1_y, double p2_x, double p2_y, - double p3_x, double p3_y); -void glc_path_close(GLCPath path); - -void glc_path_cleare(GLCPath); -GLCPath glc_path_create(GLCCtx glc); -void glc_path_destroy(GLCPath path); - -void glc_set_rgb(GLCCtx glc, double red, double green, double blue); -void glc_set_rgba(GLCCtx glc, double red, double green, double blue, double alpha); -void glc_set_pattern(GLCCtx glc, GLCPattern pattern); - -typedef enum { - GLC_OP_CLEAR = 0x1500, - GLC_OP_SET = 0x150F, - GLC_OP_COPY = 0x1503, - GLC_OP_COPY_INVERTED = 0x150C, - GLC_OP_NOOP = 0x1505, - GLC_OP_INVERT = 0x150A, - GLC_OP_AND = 0x1501, - GLC_OP_NAND = 0x150E, - GLC_OP_OR = 0x1507, - GLC_OP_NOR = 0x1508, - GLC_OP_XOR = 0x1506, - GLC_OP_EQUIV = 0x1509, - GLC_OP_AND_REVERSE = 0x1502, - GLC_OP_AND_INVERTED = 0x1504, - GLC_OP_OR_REVERSE = 0x150B, - GLC_OP_OR_INVERTED = 0x150D, -} GLCOp; - -void glc_set_op(GLCCtx glc, GLCOp op); -void glc_set_alpha_factor(GLCCtx glc, double alpah); - -typedef enum { - GLC_FILL_MODE_WINDING_ODD, - GLC_FILL_MODE_WINDING_NONZERO, -} GLCFillMode; - -void glc_set_fill_mode(GLCCtx glc, GLCFillMode mode); -void glc_set_line_width(GLCCtx glc, double width); -void glc_set_line_end_cap(GLCCtx glc, int style); -void glc_set_line_join(GLCCtx glc, int style); -void glc_set_miter_limit(GLCCtx glc, int limit); -void glc_set_line_dash(GLCCtx glc, const double *dashes, int num_dashes, double offset); - -typedef enum { - GLC_MASK_A, - GLC_MASK_B, -} GLCMaskID; - -void glc_set_mask(GLCCtx glc, int x_dest, int y_dest, int width, int height, - int stride, const uint8_t *bitmap, GLCMaskID id); -void glc_mask_rects(GLCCtx glc, int num_rect, GLCRect *rects, GLCMaskID id); -void glc_clear_mask(GLCCtx glc, GLCMaskID id); - -typedef enum { - GLC_CLIP_OP_SET, - GLC_CLIP_OP_OR, - GLC_CLIP_OP_AND, - GLC_CLIP_OP_EXCLUDE, -} GLCClipOp; - -void glc_clip_rect(GLCCtx glc, const GLCRect *rect, GLCClipOp op); -void glc_clip_path(GLCCtx glc, GLCPath path, GLCClipOp op); -void glc_clip_mask(GLCCtx glc, int x_dest, int y_dest, int width, int height, int stride, - const uint8_t *bitmap, GLCClipOp op); -void glc_clip_reset(GLCCtx glc); - -void glc_fill_rect(GLCCtx glc, const GLCRect *rect); -void glc_fill_path(GLCCtx glc, GLCPath path); -void _glc_fill_mask(GLCCtx glc, int x_dest, int y_dest, int width, int height, int stride, - const uint8_t *bitmap); -void glc_fill_alpha(GLCCtx glc, int x_dest, int y_dest, int width, int height, int stride, - const uint8_t *alpha_mask); - -void glc_stroke_rect(GLCCtx glc, const GLCRect *rect); -void glc_stroke_path(GLCCtx glc, GLCPath path); - -void glc_draw_image(GLCCtx glc, const GLCRecti *dest, const GLCRecti *src, const GLCImage *image, - int scale_mode, double alpha); - -void glc_copy_pixels(GLCCtx glc, int x_dest, int y_dest, int x_src, int y_src, int width, - int height); -void glc_read_pixels(GLCCtx glc, int x, int y, GLCImage *image); - -void glc_flush(GLCCtx glc); -void glc_clear(GLCCtx glc); -GLCCtx glc_create(int width, int height); -void glc_destroy(GLCCtx glc, int textures_lost); - -#endif diff -Nru spice-gtk-0.9/common/gl_utils.h spice-gtk-0.12/common/gl_utils.h --- spice-gtk-0.9/common/gl_utils.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/gl_utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef GL_UTILS_H -#define GL_UTILS_H - -#ifdef RED_DEBUG -#define GLC_ERROR_TEST_FLUSH { \ - GLenum gl_err; glFlush(); \ - if ((gl_err = glGetError()) != GL_NO_ERROR) { \ - printf("%s[%d]: opengl error: %s\n", __FUNCTION__, __LINE__, \ - gluErrorString(gl_err)); \ - abort(); \ - } \ -} - -#define GLC_ERROR_TEST_FINISH { \ - GLenum gl_err; glFinish(); \ - if ((gl_err = glGetError()) != GL_NO_ERROR) { \ - printf("%s[%d]: opengl error: %s\n", __FUNCTION__, __LINE__, \ - gluErrorString(gl_err)); \ - abort(); \ - } \ -} -#else -#define GLC_ERROR_TEST_FLUSH ; - -#define GLC_ERROR_TEST_FINISH ; -#endif - -#ifdef WIN32 -static inline int find_msb(uint32_t val) -{ - uint32_t r; - __asm { - bsr eax, val - jnz found - mov eax, -1 - -found: - mov r, eax - } - return r + 1; -} - -#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) -static inline int find_msb(unsigned int val) -{ - int ret; - - asm ("bsrl %1,%0\n\t" - "jnz 1f\n\t" - "movl $-1,%0\n" - "1:" - : "=r"(ret) : "r"(val)); - return ret + 1; -} - -#else -static inline int find_msb(unsigned int val) -{ - signed char index = 31; - - if(val == 0) { - return 0; - } - - do { - if(val & 0x80000000) { - break; - } - val <<= 1; - } while(--index >= 0); - - return index+1; -} - -#endif - -static inline int gl_get_to_power_two(unsigned int val) -{ - if ((val & (val - 1)) == 0) { - return val; - } - return 1 << find_msb(val); -} - -#endif diff -Nru spice-gtk-0.9/common/lines.c spice-gtk-0.12/common/lines.c --- spice-gtk-0.9/common/lines.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/lines.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3618 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/*********************************************************** - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - - -#include -#include -#ifdef _XOPEN_SOURCE -#include -#else -#define _XOPEN_SOURCE /* to get prototype for hypot on some systems */ -#include -#undef _XOPEN_SOURCE -#endif -#include "lines.h" -#include "mem.h" - -#define xalloc(i) spice_malloc(i) -#define xrealloc(a,b) spice_realloc(a,b) -#define xfree(i) free(i) - -typedef unsigned int CARD32; -typedef int Boolean; -typedef pixman_rectangle32_t xRectangle; -typedef SpicePoint DDXPointRec; -typedef DDXPointRec *DDXPointPtr; -typedef struct lineGC *GCPtr; - -/* largest positive value that can fit into a component of a point. - * Assumes that the point structure is {type x, y;} where type is - * a signed type. - */ -#define MAX_COORDINATE 2147483647 -#define MIN_COORDINATE -2147483647 - -#define miZeroLine spice_canvas_zero_line -#define miZeroDashLine spice_canvas_zero_dash_line -#define miWideDash spice_canvas_wide_dash_line -#define miWideLine spice_canvas_wide_line - -static int inline -ICEIL (double x) -{ - int _cTmp = (int)x; - return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp + 1; -} - -typedef struct { - int count; /* number of spans */ - DDXPointPtr points; /* pointer to list of start points */ - int *widths; /* pointer to list of widths */ -} Spans; - -typedef struct { - int size; /* Total number of *Spans allocated */ - int count; /* Number of *Spans actually in group */ - Spans *group; /* List of Spans */ - int ymin, ymax; /* Min, max y values encountered */ -} SpanGroup; - -/* Initialize SpanGroup. MUST BE DONE before use. */ -static void miInitSpanGroup (SpanGroup * /*spanGroup */ - ); - -/* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */ -static void miAppendSpans (SpanGroup * /*spanGroup */ , - SpanGroup * /*otherGroup */ , - Spans * /*spans */ - ); - -/* Paint a span group, insuring that each pixel is painted at most once */ -static void miFillUniqueSpanGroup (GCPtr /*pGC */ , - SpanGroup * /*spanGroup */ , - Boolean /* foreground */ - ); - -/* Free up data in a span group. MUST BE DONE or you'll suffer memory leaks */ -static void miFreeSpanGroup (SpanGroup * /*spanGroup */ - ); - -/* Rops which must use span groups */ -#define miSpansCarefulRop(rop) (((rop) & 0xc) == 0x8 || ((rop) & 0x3) == 0x2) -#define miSpansEasyRop(rop) (!miSpansCarefulRop(rop)) - -/* - * Public definitions used for configuring basic pixelization aspects - * of the sample implementation line-drawing routines provided in - * {mfb,mi,cfb*} at run-time. - */ - -#define XDECREASING 4 -#define YDECREASING 2 -#define YMAJOR 1 - -#define OCTANT1 (1 << (YDECREASING)) -#define OCTANT2 (1 << (YDECREASING|YMAJOR)) -#define OCTANT3 (1 << (XDECREASING|YDECREASING|YMAJOR)) -#define OCTANT4 (1 << (XDECREASING|YDECREASING)) -#define OCTANT5 (1 << (XDECREASING)) -#define OCTANT6 (1 << (XDECREASING|YMAJOR)) -#define OCTANT7 (1 << (YMAJOR)) -#define OCTANT8 (1 << (0)) - -#define XMAJOROCTANTS (OCTANT1 | OCTANT4 | OCTANT5 | OCTANT8) - -#define DEFAULTZEROLINEBIAS (OCTANT2 | OCTANT3 | OCTANT4 | OCTANT5) - -/* - * Devices can configure the rendering of routines in mi, mfb, and cfb* - * by specifying a thin line bias to be applied to a particular screen - * using the following function. The bias parameter is an OR'ing of - * the appropriate OCTANT constants defined above to indicate which - * octants to bias a line to prefer an axial step when the Bresenham - * error term is exactly zero. The octants are mapped as follows: - * - * \ | / - * \ 3 | 2 / - * \ | / - * 4 \ | / 1 - * \|/ - * ----------- - * /|\ - * 5 / | \ 8 - * / | \ - * / 6 | 7 \ - * / | \ - * - * For more information, see "Ambiguities in Incremental Line Rastering," - * Jack E. Bresenham, IEEE CG&A, May 1987. - */ - -/* - * Private definitions needed for drawing thin (zero width) lines - * Used by the mi, mfb, and all cfb* components. - */ - -#define X_AXIS 0 -#define Y_AXIS 1 - -#define OUT_LEFT 0x08 -#define OUT_RIGHT 0x04 -#define OUT_ABOVE 0x02 -#define OUT_BELOW 0x01 - -#define OUTCODES(_result, _x, _y, _pbox) \ - if ( (_x) < (_pbox)->x1) (_result) |= OUT_LEFT; \ - else if ( (_x) >= (_pbox)->x2) (_result) |= OUT_RIGHT; \ - if ( (_y) < (_pbox)->y1) (_result) |= OUT_ABOVE; \ - else if ( (_y) >= (_pbox)->y2) (_result) |= OUT_BELOW; - -#define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \ -{\ - if (x < xmin) outcode |= OUT_LEFT;\ - if (x > xmax) outcode |= OUT_RIGHT;\ - if (y < ymin) outcode |= OUT_ABOVE;\ - if (y > ymax) outcode |= OUT_BELOW;\ -} - -#define SWAPINT(i, j) \ -{ int _t = i; i = j; j = _t; } - -#define SWAPPT(i, j) \ -{ DDXPointRec _t; _t = i; i = j; j = _t; } - -#define SWAPINT_PAIR(x1, y1, x2, y2)\ -{ int t = x1; x1 = x2; x2 = t;\ - t = y1; y1 = y2; y2 = t;\ -} - -#define miGetZeroLineBias(_pScreen) (DEFAULTZEROLINEBIAS) - -#define CalcLineDeltas(_x1,_y1,_x2,_y2,_adx,_ady,_sx,_sy,_SX,_SY,_octant) \ - (_octant) = 0; \ - (_sx) = (_SX); \ - if (((_adx) = (_x2) - (_x1)) < 0) { \ - (_adx) = -(_adx); \ - (_sx = -(_sx)); \ - (_octant) |= XDECREASING; \ - } \ - (_sy) = (_SY); \ - if (((_ady) = (_y2) - (_y1)) < 0) { \ - (_ady) = -(_ady); \ - (_sy = -(_sy)); \ - (_octant) |= YDECREASING; \ - } - -#define SetYMajorOctant(_octant) ((_octant) |= YMAJOR) - -#define FIXUP_ERROR(_e, _octant, _bias) \ - (_e) -= (((_bias) >> (_octant)) & 1) - -#define IsXMajorOctant(_octant) (!((_octant) & YMAJOR)) -#define IsYMajorOctant(_octant) ((_octant) & YMAJOR) -#define IsXDecreasingOctant(_octant) ((_octant) & XDECREASING) -#define IsYDecreasingOctant(_octant) ((_octant) & YDECREASING) - -static int miZeroClipLine (int /*xmin */ , - int /*ymin */ , - int /*xmax */ , - int /*ymax */ , - int * /*new_x1 */ , - int * /*new_y1 */ , - int * /*new_x2 */ , - int * /*new_y2 */ , - unsigned int /*adx */ , - unsigned int /*ady */ , - int * /*pt1_clipped */ , - int * /*pt2_clipped */ , - int /*octant */ , - unsigned int /*bias */ , - int /*oc1 */ , - int /*oc2 */ - ); - -/* - * interface data to span-merging polygon filler - */ - -typedef struct _SpanData { - SpanGroup fgGroup, bgGroup; -} SpanDataRec, *SpanDataPtr; - -#define AppendSpanGroup(pGC, foreground, spanPtr, spanData) { \ - SpanGroup *group, *othergroup = NULL; \ - if (foreground) \ - { \ - group = &spanData->fgGroup; \ - if (pGC->lineStyle == LineDoubleDash) \ - othergroup = &spanData->bgGroup; \ - } \ - else \ - { \ - group = &spanData->bgGroup; \ - othergroup = &spanData->fgGroup; \ - } \ - miAppendSpans (group, othergroup, spanPtr); \ -} - -/* - * Polygon edge description for integer wide-line routines - */ - -typedef struct _PolyEdge { - int height; /* number of scanlines to process */ - int x; /* starting x coordinate */ - int stepx; /* fixed integral dx */ - int signdx; /* variable dx sign */ - int e; /* initial error term */ - int dy; - int dx; -} PolyEdgeRec, *PolyEdgePtr; - -#define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - miter limit constant */ - -/* - * types for general polygon routines - */ - -typedef struct _PolyVertex { - double x, y; -} PolyVertexRec, *PolyVertexPtr; - -typedef struct _PolySlope { - int dx, dy; - double k; /* x0 * dy - y0 * dx */ -} PolySlopeRec, *PolySlopePtr; - -/* - * Line face description for caps/joins - */ - -typedef struct _LineFace { - double xa, ya; - int dx, dy; - int x, y; - double k; -} LineFaceRec, *LineFacePtr; - -/* - * macros for polygon fillers - */ - -#define MIPOLYRELOADLEFT if (!left_height && left_count) { \ - left_height = left->height; \ - left_x = left->x; \ - left_stepx = left->stepx; \ - left_signdx = left->signdx; \ - left_e = left->e; \ - left_dy = left->dy; \ - left_dx = left->dx; \ - --left_count; \ - ++left; \ - } - -#define MIPOLYRELOADRIGHT if (!right_height && right_count) { \ - right_height = right->height; \ - right_x = right->x; \ - right_stepx = right->stepx; \ - right_signdx = right->signdx; \ - right_e = right->e; \ - right_dy = right->dy; \ - right_dx = right->dx; \ - --right_count; \ - ++right; \ - } - -#define MIPOLYSTEPLEFT left_x += left_stepx; \ - left_e += left_dx; \ - if (left_e > 0) \ - { \ - left_x += left_signdx; \ - left_e -= left_dy; \ - } - -#define MIPOLYSTEPRIGHT right_x += right_stepx; \ - right_e += right_dx; \ - if (right_e > 0) \ - { \ - right_x += right_signdx; \ - right_e -= right_dy; \ - } - -static void miRoundJoinClip (LineFacePtr /*pLeft */ , - LineFacePtr /*pRight */ , - PolyEdgePtr /*edge1 */ , - PolyEdgePtr /*edge2 */ , - int * /*y1 */ , - int * /*y2 */ , - Boolean * /*left1 */ , - Boolean * /*left2 */ - ); - -static int miRoundCapClip (LineFacePtr /*face */ , - Boolean /*isInt */ , - PolyEdgePtr /*edge */ , - Boolean * /*leftEdge */ - ); - -static int miPolyBuildEdge (double x0, double y0, double k, int dx, int dy, - int xi, int yi, int left, PolyEdgePtr edge); -static int miPolyBuildPoly (PolyVertexPtr vertices, PolySlopePtr slopes, - int count, int xi, int yi, PolyEdgePtr left, - PolyEdgePtr right, int *pnleft, int *pnright, int *h); - - -static void -miStepDash (int dist, /* distance to step */ - int *pDashIndex, /* current dash */ - unsigned char *pDash, /* dash list */ - int numInDashList, /* total length of dash list */ - int *pDashOffset /* offset into current dash */ - ) -{ - int dashIndex, dashOffset; - int totallen; - int i; - - dashIndex = *pDashIndex; - dashOffset = *pDashOffset; - if (dist < pDash[dashIndex] - dashOffset) { - *pDashOffset = dashOffset + dist; - return; - } - dist -= pDash[dashIndex] - dashOffset; - if (++dashIndex == numInDashList) - dashIndex = 0; - totallen = 0; - for (i = 0; i < numInDashList; i++) - totallen += pDash[i]; - if (totallen <= dist) - dist = dist % totallen; - while (dist >= pDash[dashIndex]) { - dist -= pDash[dashIndex]; - if (++dashIndex == numInDashList) - dashIndex = 0; - } - *pDashIndex = dashIndex; - *pDashOffset = dist; -} - -/* - -These routines maintain lists of Spans, in order to implement the -``touch-each-pixel-once'' rules of wide lines and arcs. - -Written by Joel McCormack, Summer 1989. - -*/ - - -static void -miInitSpanGroup (SpanGroup * spanGroup) -{ - spanGroup->size = 0; - spanGroup->count = 0; - spanGroup->group = NULL; - spanGroup->ymin = MAX_COORDINATE; - spanGroup->ymax = MIN_COORDINATE; -} /* InitSpanGroup */ - -#define YMIN(spans) (spans->points[0].y) -#define YMAX(spans) (spans->points[spans->count-1].y) - -static void -miSubtractSpans (SpanGroup * spanGroup, Spans * sub) -{ - int i, subCount, spansCount; - int ymin, ymax, xmin, xmax; - Spans *spans; - DDXPointPtr subPt, spansPt; - int *subWid, *spansWid; - int extra; - - ymin = YMIN (sub); - ymax = YMAX (sub); - spans = spanGroup->group; - for (i = spanGroup->count; i; i--, spans++) { - if (YMIN (spans) <= ymax && ymin <= YMAX (spans)) { - subCount = sub->count; - subPt = sub->points; - subWid = sub->widths; - spansCount = spans->count; - spansPt = spans->points; - spansWid = spans->widths; - extra = 0; - for (;;) { - while (spansCount && spansPt->y < subPt->y) { - spansPt++; - spansWid++; - spansCount--; - } - if (!spansCount) - break; - while (subCount && subPt->y < spansPt->y) { - subPt++; - subWid++; - subCount--; - } - if (!subCount) - break; - if (subPt->y == spansPt->y) { - xmin = subPt->x; - xmax = xmin + *subWid; - if (xmin >= spansPt->x + *spansWid || spansPt->x >= xmax) { - ; - } else if (xmin <= spansPt->x) { - if (xmax >= spansPt->x + *spansWid) { - memmove (spansPt, spansPt + 1, sizeof *spansPt * (spansCount - 1)); - memmove (spansWid, spansWid + 1, sizeof *spansWid * (spansCount - 1)); - spansPt--; - spansWid--; - spans->count--; - extra++; - } else { - *spansWid = *spansWid - (xmax - spansPt->x); - spansPt->x = xmax; - } - } else { - if (xmax >= spansPt->x + *spansWid) { - *spansWid = xmin - spansPt->x; - } else { - if (!extra) { - DDXPointPtr newPt; - int *newwid; - -#define EXTRA 8 - newPt = - (DDXPointPtr) xrealloc (spans->points, - (spans->count + - EXTRA) * sizeof (DDXPointRec)); - if (!newPt) - break; - spansPt = newPt + (spansPt - spans->points); - spans->points = newPt; - newwid = - (int *) xrealloc (spans->widths, - (spans->count + EXTRA) * sizeof (int)); - if (!newwid) - break; - spansWid = newwid + (spansWid - spans->widths); - spans->widths = newwid; - extra = EXTRA; - } - memmove (spansPt + 1, spansPt, sizeof *spansPt * (spansCount)); - memmove (spansWid + 1, spansWid, sizeof *spansWid * (spansCount)); - spans->count++; - extra--; - *spansWid = xmin - spansPt->x; - spansWid++; - spansPt++; - *spansWid = *spansWid - (xmax - spansPt->x); - spansPt->x = xmax; - } - } - } - spansPt++; - spansWid++; - spansCount--; - } - } - } -} - -static void -miAppendSpans (SpanGroup * spanGroup, SpanGroup * otherGroup, Spans * spans) -{ - int ymin, ymax; - int spansCount; - - spansCount = spans->count; - if (spansCount > 0) { - if (spanGroup->size == spanGroup->count) { - spanGroup->size = (spanGroup->size + 8) * 2; - spanGroup->group = (Spans *) - xrealloc (spanGroup->group, sizeof (Spans) * spanGroup->size); - } - - spanGroup->group[spanGroup->count] = *spans; - (spanGroup->count)++; - ymin = spans->points[0].y; - if (ymin < spanGroup->ymin) - spanGroup->ymin = ymin; - ymax = spans->points[spansCount - 1].y; - if (ymax > spanGroup->ymax) - spanGroup->ymax = ymax; - if (otherGroup && otherGroup->ymin < ymax && ymin < otherGroup->ymax) { - miSubtractSpans (otherGroup, spans); - } - } else { - xfree (spans->points); - xfree (spans->widths); - } -} /* AppendSpans */ - -static void -miFreeSpanGroup (SpanGroup * spanGroup) -{ - if (spanGroup->group != NULL) - xfree (spanGroup->group); -} - -static void -QuickSortSpansX (DDXPointRec points[], int widths[], int numSpans) -{ - int x; - int i, j, m; - DDXPointPtr r; - -/* Always called with numSpans > 1 */ -/* Sorts only by x, as all y should be the same */ - -#define ExchangeSpans(a, b) \ -{ \ - DDXPointRec tpt; \ - int tw; \ - \ - tpt = points[a]; points[a] = points[b]; points[b] = tpt; \ - tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \ -} - - do { - if (numSpans < 9) { - /* Do insertion sort */ - int xprev; - - xprev = points[0].x; - i = 1; - do { /* while i != numSpans */ - x = points[i].x; - if (xprev > x) { - /* points[i] is out of order. Move into proper location. */ - DDXPointRec tpt; - int tw, k; - - for (j = 0; x >= points[j].x; j++) { - } - tpt = points[i]; - tw = widths[i]; - for (k = i; k != j; k--) { - points[k] = points[k - 1]; - widths[k] = widths[k - 1]; - } - points[j] = tpt; - widths[j] = tw; - x = points[i].x; - } /* if out of order */ - xprev = x; - i++; - } while (i != numSpans); - return; - } - - /* Choose partition element, stick in location 0 */ - m = numSpans / 2; - if (points[m].x > points[0].x) - ExchangeSpans (m, 0); - if (points[m].x > points[numSpans - 1].x) - ExchangeSpans (m, numSpans - 1); - if (points[m].x > points[0].x) - ExchangeSpans (m, 0); - x = points[0].x; - - /* Partition array */ - i = 0; - j = numSpans; - do { - r = &(points[i]); - do { - r++; - i++; - } while (i != numSpans && r->x < x); - r = &(points[j]); - do { - r--; - j--; - } while (x < r->x); - if (i < j) - ExchangeSpans (i, j); - } while (i < j); - - /* Move partition element back to middle */ - ExchangeSpans (0, j); - - /* Recurse */ - if (numSpans - j - 1 > 1) - QuickSortSpansX (&points[j + 1], &widths[j + 1], numSpans - j - 1); - numSpans = j; - } while (numSpans > 1); -} /* QuickSortSpans */ - - -static int -UniquifySpansX (Spans * spans, DDXPointRec * newPoints, int *newWidths) -{ - int newx1, newx2, oldpt, i, y; - DDXPointRec *oldPoints; - int *oldWidths; - int *startNewWidths; - -/* Always called with numSpans > 1 */ -/* Uniquify the spans, and stash them into newPoints and newWidths. Return the - number of unique spans. */ - - - startNewWidths = newWidths; - - oldPoints = spans->points; - oldWidths = spans->widths; - - y = oldPoints->y; - newx1 = oldPoints->x; - newx2 = newx1 + *oldWidths; - - for (i = spans->count - 1; i != 0; i--) { - oldPoints++; - oldWidths++; - oldpt = oldPoints->x; - if (oldpt > newx2) { - /* Write current span, start a new one */ - newPoints->x = newx1; - newPoints->y = y; - *newWidths = newx2 - newx1; - newPoints++; - newWidths++; - newx1 = oldpt; - newx2 = oldpt + *oldWidths; - } else { - /* extend current span, if old extends beyond new */ - oldpt = oldpt + *oldWidths; - if (oldpt > newx2) - newx2 = oldpt; - } - } /* for */ - - /* Write final span */ - newPoints->x = newx1; - *newWidths = newx2 - newx1; - newPoints->y = y; - - return (newWidths - startNewWidths) + 1; -} /* UniquifySpansX */ - -static void -miDisposeSpanGroup (SpanGroup * spanGroup) -{ - int i; - Spans *spans; - - for (i = 0; i < spanGroup->count; i++) { - spans = spanGroup->group + i; - xfree (spans->points); - xfree (spans->widths); - } -} - -static void -miFillUniqueSpanGroup (GCPtr pGC, SpanGroup * spanGroup, Boolean foreground) -{ - int i; - Spans *spans; - Spans *yspans; - int *ysizes; - int ymin, ylength; - - /* Outgoing spans for one big call to FillSpans */ - DDXPointPtr points; - int *widths; - int count; - - if (spanGroup->count == 0) - return; - - if (spanGroup->count == 1) { - /* Already should be sorted, unique */ - spans = spanGroup->group; - (*pGC->ops->FillSpans) - (pGC, spans->count, spans->points, spans->widths, TRUE, foreground); - xfree (spans->points); - xfree (spans->widths); - } else { - /* Yuck. Gross. Radix sort into y buckets, then sort x and uniquify */ - /* This seems to be the fastest thing to do. I've tried sorting on - both x and y at the same time rather than creating into all those - y buckets, but it was somewhat slower. */ - - ymin = spanGroup->ymin; - ylength = spanGroup->ymax - ymin + 1; - - /* Allocate Spans for y buckets */ - yspans = (Spans*)xalloc (ylength * sizeof (Spans)); - ysizes = (int *)xalloc (ylength * sizeof (int)); - - if (!yspans || !ysizes) { - if (yspans) - xfree (yspans); - if (ysizes) - xfree (ysizes); - miDisposeSpanGroup (spanGroup); - return; - } - - for (i = 0; i != ylength; i++) { - ysizes[i] = 0; - yspans[i].count = 0; - yspans[i].points = NULL; - yspans[i].widths = NULL; - } - - /* Go through every single span and put it into the correct bucket */ - count = 0; - for (i = 0, spans = spanGroup->group; i != spanGroup->count; i++, spans++) { - int index; - int j; - - for (j = 0, points = spans->points, widths = spans->widths; - j != spans->count; j++, points++, widths++) { - index = points->y - ymin; - if (index >= 0 && index < ylength) { - Spans *newspans = &(yspans[index]); - if (newspans->count == ysizes[index]) { - DDXPointPtr newpoints; - int *newwidths; - ysizes[index] = (ysizes[index] + 8) * 2; - newpoints = (DDXPointPtr) xrealloc (newspans->points, - ysizes[index] * sizeof (DDXPointRec)); - newwidths = (int *) xrealloc (newspans->widths, - ysizes[index] * sizeof (int)); - if (!newpoints || !newwidths) { - int i; - - for (i = 0; i < ylength; i++) { - xfree (yspans[i].points); - xfree (yspans[i].widths); - } - xfree (yspans); - xfree (ysizes); - miDisposeSpanGroup (spanGroup); - return; - } - newspans->points = newpoints; - newspans->widths = newwidths; - } - newspans->points[newspans->count] = *points; - newspans->widths[newspans->count] = *widths; - (newspans->count)++; - } /* if y value of span in range */ - } /* for j through spans */ - count += spans->count; - xfree (spans->points); - spans->points = NULL; - xfree (spans->widths); - spans->widths = NULL; - } /* for i thorough Spans */ - - /* Now sort by x and uniquify each bucket into the final array */ - points = (DDXPointRec*)xalloc (count * sizeof (DDXPointRec)); - widths = (int *)xalloc (count * sizeof (int)); - if (!points || !widths) { - int i; - - for (i = 0; i < ylength; i++) { - xfree (yspans[i].points); - xfree (yspans[i].widths); - } - xfree (yspans); - xfree (ysizes); - if (points) - xfree (points); - if (widths) - xfree (widths); - return; - } - count = 0; - for (i = 0; i != ylength; i++) { - int ycount = yspans[i].count; - if (ycount > 0) { - if (ycount > 1) { - QuickSortSpansX (yspans[i].points, yspans[i].widths, ycount); - count += UniquifySpansX (&(yspans[i]), &(points[count]), &(widths[count])); - } else { - points[count] = yspans[i].points[0]; - widths[count] = yspans[i].widths[0]; - count++; - } - xfree (yspans[i].points); - xfree (yspans[i].widths); - } - } - - (*pGC->ops->FillSpans) (pGC, count, points, widths, TRUE, foreground); - xfree (points); - xfree (widths); - xfree (yspans); - xfree (ysizes); /* use (DE)xalloc for these? */ - } - - spanGroup->count = 0; - spanGroup->ymin = MAX_COORDINATE; - spanGroup->ymax = MIN_COORDINATE; -} - -/* - -The bresenham error equation used in the mi/mfb/cfb line routines is: - - e = error - dx = difference in raw X coordinates - dy = difference in raw Y coordinates - M = # of steps in X direction - N = # of steps in Y direction - B = 0 to prefer diagonal steps in a given octant, - 1 to prefer axial steps in a given octant - - For X major lines: - e = 2Mdy - 2Ndx - dx - B - -2dx <= e < 0 - - For Y major lines: - e = 2Ndx - 2Mdy - dy - B - -2dy <= e < 0 - -At the start of the line, we have taken 0 X steps and 0 Y steps, -so M = 0 and N = 0: - - X major e = 2Mdy - 2Ndx - dx - B - = -dx - B - - Y major e = 2Ndx - 2Mdy - dy - B - = -dy - B - -At the end of the line, we have taken dx X steps and dy Y steps, -so M = dx and N = dy: - - X major e = 2Mdy - 2Ndx - dx - B - = 2dxdy - 2dydx - dx - B - = -dx - B - Y major e = 2Ndx - 2Mdy - dy - B - = 2dydx - 2dxdy - dy - B - = -dy - B - -Thus, the error term is the same at the start and end of the line. - -Let us consider clipping an X coordinate. There are 4 cases which -represent the two independent cases of clipping the start vs. the -end of the line and an X major vs. a Y major line. In any of these -cases, we know the number of X steps (M) and we wish to find the -number of Y steps (N). Thus, we will solve our error term equation. -If we are clipping the start of the line, we will find the smallest -N that satisfies our error term inequality. If we are clipping the -end of the line, we will find the largest number of Y steps that -satisfies the inequality. In that case, since we are representing -the Y steps as (dy - N), we will actually want to solve for the -smallest N in that equation. - -Case 1: X major, starting X coordinate moved by M steps - - -2dx <= 2Mdy - 2Ndx - dx - B < 0 - 2Ndx <= 2Mdy - dx - B + 2dx 2Ndx > 2Mdy - dx - B - 2Ndx <= 2Mdy + dx - B N > (2Mdy - dx - B) / 2dx - N <= (2Mdy + dx - B) / 2dx - -Since we are trying to find the smallest N that satisfies these -equations, we should use the > inequality to find the smallest: - - N = floor((2Mdy - dx - B) / 2dx) + 1 - = floor((2Mdy - dx - B + 2dx) / 2dx) - = floor((2Mdy + dx - B) / 2dx) - -Case 1b: X major, ending X coordinate moved to M steps - -Same derivations as Case 1, but we want the largest N that satisfies -the equations, so we use the <= inequality: - - N = floor((2Mdy + dx - B) / 2dx) - -Case 2: X major, ending X coordinate moved by M steps - - -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0 - -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0 - -2dx <= 2Ndx - 2Mdy - dx - B < 0 - 2Ndx >= 2Mdy + dx + B - 2dx 2Ndx < 2Mdy + dx + B - 2Ndx >= 2Mdy - dx + B N < (2Mdy + dx + B) / 2dx - N >= (2Mdy - dx + B) / 2dx - -Since we are trying to find the highest number of Y steps that -satisfies these equations, we need to find the smallest N, so -we should use the >= inequality to find the smallest: - - N = ceiling((2Mdy - dx + B) / 2dx) - = floor((2Mdy - dx + B + 2dx - 1) / 2dx) - = floor((2Mdy + dx + B - 1) / 2dx) - -Case 2b: X major, starting X coordinate moved to M steps from end - -Same derivations as Case 2, but we want the smallest number of Y -steps, so we want the highest N, so we use the < inequality: - - N = ceiling((2Mdy + dx + B) / 2dx) - 1 - = floor((2Mdy + dx + B + 2dx - 1) / 2dx) - 1 - = floor((2Mdy + dx + B + 2dx - 1 - 2dx) / 2dx) - = floor((2Mdy + dx + B - 1) / 2dx) - -Case 3: Y major, starting X coordinate moved by M steps - - -2dy <= 2Ndx - 2Mdy - dy - B < 0 - 2Ndx >= 2Mdy + dy + B - 2dy 2Ndx < 2Mdy + dy + B - 2Ndx >= 2Mdy - dy + B N < (2Mdy + dy + B) / 2dx - N >= (2Mdy - dy + B) / 2dx - -Since we are trying to find the smallest N that satisfies these -equations, we should use the >= inequality to find the smallest: - - N = ceiling((2Mdy - dy + B) / 2dx) - = floor((2Mdy - dy + B + 2dx - 1) / 2dx) - = floor((2Mdy - dy + B - 1) / 2dx) + 1 - -Case 3b: Y major, ending X coordinate moved to M steps - -Same derivations as Case 3, but we want the largest N that satisfies -the equations, so we use the < inequality: - - N = ceiling((2Mdy + dy + B) / 2dx) - 1 - = floor((2Mdy + dy + B + 2dx - 1) / 2dx) - 1 - = floor((2Mdy + dy + B + 2dx - 1 - 2dx) / 2dx) - = floor((2Mdy + dy + B - 1) / 2dx) - -Case 4: Y major, ending X coordinate moved by M steps - - -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0 - -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0 - -2dy <= 2Mdy - 2Ndx - dy - B < 0 - 2Ndx <= 2Mdy - dy - B + 2dy 2Ndx > 2Mdy - dy - B - 2Ndx <= 2Mdy + dy - B N > (2Mdy - dy - B) / 2dx - N <= (2Mdy + dy - B) / 2dx - -Since we are trying to find the highest number of Y steps that -satisfies these equations, we need to find the smallest N, so -we should use the > inequality to find the smallest: - - N = floor((2Mdy - dy - B) / 2dx) + 1 - -Case 4b: Y major, starting X coordinate moved to M steps from end - -Same analysis as Case 4, but we want the smallest number of Y steps -which means the largest N, so we use the <= inequality: - - N = floor((2Mdy + dy - B) / 2dx) - -Now let's try the Y coordinates, we have the same 4 cases. - -Case 5: X major, starting Y coordinate moved by N steps - - -2dx <= 2Mdy - 2Ndx - dx - B < 0 - 2Mdy >= 2Ndx + dx + B - 2dx 2Mdy < 2Ndx + dx + B - 2Mdy >= 2Ndx - dx + B M < (2Ndx + dx + B) / 2dy - M >= (2Ndx - dx + B) / 2dy - -Since we are trying to find the smallest M, we use the >= inequality: - - M = ceiling((2Ndx - dx + B) / 2dy) - = floor((2Ndx - dx + B + 2dy - 1) / 2dy) - = floor((2Ndx - dx + B - 1) / 2dy) + 1 - -Case 5b: X major, ending Y coordinate moved to N steps - -Same derivations as Case 5, but we want the largest M that satisfies -the equations, so we use the < inequality: - - M = ceiling((2Ndx + dx + B) / 2dy) - 1 - = floor((2Ndx + dx + B + 2dy - 1) / 2dy) - 1 - = floor((2Ndx + dx + B + 2dy - 1 - 2dy) / 2dy) - = floor((2Ndx + dx + B - 1) / 2dy) - -Case 6: X major, ending Y coordinate moved by N steps - - -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0 - -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0 - -2dx <= 2Ndx - 2Mdy - dx - B < 0 - 2Mdy <= 2Ndx - dx - B + 2dx 2Mdy > 2Ndx - dx - B - 2Mdy <= 2Ndx + dx - B M > (2Ndx - dx - B) / 2dy - M <= (2Ndx + dx - B) / 2dy - -Largest # of X steps means smallest M, so use the > inequality: - - M = floor((2Ndx - dx - B) / 2dy) + 1 - -Case 6b: X major, starting Y coordinate moved to N steps from end - -Same derivations as Case 6, but we want the smallest # of X steps -which means the largest M, so use the <= inequality: - - M = floor((2Ndx + dx - B) / 2dy) - -Case 7: Y major, starting Y coordinate moved by N steps - - -2dy <= 2Ndx - 2Mdy - dy - B < 0 - 2Mdy <= 2Ndx - dy - B + 2dy 2Mdy > 2Ndx - dy - B - 2Mdy <= 2Ndx + dy - B M > (2Ndx - dy - B) / 2dy - M <= (2Ndx + dy - B) / 2dy - -To find the smallest M, use the > inequality: - - M = floor((2Ndx - dy - B) / 2dy) + 1 - = floor((2Ndx - dy - B + 2dy) / 2dy) - = floor((2Ndx + dy - B) / 2dy) - -Case 7b: Y major, ending Y coordinate moved to N steps - -Same derivations as Case 7, but we want the largest M that satisfies -the equations, so use the <= inequality: - - M = floor((2Ndx + dy - B) / 2dy) - -Case 8: Y major, ending Y coordinate moved by N steps - - -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0 - -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0 - -2dy <= 2Mdy - 2Ndx - dy - B < 0 - 2Mdy >= 2Ndx + dy + B - 2dy 2Mdy < 2Ndx + dy + B - 2Mdy >= 2Ndx - dy + B M < (2Ndx + dy + B) / 2dy - M >= (2Ndx - dy + B) / 2dy - -To find the highest X steps, find the smallest M, use the >= inequality: - - M = ceiling((2Ndx - dy + B) / 2dy) - = floor((2Ndx - dy + B + 2dy - 1) / 2dy) - = floor((2Ndx + dy + B - 1) / 2dy) - -Case 8b: Y major, starting Y coordinate moved to N steps from the end - -Same derivations as Case 8, but we want to find the smallest # of X -steps which means the largest M, so we use the < inequality: - - M = ceiling((2Ndx + dy + B) / 2dy) - 1 - = floor((2Ndx + dy + B + 2dy - 1) / 2dy) - 1 - = floor((2Ndx + dy + B + 2dy - 1 - 2dy) / 2dy) - = floor((2Ndx + dy + B - 1) / 2dy) - -So, our equations are: - - 1: X major move x1 to x1+M floor((2Mdy + dx - B) / 2dx) - 1b: X major move x2 to x1+M floor((2Mdy + dx - B) / 2dx) - 2: X major move x2 to x2-M floor((2Mdy + dx + B - 1) / 2dx) - 2b: X major move x1 to x2-M floor((2Mdy + dx + B - 1) / 2dx) - - 3: Y major move x1 to x1+M floor((2Mdy - dy + B - 1) / 2dx) + 1 - 3b: Y major move x2 to x1+M floor((2Mdy + dy + B - 1) / 2dx) - 4: Y major move x2 to x2-M floor((2Mdy - dy - B) / 2dx) + 1 - 4b: Y major move x1 to x2-M floor((2Mdy + dy - B) / 2dx) - - 5: X major move y1 to y1+N floor((2Ndx - dx + B - 1) / 2dy) + 1 - 5b: X major move y2 to y1+N floor((2Ndx + dx + B - 1) / 2dy) - 6: X major move y2 to y2-N floor((2Ndx - dx - B) / 2dy) + 1 - 6b: X major move y1 to y2-N floor((2Ndx + dx - B) / 2dy) - - 7: Y major move y1 to y1+N floor((2Ndx + dy - B) / 2dy) - 7b: Y major move y2 to y1+N floor((2Ndx + dy - B) / 2dy) - 8: Y major move y2 to y2-N floor((2Ndx + dy + B - 1) / 2dy) - 8b: Y major move y1 to y2-N floor((2Ndx + dy + B - 1) / 2dy) - -We have the following constraints on all of the above terms: - - 0 < M,N <= 2^15 2^15 can be imposed by miZeroClipLine - 0 <= dx/dy <= 2^16 - 1 - 0 <= B <= 1 - -The floor in all of the above equations can be accomplished with a -simple C divide operation provided that both numerator and denominator -are positive. - -Since dx,dy >= 0 and since moving an X coordinate implies that dx != 0 -and moving a Y coordinate implies dy != 0, we know that the denominators -are all > 0. - -For all lines, (-B) and (B-1) are both either 0 or -1, depending on the -bias. Thus, we have to show that the 2MNdxy +/- dxy terms are all >= 1 -or > 0 to prove that the numerators are positive (or zero). - -For X Major lines we know that dx > 0 and since 2Mdy is >= 0 due to the -constraints, the first four equations all have numerators >= 0. - -For the second four equations, M > 0, so 2Mdy >= 2dy so (2Mdy - dy) >= dy -So (2Mdy - dy) > 0, since they are Y major lines. Also, (2Mdy + dy) >= 3dy -or (2Mdy + dy) > 0. So all of their numerators are >= 0. - -For the third set of four equations, N > 0, so 2Ndx >= 2dx so (2Ndx - dx) ->= dx > 0. Similarly (2Ndx + dx) >= 3dx > 0. So all numerators >= 0. - -For the fourth set of equations, dy > 0 and 2Ndx >= 0, so all numerators -are > 0. - -To consider overflow, consider the case of 2 * M,N * dx,dy + dx,dy. This -is bounded <= 2 * 2^15 * (2^16 - 1) + (2^16 - 1) - <= 2^16 * (2^16 - 1) + (2^16 - 1) - <= 2^32 - 2^16 + 2^16 - 1 - <= 2^32 - 1 -Since the (-B) and (B-1) terms are all 0 or -1, the maximum value of -the numerator is therefore (2^32 - 1), which does not overflow an unsigned -32 bit variable. - -*/ - -/* Bit codes for the terms of the 16 clipping equations defined below. */ - -#define T_2NDX (1 << 0) -#define T_2MDY (0) /* implicit term */ -#define T_DXNOTY (1 << 1) -#define T_DYNOTX (0) /* implicit term */ -#define T_SUBDXORY (1 << 2) -#define T_ADDDX (T_DXNOTY) /* composite term */ -#define T_SUBDX (T_DXNOTY | T_SUBDXORY) /* composite term */ -#define T_ADDDY (T_DYNOTX) /* composite term */ -#define T_SUBDY (T_DYNOTX | T_SUBDXORY) /* composite term */ -#define T_BIASSUBONE (1 << 3) -#define T_SUBBIAS (0) /* implicit term */ -#define T_DIV2DX (1 << 4) -#define T_DIV2DY (0) /* implicit term */ -#define T_ADDONE (1 << 5) - -/* Bit masks defining the 16 equations used in miZeroClipLine. */ - -#define EQN1 (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX) -#define EQN1B (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX) -#define EQN2 (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX) -#define EQN2B (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX) - -#define EQN3 (T_2MDY | T_SUBDY | T_BIASSUBONE | T_DIV2DX | T_ADDONE) -#define EQN3B (T_2MDY | T_ADDDY | T_BIASSUBONE | T_DIV2DX) -#define EQN4 (T_2MDY | T_SUBDY | T_SUBBIAS | T_DIV2DX | T_ADDONE) -#define EQN4B (T_2MDY | T_ADDDY | T_SUBBIAS | T_DIV2DX) - -#define EQN5 (T_2NDX | T_SUBDX | T_BIASSUBONE | T_DIV2DY | T_ADDONE) -#define EQN5B (T_2NDX | T_ADDDX | T_BIASSUBONE | T_DIV2DY) -#define EQN6 (T_2NDX | T_SUBDX | T_SUBBIAS | T_DIV2DY | T_ADDONE) -#define EQN6B (T_2NDX | T_ADDDX | T_SUBBIAS | T_DIV2DY) - -#define EQN7 (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY) -#define EQN7B (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY) -#define EQN8 (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY) -#define EQN8B (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY) - -/* miZeroClipLine - * - * returns: 1 for partially clipped line - * -1 for completely clipped line - * - */ -static int -miZeroClipLine (int xmin, int ymin, int xmax, int ymax, - int *new_x1, int *new_y1, int *new_x2, int *new_y2, - unsigned int adx, unsigned int ady, - int *pt1_clipped, int *pt2_clipped, int octant, unsigned int bias, int oc1, int oc2) -{ - int swapped = 0; - int clipDone = 0; - CARD32 utmp = 0; - int clip1, clip2; - int x1, y1, x2, y2; - int x1_orig, y1_orig, x2_orig, y2_orig; - int xmajor; - int negslope = 0, anchorval = 0; - unsigned int eqn = 0; - - x1 = x1_orig = *new_x1; - y1 = y1_orig = *new_y1; - x2 = x2_orig = *new_x2; - y2 = y2_orig = *new_y2; - - clip1 = 0; - clip2 = 0; - - xmajor = IsXMajorOctant (octant); - bias = ((bias >> octant) & 1); - - while (1) { - if ((oc1 & oc2) != 0) { /* trivial reject */ - clipDone = -1; - clip1 = oc1; - clip2 = oc2; - break; - } else if ((oc1 | oc2) == 0) { /* trivial accept */ - clipDone = 1; - if (swapped) { - SWAPINT_PAIR (x1, y1, x2, y2); - SWAPINT (clip1, clip2); - } - break; - } else { /* have to clip */ - - /* only clip one point at a time */ - if (oc1 == 0) { - SWAPINT_PAIR (x1, y1, x2, y2); - SWAPINT_PAIR (x1_orig, y1_orig, x2_orig, y2_orig); - SWAPINT (oc1, oc2); - SWAPINT (clip1, clip2); - swapped = !swapped; - } - - clip1 |= oc1; - if (oc1 & OUT_LEFT) { - negslope = IsYDecreasingOctant (octant); - utmp = xmin - x1_orig; - if (utmp <= 32767) { /* clip based on near endpt */ - if (xmajor) - eqn = (swapped) ? EQN2 : EQN1; - else - eqn = (swapped) ? EQN4 : EQN3; - anchorval = y1_orig; - } else { /* clip based on far endpt */ - - utmp = x2_orig - xmin; - if (xmajor) - eqn = (swapped) ? EQN1B : EQN2B; - else - eqn = (swapped) ? EQN3B : EQN4B; - anchorval = y2_orig; - negslope = !negslope; - } - x1 = xmin; - } else if (oc1 & OUT_ABOVE) { - negslope = IsXDecreasingOctant (octant); - utmp = ymin - y1_orig; - if (utmp <= 32767) { /* clip based on near endpt */ - if (xmajor) - eqn = (swapped) ? EQN6 : EQN5; - else - eqn = (swapped) ? EQN8 : EQN7; - anchorval = x1_orig; - } else { /* clip based on far endpt */ - - utmp = y2_orig - ymin; - if (xmajor) - eqn = (swapped) ? EQN5B : EQN6B; - else - eqn = (swapped) ? EQN7B : EQN8B; - anchorval = x2_orig; - negslope = !negslope; - } - y1 = ymin; - } else if (oc1 & OUT_RIGHT) { - negslope = IsYDecreasingOctant (octant); - utmp = x1_orig - xmax; - if (utmp <= 32767) { /* clip based on near endpt */ - if (xmajor) - eqn = (swapped) ? EQN2 : EQN1; - else - eqn = (swapped) ? EQN4 : EQN3; - anchorval = y1_orig; - } else { /* clip based on far endpt */ - - /* - * Technically since the equations can handle - * utmp == 32768, this overflow code isn't - * needed since X11 protocol can't generate - * a line which goes more than 32768 pixels - * to the right of a clip rectangle. - */ - utmp = xmax - x2_orig; - if (xmajor) - eqn = (swapped) ? EQN1B : EQN2B; - else - eqn = (swapped) ? EQN3B : EQN4B; - anchorval = y2_orig; - negslope = !negslope; - } - x1 = xmax; - } else if (oc1 & OUT_BELOW) { - negslope = IsXDecreasingOctant (octant); - utmp = y1_orig - ymax; - if (utmp <= 32767) { /* clip based on near endpt */ - if (xmajor) - eqn = (swapped) ? EQN6 : EQN5; - else - eqn = (swapped) ? EQN8 : EQN7; - anchorval = x1_orig; - } else { /* clip based on far endpt */ - - /* - * Technically since the equations can handle - * utmp == 32768, this overflow code isn't - * needed since X11 protocol can't generate - * a line which goes more than 32768 pixels - * below the bottom of a clip rectangle. - */ - utmp = ymax - y2_orig; - if (xmajor) - eqn = (swapped) ? EQN5B : EQN6B; - else - eqn = (swapped) ? EQN7B : EQN8B; - anchorval = x2_orig; - negslope = !negslope; - } - y1 = ymax; - } - - if (swapped) - negslope = !negslope; - - utmp <<= 1; /* utmp = 2N or 2M */ - if (eqn & T_2NDX) - utmp = (utmp * adx); - else /* (eqn & T_2MDY) */ - utmp = (utmp * ady); - if (eqn & T_DXNOTY) - if (eqn & T_SUBDXORY) - utmp -= adx; - else - utmp += adx; - else /* (eqn & T_DYNOTX) */ if (eqn & T_SUBDXORY) - utmp -= ady; - else - utmp += ady; - if (eqn & T_BIASSUBONE) - utmp += bias - 1; - else /* (eqn & T_SUBBIAS) */ - utmp -= bias; - if (eqn & T_DIV2DX) - utmp /= (adx << 1); - else /* (eqn & T_DIV2DY) */ - utmp /= (ady << 1); - if (eqn & T_ADDONE) - utmp++; - - if (negslope) - utmp = (uint32_t)(-(int32_t)utmp); - - if (eqn & T_2NDX) /* We are calculating X steps */ - x1 = anchorval + utmp; - else /* else, Y steps */ - y1 = anchorval + utmp; - - oc1 = 0; - MIOUTCODES (oc1, x1, y1, xmin, ymin, xmax, ymax); - } - } - - *new_x1 = x1; - *new_y1 = y1; - *new_x2 = x2; - *new_y2 = y2; - - *pt1_clipped = clip1; - *pt2_clipped = clip2; - - return clipDone; -} - -/* Draw lineSolid, fillStyle-independent zero width lines. - * - * Must keep X and Y coordinates in "ints" at least until after they're - * translated and clipped to accomodate CoordModePrevious lines with very - * large coordinates. - * - * Draws the same pixels regardless of sign(dx) or sign(dy). - * - * Ken Whaley - * - */ - -#define MI_OUTPUT_POINT(xx, yy)\ -{\ - if ( !new_span && yy == current_y)\ - {\ - if (xx < spans->x)\ - spans->x = xx;\ - ++*widths;\ - }\ - else\ - {\ - ++Nspans;\ - ++spans;\ - ++widths;\ - spans->x = xx;\ - spans->y = yy;\ - *widths = 1;\ - current_y = yy;\ - new_span = FALSE;\ - }\ -} - -void -miZeroLine (GCPtr pGC, int mode, /* Origin or Previous */ - int npt, /* number of points */ - DDXPointPtr pptInit) -{ - int Nspans, current_y = 0; - DDXPointPtr ppt; - DDXPointPtr pspanInit, spans; - int *pwidthInit, *widths, list_len; - int xleft, ytop, xright, ybottom; - int new_x1, new_y1, new_x2, new_y2; - int x = 0, y = 0, x1, y1, x2, y2, xstart, ystart; - int oc1, oc2; - int result; - int pt1_clipped, pt2_clipped = 0; - Boolean new_span; - int signdx, signdy; - int clipdx, clipdy; - int width, height; - int adx, ady; - int octant; - unsigned int bias = miGetZeroLineBias (screen); - int e, e1, e2, e3; /* Bresenham error terms */ - int length; /* length of lines == # of pixels on major axis */ - - xleft = 0; - ytop = 0; - xright = pGC->width - 1; - ybottom = pGC->height - 1; - - /* it doesn't matter whether we're in drawable or screen coordinates, - * FillSpans simply cannot take starting coordinates outside of the - * range of a DDXPointRec component. - */ - if (xright > MAX_COORDINATE) - xright = MAX_COORDINATE; - if (ybottom > MAX_COORDINATE) - ybottom = MAX_COORDINATE; - - /* since we're clipping to the drawable's boundaries & coordinate - * space boundaries, we're guaranteed that the larger of width/height - * is the longest span we'll need to output - */ - width = xright - xleft + 1; - height = ybottom - ytop + 1; - list_len = (height >= width) ? height : width; - pspanInit = (DDXPointRec *)xalloc (list_len * sizeof (DDXPointRec)); - pwidthInit = (int *)xalloc (list_len * sizeof (int)); - if (!pspanInit || !pwidthInit) - return; - - Nspans = 0; - new_span = TRUE; - spans = pspanInit - 1; - widths = pwidthInit - 1; - ppt = pptInit; - - xstart = ppt->x; - ystart = ppt->y; - - /* x2, y2, oc2 copied to x1, y1, oc1 at top of loop to simplify - * iteration logic - */ - x2 = xstart; - y2 = ystart; - oc2 = 0; - MIOUTCODES (oc2, x2, y2, xleft, ytop, xright, ybottom); - - while (--npt > 0) { - if (Nspans > 0) - (*pGC->ops->FillSpans) (pGC, Nspans, pspanInit, pwidthInit, FALSE, TRUE); - Nspans = 0; - new_span = TRUE; - spans = pspanInit - 1; - widths = pwidthInit - 1; - - x1 = x2; - y1 = y2; - oc1 = oc2; - ++ppt; - - x2 = ppt->x; - y2 = ppt->y; - if (mode == CoordModePrevious) { - x2 += x1; - y2 += y1; - } - - oc2 = 0; - MIOUTCODES (oc2, x2, y2, xleft, ytop, xright, ybottom); - - CalcLineDeltas (x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); - - if (adx > ady) { - e1 = ady << 1; - e2 = e1 - (adx << 1); - e = e1 - adx; - length = adx; /* don't draw endpoint in main loop */ - - FIXUP_ERROR (e, octant, bias); - - new_x1 = x1; - new_y1 = y1; - new_x2 = x2; - new_y2 = y2; - pt1_clipped = 0; - pt2_clipped = 0; - - if ((oc1 | oc2) != 0) { - result = miZeroClipLine (xleft, ytop, xright, ybottom, - &new_x1, &new_y1, &new_x2, &new_y2, - adx, ady, - &pt1_clipped, &pt2_clipped, octant, bias, oc1, oc2); - if (result == -1) - continue; - - length = abs (new_x2 - new_x1); - - /* if we've clipped the endpoint, always draw the full length - * of the segment, because then the capstyle doesn't matter - */ - if (pt2_clipped) - length++; - - if (pt1_clipped) { - /* must calculate new error terms */ - clipdx = abs (new_x1 - x1); - clipdy = abs (new_y1 - y1); - e += (clipdy * e2) + ((clipdx - clipdy) * e1); - } - } - - /* draw the segment */ - - x = new_x1; - y = new_y1; - - e3 = e2 - e1; - e = e - e1; - - while (length--) { - MI_OUTPUT_POINT (x, y); - e += e1; - if (e >= 0) { - y += signdy; - e += e3; - } - x += signdx; - } - } else { /* Y major line */ - - e1 = adx << 1; - e2 = e1 - (ady << 1); - e = e1 - ady; - length = ady; /* don't draw endpoint in main loop */ - - SetYMajorOctant (octant); - FIXUP_ERROR (e, octant, bias); - - new_x1 = x1; - new_y1 = y1; - new_x2 = x2; - new_y2 = y2; - pt1_clipped = 0; - pt2_clipped = 0; - - if ((oc1 | oc2) != 0) { - result = miZeroClipLine (xleft, ytop, xright, ybottom, - &new_x1, &new_y1, &new_x2, &new_y2, - adx, ady, - &pt1_clipped, &pt2_clipped, octant, bias, oc1, oc2); - if (result == -1) - continue; - - length = abs (new_y2 - new_y1); - - /* if we've clipped the endpoint, always draw the full length - * of the segment, because then the capstyle doesn't matter - */ - if (pt2_clipped) - length++; - - if (pt1_clipped) { - /* must calculate new error terms */ - clipdx = abs (new_x1 - x1); - clipdy = abs (new_y1 - y1); - e += (clipdx * e2) + ((clipdy - clipdx) * e1); - } - } - - /* draw the segment */ - - x = new_x1; - y = new_y1; - - e3 = e2 - e1; - e = e - e1; - - while (length--) { - MI_OUTPUT_POINT (x, y); - e += e1; - if (e >= 0) { - x += signdx; - e += e3; - } - y += signdy; - } - } - } - - /* only do the capnotlast check on the last segment - * and only if the endpoint wasn't clipped. And then, if the last - * point is the same as the first point, do not draw it, unless the - * line is degenerate - */ - if ((!pt2_clipped) && (pGC->capStyle != CapNotLast) && - (((xstart != x2) || (ystart != y2)) || (ppt == pptInit + 1))) { - MI_OUTPUT_POINT (x, y); - } - - if (Nspans > 0) - (*pGC->ops->FillSpans) (pGC, Nspans, pspanInit, pwidthInit, FALSE, TRUE); - - xfree (pwidthInit); - xfree (pspanInit); -} - -void -miZeroDashLine (GCPtr pgc, int mode, int nptInit, /* number of points in polyline */ - DDXPointRec * pptInit /* points in the polyline */ - ) -{ - /* XXX kludge until real zero-width dash code is written */ - pgc->lineWidth = 1; - miWideDash (pgc, mode, nptInit, pptInit); - pgc->lineWidth = 0; -} - -static void miLineArc (GCPtr pGC, - Boolean foreground, SpanDataPtr spanData, - LineFacePtr leftFace, - LineFacePtr rightFace, double xorg, double yorg, Boolean isInt); - - -/* - * spans-based polygon filler - */ - -static void -miFillPolyHelper (GCPtr pGC, Boolean foreground, - SpanDataPtr spanData, int y, int overall_height, - PolyEdgePtr left, PolyEdgePtr right, int left_count, int right_count) -{ - int left_x = 0, left_e = 0; - int left_stepx = 0; - int left_signdx = 0; - int left_dy = 0, left_dx = 0; - - int right_x = 0, right_e = 0; - int right_stepx = 0; - int right_signdx = 0; - int right_dy = 0, right_dx = 0; - - int height = 0; - int left_height = 0, right_height = 0; - - DDXPointPtr ppt; - DDXPointPtr pptInit = NULL; - int *pwidth; - int *pwidthInit = NULL; - int xorg; - Spans spanRec; - - left_height = 0; - right_height = 0; - - if (!spanData) { - pptInit = (DDXPointRec *)xalloc (overall_height * sizeof (*ppt)); - if (!pptInit) - return; - pwidthInit = (int *)xalloc (overall_height * sizeof (*pwidth)); - if (!pwidthInit) { - xfree (pptInit); - return; - } - ppt = pptInit; - pwidth = pwidthInit; - } else { - spanRec.points = (DDXPointRec *)xalloc (overall_height * sizeof (*ppt)); - if (!spanRec.points) - return; - spanRec.widths = (int *)xalloc (overall_height * sizeof (int)); - if (!spanRec.widths) { - xfree (spanRec.points); - return; - } - ppt = spanRec.points; - pwidth = spanRec.widths; - } - - xorg = 0; - while ((left_count || left_height) && (right_count || right_height)) { - MIPOLYRELOADLEFT MIPOLYRELOADRIGHT height = left_height; - if (height > right_height) - height = right_height; - - left_height -= height; - right_height -= height; - - while (--height >= 0) { - if (right_x >= left_x) { - ppt->y = y; - ppt->x = left_x + xorg; - ppt++; - *pwidth++ = right_x - left_x + 1; - } - y++; - - MIPOLYSTEPLEFT MIPOLYSTEPRIGHT} - } - if (!spanData) { - (*pGC->ops->FillSpans) (pGC, ppt - pptInit, pptInit, pwidthInit, TRUE, foreground); - xfree (pwidthInit); - xfree (pptInit); - } else { - spanRec.count = ppt - spanRec.points; - AppendSpanGroup (pGC, foreground, &spanRec, spanData) - } -} - -static void -miFillRectPolyHelper (GCPtr pGC, Boolean foreground, SpanDataPtr spanData, int x, int y, int w, int h) -{ - DDXPointPtr ppt; - int *pwidth; - Spans spanRec; - xRectangle rect; - - if (!spanData) { - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - (*pGC->ops->FillRects) (pGC, 1, &rect, foreground); - } else { - spanRec.points = (DDXPointRec *)xalloc (h * sizeof (*ppt)); - if (!spanRec.points) - return; - spanRec.widths = (int *)xalloc (h * sizeof (int)); - if (!spanRec.widths) { - xfree (spanRec.points); - return; - } - ppt = spanRec.points; - pwidth = spanRec.widths; - - while (h--) { - ppt->x = x; - ppt->y = y; - ppt++; - *pwidth++ = w; - y++; - } - spanRec.count = ppt - spanRec.points; - AppendSpanGroup (pGC, foreground, &spanRec, spanData) - } -} - -static int -miPolyBuildEdge (double x0, double y0, double k, /* x0 * dy - y0 * dx */ - int dx, int dy, int xi, int yi, int left, PolyEdgePtr edge) -{ - int x, y, e; - int xady; - - if (dy < 0) { - dy = -dy; - dx = -dx; - k = -k; - } -#ifdef NOTDEF - { - double realk, kerror; - realk = x0 * dy - y0 * dx; - kerror = Fabs (realk - k); - if (kerror > .1) - printf ("realk: %g k: %g\n", realk, k); - } -#endif - y = ICEIL (y0); - xady = ICEIL (k) + y * dx; - - if (xady <= 0) - x = -(-xady / dy) - 1; - else - x = (xady - 1) / dy; - - e = xady - x * dy; - - if (dx >= 0) { - edge->signdx = 1; - edge->stepx = dx / dy; - edge->dx = dx % dy; - } else { - edge->signdx = -1; - edge->stepx = -(-dx / dy); - edge->dx = -dx % dy; - e = dy - e + 1; - } - edge->dy = dy; - edge->x = x + left + xi; - edge->e = e - dy; /* bias to compare against 0 instead of dy */ - return y + yi; -} - -#define StepAround(v, incr, max) (((v) + (incr) < 0) ? (max - 1) : ((v) + (incr) == max) ? 0 : ((v) + (incr))) - -static int -miPolyBuildPoly (PolyVertexPtr vertices, - PolySlopePtr slopes, - int count, - int xi, - int yi, PolyEdgePtr left, PolyEdgePtr right, int *pnleft, int *pnright, int *h) -{ - int top, bottom; - double miny, maxy; - int i; - int j; - int clockwise; - int slopeoff; - int s; - int nright, nleft; - int y, lasty = 0, bottomy, topy = 0; - - /* find the top of the polygon */ - maxy = miny = vertices[0].y; - bottom = top = 0; - for (i = 1; i < count; i++) { - if (vertices[i].y < miny) { - top = i; - miny = vertices[i].y; - } - if (vertices[i].y >= maxy) { - bottom = i; - maxy = vertices[i].y; - } - } - clockwise = 1; - slopeoff = 0; - - i = top; - j = StepAround (top, -1, count); - - if (slopes[j].dy * slopes[i].dx > slopes[i].dy * slopes[j].dx) { - clockwise = -1; - slopeoff = -1; - } - - bottomy = ICEIL (maxy) + yi; - - nright = 0; - - s = StepAround (top, slopeoff, count); - i = top; - while (i != bottom) { - if (slopes[s].dy != 0) { - y = miPolyBuildEdge (vertices[i].x, vertices[i].y, - slopes[s].k, - slopes[s].dx, slopes[s].dy, xi, yi, 0, &right[nright]); - if (nright != 0) - right[nright - 1].height = y - lasty; - else - topy = y; - nright++; - lasty = y; - } - - i = StepAround (i, clockwise, count); - s = StepAround (s, clockwise, count); - } - if (nright != 0) - right[nright - 1].height = bottomy - lasty; - - if (slopeoff == 0) - slopeoff = -1; - else - slopeoff = 0; - - nleft = 0; - s = StepAround (top, slopeoff, count); - i = top; - while (i != bottom) { - if (slopes[s].dy != 0) { - y = miPolyBuildEdge (vertices[i].x, vertices[i].y, - slopes[s].k, slopes[s].dx, slopes[s].dy, xi, yi, 1, &left[nleft]); - - if (nleft != 0) - left[nleft - 1].height = y - lasty; - nleft++; - lasty = y; - } - i = StepAround (i, -clockwise, count); - s = StepAround (s, -clockwise, count); - } - if (nleft != 0) - left[nleft - 1].height = bottomy - lasty; - *pnleft = nleft; - *pnright = nright; - *h = bottomy - topy; - return topy; -} - -static void -miLineOnePoint (GCPtr pGC, Boolean foreground, SpanDataPtr spanData, int x, int y) -{ - DDXPointRec pt; - int wid; - - wid = 1; - pt.x = x; - pt.y = y; - (*pGC->ops->FillSpans) (pGC, 1, &pt, &wid, TRUE, foreground); -} - -static void -miLineJoin (GCPtr pGC, Boolean foreground, SpanDataPtr spanData, LineFacePtr pLeft, LineFacePtr pRight) -{ - double mx = 0, my = 0; - double denom = 0.0; - PolyVertexRec vertices[4]; - PolySlopeRec slopes[4]; - int edgecount; - PolyEdgeRec left[4], right[4]; - int nleft, nright; - int y, height; - int swapslopes; - int joinStyle = pGC->joinStyle; - int lw = pGC->lineWidth; - - if (lw == 1 && !spanData) { - /* See if one of the lines will draw the joining pixel */ - if (pLeft->dx > 0 || (pLeft->dx == 0 && pLeft->dy > 0)) - return; - if (pRight->dx > 0 || (pRight->dx == 0 && pRight->dy > 0)) - return; - if (joinStyle != JoinRound) { - denom = -pLeft->dx * (double) pRight->dy + pRight->dx * (double) pLeft->dy; - if (denom == 0) - return; /* no join to draw */ - } - if (joinStyle != JoinMiter) { - miLineOnePoint (pGC, foreground, spanData, pLeft->x, pLeft->y); - return; - } - } else { - if (joinStyle == JoinRound) { - miLineArc (pGC, foreground, spanData, pLeft, pRight, (double) 0.0, (double) 0.0, TRUE); - return; - } - denom = -pLeft->dx * (double) pRight->dy + pRight->dx * (double) pLeft->dy; - if (denom == 0.0) - return; /* no join to draw */ - } - - swapslopes = 0; - if (denom > 0) { - pLeft->xa = -pLeft->xa; - pLeft->ya = -pLeft->ya; - pLeft->dx = -pLeft->dx; - pLeft->dy = -pLeft->dy; - } else { - swapslopes = 1; - pRight->xa = -pRight->xa; - pRight->ya = -pRight->ya; - pRight->dx = -pRight->dx; - pRight->dy = -pRight->dy; - } - - vertices[0].x = pRight->xa; - vertices[0].y = pRight->ya; - slopes[0].dx = -pRight->dy; - slopes[0].dy = pRight->dx; - slopes[0].k = 0; - - vertices[1].x = 0; - vertices[1].y = 0; - slopes[1].dx = pLeft->dy; - slopes[1].dy = -pLeft->dx; - slopes[1].k = 0; - - vertices[2].x = pLeft->xa; - vertices[2].y = pLeft->ya; - - if (joinStyle == JoinMiter) { - my = (pLeft->dy * (pRight->xa * pRight->dy - pRight->ya * pRight->dx) - - pRight->dy * (pLeft->xa * pLeft->dy - pLeft->ya * pLeft->dx)) / denom; - if (pLeft->dy != 0) { - mx = pLeft->xa + (my - pLeft->ya) * (double) pLeft->dx / (double) pLeft->dy; - } else { - mx = pRight->xa + (my - pRight->ya) * (double) pRight->dx / (double) pRight->dy; - } - /* check miter limit */ - if ((mx * mx + my * my) * 4 > SQSECANT * lw * lw) - joinStyle = JoinBevel; - } - - if (joinStyle == JoinMiter) { - slopes[2].dx = pLeft->dx; - slopes[2].dy = pLeft->dy; - slopes[2].k = pLeft->k; - if (swapslopes) { - slopes[2].dx = -slopes[2].dx; - slopes[2].dy = -slopes[2].dy; - slopes[2].k = -slopes[2].k; - } - vertices[3].x = mx; - vertices[3].y = my; - slopes[3].dx = pRight->dx; - slopes[3].dy = pRight->dy; - slopes[3].k = pRight->k; - if (swapslopes) { - slopes[3].dx = -slopes[3].dx; - slopes[3].dy = -slopes[3].dy; - slopes[3].k = -slopes[3].k; - } - edgecount = 4; - } else { - double scale, dx, dy, adx, ady; - - adx = dx = pRight->xa - pLeft->xa; - ady = dy = pRight->ya - pLeft->ya; - if (adx < 0) - adx = -adx; - if (ady < 0) - ady = -ady; - scale = ady; - if (adx > ady) - scale = adx; - slopes[2].dx = (int) ((dx * 65536) / scale); - slopes[2].dy = (int) ((dy * 65536) / scale); - slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy - - (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0; - edgecount = 3; - } - - y = miPolyBuildPoly (vertices, slopes, edgecount, pLeft->x, pLeft->y, - left, right, &nleft, &nright, &height); - miFillPolyHelper (pGC, foreground, spanData, y, height, left, right, nleft, nright); -} - -static int -miLineArcI (GCPtr pGC, int xorg, int yorg, DDXPointPtr points, int *widths) -{ - DDXPointPtr tpts, bpts; - int *twids, *bwids; - int x, y, e, ex, slw; - - tpts = points; - twids = widths; - slw = pGC->lineWidth; - if (slw == 1) { - tpts->x = xorg; - tpts->y = yorg; - *twids = 1; - return 1; - } - bpts = tpts + slw; - bwids = twids + slw; - y = (slw >> 1) + 1; - if (slw & 1) - e = -((y << 2) + 3); - else - e = -(y << 3); - ex = -4; - x = 0; - while (y) { - e += (y << 3) - 4; - while (e >= 0) { - x++; - e += (ex = -((x << 3) + 4)); - } - y--; - slw = (x << 1) + 1; - if ((e == ex) && (slw > 1)) - slw--; - tpts->x = xorg - x; - tpts->y = yorg - y; - tpts++; - *twids++ = slw; - if ((y != 0) && ((slw > 1) || (e != ex))) { - bpts--; - bpts->x = xorg - x; - bpts->y = yorg + y; - *--bwids = slw; - } - } - return (pGC->lineWidth); -} - -#define CLIPSTEPEDGE(edgey,edge,edgeleft) \ - if (ybase == edgey) \ - { \ - if (edgeleft) \ - { \ - if (edge->x > xcl) \ - xcl = edge->x; \ - } \ - else \ - { \ - if (edge->x < xcr) \ - xcr = edge->x; \ - } \ - edgey++; \ - edge->x += edge->stepx; \ - edge->e += edge->dx; \ - if (edge->e > 0) \ - { \ - edge->x += edge->signdx; \ - edge->e -= edge->dy; \ - } \ - } - -static int -miLineArcD (GCPtr pGC, - double xorg, - double yorg, - DDXPointPtr points, - int *widths, - PolyEdgePtr edge1, - int edgey1, Boolean edgeleft1, PolyEdgePtr edge2, int edgey2, Boolean edgeleft2) -{ - DDXPointPtr pts; - int *wids; - double radius, x0, y0, el, er, yk, xlk, xrk, k; - int xbase, ybase, y, boty, xl, xr, xcl, xcr; - int ymin, ymax; - Boolean edge1IsMin, edge2IsMin; - int ymin1, ymin2; - - pts = points; - wids = widths; - xbase = (int)floor (xorg); - x0 = xorg - xbase; - ybase = ICEIL (yorg); - y0 = yorg - ybase; - xlk = x0 + x0 + 1.0; - xrk = x0 + x0 - 1.0; - yk = y0 + y0 - 1.0; - radius = ((double) pGC->lineWidth) / 2.0; - y = (int)floor (radius - y0 + 1.0); - ybase -= y; - ymin = ybase; - ymax = 65536; - edge1IsMin = FALSE; - ymin1 = edgey1; - if (edge1->dy >= 0) { - if (!edge1->dy) { - if (edgeleft1) - edge1IsMin = TRUE; - else - ymax = edgey1; - edgey1 = 65536; - } else { - if ((edge1->signdx < 0) == edgeleft1) - edge1IsMin = TRUE; - } - } - edge2IsMin = FALSE; - ymin2 = edgey2; - if (edge2->dy >= 0) { - if (!edge2->dy) { - if (edgeleft2) - edge2IsMin = TRUE; - else - ymax = edgey2; - edgey2 = 65536; - } else { - if ((edge2->signdx < 0) == edgeleft2) - edge2IsMin = TRUE; - } - } - if (edge1IsMin) { - ymin = ymin1; - if (edge2IsMin && ymin1 > ymin2) - ymin = ymin2; - } else if (edge2IsMin) - ymin = ymin2; - el = radius * radius - ((y + y0) * (y + y0)) - (x0 * x0); - er = el + xrk; - xl = 1; - xr = 0; - if (x0 < 0.5) { - xl = 0; - el -= xlk; - } - boty = (y0 < -0.5) ? 1 : 0; - if (ybase + y - boty > ymax) - boty = ymax - ybase - y; - while (y > boty) { - k = (y << 1) + yk; - er += k; - while (er > 0.0) { - xr++; - er += xrk - (xr << 1); - } - el += k; - while (el >= 0.0) { - xl--; - el += (xl << 1) - xlk; - } - y--; - ybase++; - if (ybase < ymin) - continue; - xcl = xl + xbase; - xcr = xr + xbase; - CLIPSTEPEDGE (edgey1, edge1, edgeleft1); - CLIPSTEPEDGE (edgey2, edge2, edgeleft2); - if (xcr >= xcl) { - pts->x = xcl; - pts->y = ybase; - pts++; - *wids++ = xcr - xcl + 1; - } - } - er = xrk - (xr << 1) - er; - el = (xl << 1) - xlk - el; - boty = (int)floor (-y0 - radius + 1.0); - if (ybase + y - boty > ymax) - boty = ymax - ybase - y; - while (y > boty) { - k = (y << 1) + yk; - er -= k; - while ((er >= 0.0) && (xr >= 0)) { - xr--; - er += xrk - (xr << 1); - } - el -= k; - while ((el > 0.0) && (xl <= 0)) { - xl++; - el += (xl << 1) - xlk; - } - y--; - ybase++; - if (ybase < ymin) - continue; - xcl = xl + xbase; - xcr = xr + xbase; - CLIPSTEPEDGE (edgey1, edge1, edgeleft1); - CLIPSTEPEDGE (edgey2, edge2, edgeleft2); - if (xcr >= xcl) { - pts->x = xcl; - pts->y = ybase; - pts++; - *wids++ = xcr - xcl + 1; - } - } - return (pts - points); -} - -static int -miRoundJoinFace (LineFacePtr face, PolyEdgePtr edge, Boolean * leftEdge) -{ - int y; - int dx, dy; - double xa, ya; - Boolean left; - - dx = -face->dy; - dy = face->dx; - xa = face->xa; - ya = face->ya; - left = 1; - if (ya > 0) { - ya = 0.0; - xa = 0.0; - } - if (dy < 0 || (dy == 0 && dx > 0)) { - dx = -dx; - dy = -dy; - left = !left; - } - if (dx == 0 && dy == 0) - dy = 1; - if (dy == 0) { - y = ICEIL (face->ya) + face->y; - edge->x = -32767; - edge->stepx = 0; - edge->signdx = 0; - edge->e = -1; - edge->dy = 0; - edge->dx = 0; - edge->height = 0; - } else { - y = miPolyBuildEdge (xa, ya, 0.0, dx, dy, face->x, face->y, !left, edge); - edge->height = 32767; - } - *leftEdge = !left; - return y; -} - -static void -miRoundJoinClip (LineFacePtr pLeft, LineFacePtr pRight, - PolyEdgePtr edge1, PolyEdgePtr edge2, int *y1, int *y2, Boolean * left1, Boolean * left2) -{ - double denom; - - denom = -pLeft->dx * (double) pRight->dy + pRight->dx * (double) pLeft->dy; - - if (denom >= 0) { - pLeft->xa = -pLeft->xa; - pLeft->ya = -pLeft->ya; - } else { - pRight->xa = -pRight->xa; - pRight->ya = -pRight->ya; - } - *y1 = miRoundJoinFace (pLeft, edge1, left1); - *y2 = miRoundJoinFace (pRight, edge2, left2); -} - -static int -miRoundCapClip (LineFacePtr face, Boolean isInt, PolyEdgePtr edge, Boolean * leftEdge) -{ - int y; - int dx, dy; - double xa, ya, k; - Boolean left; - - dx = -face->dy; - dy = face->dx; - xa = face->xa; - ya = face->ya; - k = 0.0; - if (!isInt) - k = face->k; - left = 1; - if (dy < 0 || (dy == 0 && dx > 0)) { - dx = -dx; - dy = -dy; - xa = -xa; - ya = -ya; - left = !left; - } - if (dx == 0 && dy == 0) - dy = 1; - if (dy == 0) { - y = ICEIL (face->ya) + face->y; - edge->x = -32767; - edge->stepx = 0; - edge->signdx = 0; - edge->e = -1; - edge->dy = 0; - edge->dx = 0; - edge->height = 0; - } else { - y = miPolyBuildEdge (xa, ya, k, dx, dy, face->x, face->y, !left, edge); - edge->height = 32767; - } - *leftEdge = !left; - return y; -} - -static void -miLineArc (GCPtr pGC, - Boolean foreground, - SpanDataPtr spanData, - LineFacePtr leftFace, LineFacePtr rightFace, double xorg, double yorg, Boolean isInt) -{ - DDXPointPtr points; - int *widths; - int xorgi = 0, yorgi = 0; - Spans spanRec; - int n; - PolyEdgeRec edge1, edge2; - int edgey1, edgey2; - Boolean edgeleft1, edgeleft2; - - if (isInt) { - xorgi = leftFace ? leftFace->x : rightFace->x; - yorgi = leftFace ? leftFace->y : rightFace->y; - } - edgey1 = 65536; - edgey2 = 65536; - edge1.x = 0; /* not used, keep memory checkers happy */ - edge1.dy = -1; - edge2.x = 0; /* not used, keep memory checkers happy */ - edge2.dy = -1; - edgeleft1 = FALSE; - edgeleft2 = FALSE; - if ((pGC->lineStyle != LineSolid || pGC->lineWidth > 2) && - ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) || - (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt))) { - if (isInt) { - xorg = (double) xorgi; - yorg = (double) yorgi; - } - if (leftFace && rightFace) { - miRoundJoinClip (leftFace, rightFace, &edge1, &edge2, - &edgey1, &edgey2, &edgeleft1, &edgeleft2); - } else if (leftFace) { - edgey1 = miRoundCapClip (leftFace, isInt, &edge1, &edgeleft1); - } else if (rightFace) { - edgey2 = miRoundCapClip (rightFace, isInt, &edge2, &edgeleft2); - } - isInt = FALSE; - } - if (!spanData) { - points = (DDXPointRec *)xalloc (sizeof (DDXPointRec) * pGC->lineWidth); - if (!points) - return; - widths = (int *)xalloc (sizeof (int) * pGC->lineWidth); - if (!widths) { - xfree (points); - return; - } - } else { - points = (DDXPointRec *)xalloc (pGC->lineWidth * sizeof (DDXPointRec)); - if (!points) - return; - widths = (int *)xalloc (pGC->lineWidth * sizeof (int)); - if (!widths) { - xfree (points); - return; - } - spanRec.points = points; - spanRec.widths = widths; - } - if (isInt) - n = miLineArcI (pGC, xorgi, yorgi, points, widths); - else - n = miLineArcD (pGC, xorg, yorg, points, widths, - &edge1, edgey1, edgeleft1, &edge2, edgey2, edgeleft2); - - if (!spanData) { - (*pGC->ops->FillSpans) (pGC, n, points, widths, TRUE, foreground); - xfree (widths); - xfree (points); - } else { - spanRec.count = n; - AppendSpanGroup (pGC, foreground, &spanRec, spanData) - } -} - -static void -miLineProjectingCap (GCPtr pGC, Boolean foreground, - SpanDataPtr spanData, LineFacePtr face, Boolean isLeft, - double xorg, double yorg, Boolean isInt) -{ - int xorgi = 0, yorgi = 0; - int lw; - PolyEdgeRec lefts[2], rights[2]; - int lefty, righty, topy, bottomy; - PolyEdgePtr left, right; - PolyEdgePtr top, bottom; - double xa, ya; - double k; - double xap, yap; - int dx, dy; - double projectXoff, projectYoff; - double maxy; - int finaly; - - if (isInt) { - xorgi = face->x; - yorgi = face->y; - } - lw = pGC->lineWidth; - dx = face->dx; - dy = face->dy; - k = face->k; - if (dy == 0) { - lefts[0].height = lw; - lefts[0].x = xorgi; - if (isLeft) - lefts[0].x -= (lw >> 1); - lefts[0].stepx = 0; - lefts[0].signdx = 1; - lefts[0].e = -lw; - lefts[0].dx = 0; - lefts[0].dy = lw; - rights[0].height = lw; - rights[0].x = xorgi; - if (!isLeft) - rights[0].x += ((lw + 1) >> 1); - rights[0].stepx = 0; - rights[0].signdx = 1; - rights[0].e = -lw; - rights[0].dx = 0; - rights[0].dy = lw; - miFillPolyHelper (pGC, foreground, spanData, yorgi - (lw >> 1), lw, lefts, rights, 1, 1); - } else if (dx == 0) { - if (dy < 0) { - dy = -dy; - isLeft = !isLeft; - } - topy = yorgi; - bottomy = yorgi + dy; - if (isLeft) - topy -= (lw >> 1); - else - bottomy += (lw >> 1); - lefts[0].height = bottomy - topy; - lefts[0].x = xorgi - (lw >> 1); - lefts[0].stepx = 0; - lefts[0].signdx = 1; - lefts[0].e = -dy; - lefts[0].dx = dx; - lefts[0].dy = dy; - - rights[0].height = bottomy - topy; - rights[0].x = lefts[0].x + (lw - 1); - rights[0].stepx = 0; - rights[0].signdx = 1; - rights[0].e = -dy; - rights[0].dx = dx; - rights[0].dy = dy; - miFillPolyHelper (pGC, foreground, spanData, topy, bottomy - topy, lefts, rights, 1, 1); - } else { - xa = face->xa; - ya = face->ya; - projectXoff = -ya; - projectYoff = xa; - if (dx < 0) { - right = &rights[1]; - left = &lefts[0]; - top = &rights[0]; - bottom = &lefts[1]; - } else { - right = &rights[0]; - left = &lefts[1]; - top = &lefts[0]; - bottom = &rights[1]; - } - if (isLeft) { - righty = miPolyBuildEdge (xa, ya, k, dx, dy, xorgi, yorgi, 0, right); - - xa = -xa; - ya = -ya; - k = -k; - lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, - k, dx, dy, xorgi, yorgi, 1, left); - if (dx > 0) { - ya = -ya; - xa = -xa; - } - xap = xa - projectXoff; - yap = ya - projectYoff; - topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, - -dy, dx, xorgi, yorgi, dx > 0, top); - bottomy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, xorgi, yorgi, dx < 0, bottom); - maxy = -ya; - } else { - righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, - k, dx, dy, xorgi, yorgi, 0, right); - - xa = -xa; - ya = -ya; - k = -k; - lefty = miPolyBuildEdge (xa, ya, k, dx, dy, xorgi, yorgi, 1, left); - if (dx > 0) { - ya = -ya; - xa = -xa; - } - xap = xa - projectXoff; - yap = ya - projectYoff; - topy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, xorgi, xorgi, dx > 0, top); - bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, - -dy, dx, xorgi, xorgi, dx < 0, bottom); - maxy = -ya + projectYoff; - } - finaly = ICEIL (maxy) + yorgi; - if (dx < 0) { - left->height = bottomy - lefty; - right->height = finaly - righty; - top->height = righty - topy; - } else { - right->height = bottomy - righty; - left->height = finaly - lefty; - top->height = lefty - topy; - } - bottom->height = finaly - bottomy; - miFillPolyHelper (pGC, foreground, spanData, topy, - bottom->height + bottomy - topy, lefts, rights, 2, 2); - } -} - -static void -miWideSegment (GCPtr pGC, - Boolean foreground, - SpanDataPtr spanData, - int x1, - int y1, - int x2, - int y2, - Boolean projectLeft, Boolean projectRight, LineFacePtr leftFace, LineFacePtr rightFace) -{ - double l, L, r; - double xa, ya; - double projectXoff = 0.0, projectYoff = 0.0; - double k; - double maxy; - int x, y; - int dx, dy; - int finaly; - PolyEdgePtr left, right; - PolyEdgePtr top, bottom; - int lefty, righty, topy, bottomy; - int signdx; - PolyEdgeRec lefts[2], rights[2]; - LineFacePtr tface; - int lw = pGC->lineWidth; - - /* draw top-to-bottom always */ - if (y2 < y1 || (y2 == y1 && x2 < x1)) { - x = x1; - x1 = x2; - x2 = x; - - y = y1; - y1 = y2; - y2 = y; - - x = projectLeft; - projectLeft = projectRight; - projectRight = x; - - tface = leftFace; - leftFace = rightFace; - rightFace = tface; - } - - dy = y2 - y1; - signdx = 1; - dx = x2 - x1; - if (dx < 0) - signdx = -1; - - leftFace->x = x1; - leftFace->y = y1; - leftFace->dx = dx; - leftFace->dy = dy; - - rightFace->x = x2; - rightFace->y = y2; - rightFace->dx = -dx; - rightFace->dy = -dy; - - if (dy == 0) { - rightFace->xa = 0; - rightFace->ya = (double) lw / 2.0; - rightFace->k = -(double) (lw * dx) / 2.0; - leftFace->xa = 0; - leftFace->ya = -rightFace->ya; - leftFace->k = rightFace->k; - x = x1; - if (projectLeft) - x -= (lw >> 1); - y = y1 - (lw >> 1); - dx = x2 - x; - if (projectRight) - dx += ((lw + 1) >> 1); - dy = lw; - miFillRectPolyHelper (pGC, foreground, spanData, x, y, dx, dy); - } else if (dx == 0) { - leftFace->xa = (double) lw / 2.0; - leftFace->ya = 0; - leftFace->k = (double) (lw * dy) / 2.0; - rightFace->xa = -leftFace->xa; - rightFace->ya = 0; - rightFace->k = leftFace->k; - y = y1; - if (projectLeft) - y -= lw >> 1; - x = x1 - (lw >> 1); - dy = y2 - y; - if (projectRight) - dy += ((lw + 1) >> 1); - dx = lw; - miFillRectPolyHelper (pGC, foreground, spanData, x, y, dx, dy); - } else { - l = ((double) lw) / 2.0; - L = hypot ((double) dx, (double) dy); - - if (dx < 0) { - right = &rights[1]; - left = &lefts[0]; - top = &rights[0]; - bottom = &lefts[1]; - } else { - right = &rights[0]; - left = &lefts[1]; - top = &lefts[0]; - bottom = &rights[1]; - } - r = l / L; - - /* coord of upper bound at integral y */ - ya = -r * dx; - xa = r * dy; - - if (projectLeft | projectRight) { - projectXoff = -ya; - projectYoff = xa; - } - - /* xa * dy - ya * dx */ - k = l * L; - - leftFace->xa = xa; - leftFace->ya = ya; - leftFace->k = k; - rightFace->xa = -xa; - rightFace->ya = -ya; - rightFace->k = k; - - if (projectLeft) - righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, - k, dx, dy, x1, y1, 0, right); - else - righty = miPolyBuildEdge (xa, ya, k, dx, dy, x1, y1, 0, right); - - /* coord of lower bound at integral y */ - ya = -ya; - xa = -xa; - - /* xa * dy - ya * dx */ - k = -k; - - if (projectLeft) - lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, - k, dx, dy, x1, y1, 1, left); - else - lefty = miPolyBuildEdge (xa, ya, k, dx, dy, x1, y1, 1, left); - - /* coord of top face at integral y */ - - if (signdx > 0) { - ya = -ya; - xa = -xa; - } - - if (projectLeft) { - double xap = xa - projectXoff; - double yap = ya - projectYoff; - topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, -dy, dx, x1, y1, dx > 0, top); - } else - topy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, x1, y1, dx > 0, top); - - /* coord of bottom face at integral y */ - - if (projectRight) { - double xap = xa + projectXoff; - double yap = ya + projectYoff; - bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, - -dy, dx, x2, y2, dx < 0, bottom); - maxy = -ya + projectYoff; - } else { - bottomy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, x2, y2, dx < 0, bottom); - maxy = -ya; - } - - finaly = ICEIL (maxy) + y2; - - if (dx < 0) { - left->height = bottomy - lefty; - right->height = finaly - righty; - top->height = righty - topy; - } else { - right->height = bottomy - righty; - left->height = finaly - lefty; - top->height = lefty - topy; - } - bottom->height = finaly - bottomy; - miFillPolyHelper (pGC, foreground, spanData, topy, - bottom->height + bottomy - topy, lefts, rights, 2, 2); - } -} - -static SpanDataPtr -miSetupSpanData (GCPtr pGC, SpanDataPtr spanData, int npt) -{ - if ((npt < 3 && pGC->capStyle != CapRound) || miSpansEasyRop (pGC->alu)) - return (SpanDataPtr) NULL; - if (pGC->lineStyle == LineDoubleDash) - miInitSpanGroup (&spanData->bgGroup); - miInitSpanGroup (&spanData->fgGroup); - return spanData; -} - -static void -miCleanupSpanData (GCPtr pGC, SpanDataPtr spanData) -{ - if (pGC->lineStyle == LineDoubleDash) { - miFillUniqueSpanGroup (pGC, &spanData->bgGroup, FALSE); - miFreeSpanGroup (&spanData->bgGroup); - } - miFillUniqueSpanGroup (pGC, &spanData->fgGroup, TRUE); - miFreeSpanGroup (&spanData->fgGroup); -} - -void -miWideLine (GCPtr pGC, int mode, int npt, DDXPointPtr pPts) -{ - int x1, y1, x2, y2; - SpanDataRec spanDataRec; - SpanDataPtr spanData; - Boolean projectLeft, projectRight; - LineFaceRec leftFace, rightFace, prevRightFace; - LineFaceRec firstFace; - int first; - Boolean somethingDrawn = FALSE; - Boolean selfJoin; - - spanData = miSetupSpanData (pGC, &spanDataRec, npt); - x2 = pPts->x; - y2 = pPts->y; - first = TRUE; - selfJoin = FALSE; - if (npt > 1) { - if (mode == CoordModePrevious) { - int nptTmp; - DDXPointPtr pPtsTmp; - - x1 = x2; - y1 = y2; - nptTmp = npt; - pPtsTmp = pPts + 1; - while (--nptTmp) { - x1 += pPtsTmp->x; - y1 += pPtsTmp->y; - ++pPtsTmp; - } - if (x2 == x1 && y2 == y1) - selfJoin = TRUE; - } else if (x2 == pPts[npt - 1].x && y2 == pPts[npt - 1].y) { - selfJoin = TRUE; - } - } - projectLeft = pGC->capStyle == CapProjecting && !selfJoin; - projectRight = FALSE; - while (--npt) { - x1 = x2; - y1 = y2; - ++pPts; - x2 = pPts->x; - y2 = pPts->y; - if (mode == CoordModePrevious) { - x2 += x1; - y2 += y1; - } - if (x1 != x2 || y1 != y2) { - somethingDrawn = TRUE; - if (npt == 1 && pGC->capStyle == CapProjecting && !selfJoin) - projectRight = TRUE; - miWideSegment (pGC, TRUE, spanData, x1, y1, x2, y2, - projectLeft, projectRight, &leftFace, &rightFace); - if (first) { - if (selfJoin) - firstFace = leftFace; - else if (pGC->capStyle == CapRound) { - if (pGC->lineWidth == 1 && !spanData) - miLineOnePoint (pGC, TRUE, spanData, x1, y1); - else - miLineArc (pGC, TRUE, spanData, - &leftFace, (LineFacePtr) NULL, (double) 0.0, (double) 0.0, TRUE); - } - } else { - miLineJoin (pGC, TRUE, spanData, &leftFace, &prevRightFace); - } - prevRightFace = rightFace; - first = FALSE; - projectLeft = FALSE; - } - if (npt == 1 && somethingDrawn) { - if (selfJoin) - miLineJoin (pGC, TRUE, spanData, &firstFace, &rightFace); - else if (pGC->capStyle == CapRound) { - if (pGC->lineWidth == 1 && !spanData) - miLineOnePoint (pGC, TRUE, spanData, x2, y2); - else - miLineArc (pGC, TRUE, spanData, - (LineFacePtr) NULL, &rightFace, (double) 0.0, (double) 0.0, TRUE); - } - } - } - /* handle crock where all points are coincedent */ - if (!somethingDrawn) { - projectLeft = pGC->capStyle == CapProjecting; - miWideSegment (pGC, TRUE, spanData, - x2, y2, x2, y2, projectLeft, projectLeft, &leftFace, &rightFace); - if (pGC->capStyle == CapRound) { - miLineArc (pGC, TRUE, spanData, - &leftFace, (LineFacePtr) NULL, (double) 0.0, (double) 0.0, TRUE); - rightFace.dx = -1; /* sleezy hack to make it work */ - miLineArc (pGC, TRUE, spanData, - (LineFacePtr) NULL, &rightFace, (double) 0.0, (double) 0.0, TRUE); - } - } - if (spanData) - miCleanupSpanData (pGC, spanData); -} - -#define V_TOP 0 -#define V_RIGHT 1 -#define V_BOTTOM 2 -#define V_LEFT 3 - -static void -miWideDashSegment (GCPtr pGC, - SpanDataPtr spanData, - int *pDashOffset, - int *pDashIndex, - int x1, - int y1, - int x2, - int y2, - Boolean projectLeft, Boolean projectRight, LineFacePtr leftFace, LineFacePtr rightFace) -{ - int dashIndex, dashRemain; - unsigned char *pDash; - double L, l; - double k; - PolyVertexRec vertices[4]; - PolyVertexRec saveRight = { 0 }, saveBottom; - PolySlopeRec slopes[4]; - PolyEdgeRec left[2], right[2]; - LineFaceRec lcapFace, rcapFace; - int nleft, nright; - int h; - int y; - int dy, dx; - Boolean foreground; - double LRemain; - double r; - double rdx, rdy; - double dashDx, dashDy; - double saveK = 0.0; - Boolean first = TRUE; - double lcenterx, lcentery, rcenterx = 0.0, rcentery = 0.0; - - dx = x2 - x1; - dy = y2 - y1; - dashIndex = *pDashIndex; - pDash = pGC->dash; - dashRemain = pDash[dashIndex] - *pDashOffset; - - l = ((double) pGC->lineWidth) / 2.0; - if (dx == 0) { - L = dy; - rdx = 0; - rdy = l; - if (dy < 0) { - L = -dy; - rdy = -l; - } - } else if (dy == 0) { - L = dx; - rdx = l; - rdy = 0; - if (dx < 0) { - L = -dx; - rdx = -l; - } - } else { - L = hypot ((double) dx, (double) dy); - r = l / L; - - rdx = r * dx; - rdy = r * dy; - } - k = l * L; - LRemain = L; - /* All position comments are relative to a line with dx and dy > 0, - * but the code does not depend on this */ - /* top */ - slopes[V_TOP].dx = dx; - slopes[V_TOP].dy = dy; - slopes[V_TOP].k = k; - /* right */ - slopes[V_RIGHT].dx = -dy; - slopes[V_RIGHT].dy = dx; - slopes[V_RIGHT].k = 0; - /* bottom */ - slopes[V_BOTTOM].dx = -dx; - slopes[V_BOTTOM].dy = -dy; - slopes[V_BOTTOM].k = k; - /* left */ - slopes[V_LEFT].dx = dy; - slopes[V_LEFT].dy = -dx; - slopes[V_LEFT].k = 0; - - /* preload the start coordinates */ - vertices[V_RIGHT].x = vertices[V_TOP].x = rdy; - vertices[V_RIGHT].y = vertices[V_TOP].y = -rdx; - - vertices[V_BOTTOM].x = vertices[V_LEFT].x = -rdy; - vertices[V_BOTTOM].y = vertices[V_LEFT].y = rdx; - - if (projectLeft) { - vertices[V_TOP].x -= rdx; - vertices[V_TOP].y -= rdy; - - vertices[V_LEFT].x -= rdx; - vertices[V_LEFT].y -= rdy; - - slopes[V_LEFT].k = rdx * dx + rdy * dy; - } - - lcenterx = x1; - lcentery = y1; - - if (pGC->capStyle == CapRound) { - lcapFace.dx = dx; - lcapFace.dy = dy; - lcapFace.x = x1; - lcapFace.y = y1; - - rcapFace.dx = -dx; - rcapFace.dy = -dy; - rcapFace.x = x1; - rcapFace.y = y1; - } - while (LRemain > dashRemain) { - dashDx = (dashRemain * dx) / L; - dashDy = (dashRemain * dy) / L; - - rcenterx = lcenterx + dashDx; - rcentery = lcentery + dashDy; - - vertices[V_RIGHT].x += dashDx; - vertices[V_RIGHT].y += dashDy; - - vertices[V_BOTTOM].x += dashDx; - vertices[V_BOTTOM].y += dashDy; - - slopes[V_RIGHT].k = vertices[V_RIGHT].x * dx + vertices[V_RIGHT].y * dy; - - if (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1)) { - if (pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapProjecting) { - saveRight = vertices[V_RIGHT]; - saveBottom = vertices[V_BOTTOM]; - saveK = slopes[V_RIGHT].k; - - if (!first) { - vertices[V_TOP].x -= rdx; - vertices[V_TOP].y -= rdy; - - vertices[V_LEFT].x -= rdx; - vertices[V_LEFT].y -= rdy; - - slopes[V_LEFT].k = vertices[V_LEFT].x * - slopes[V_LEFT].dy - vertices[V_LEFT].y * slopes[V_LEFT].dx; - } - - vertices[V_RIGHT].x += rdx; - vertices[V_RIGHT].y += rdy; - - vertices[V_BOTTOM].x += rdx; - vertices[V_BOTTOM].y += rdy; - - slopes[V_RIGHT].k = vertices[V_RIGHT].x * - slopes[V_RIGHT].dy - vertices[V_RIGHT].y * slopes[V_RIGHT].dx; - } - y = miPolyBuildPoly (vertices, slopes, 4, x1, y1, left, right, &nleft, &nright, &h); - foreground = (dashIndex & 1) == 0; - miFillPolyHelper (pGC, foreground, spanData, y, h, left, right, nleft, nright); - - if (pGC->lineStyle == LineOnOffDash) { - switch (pGC->capStyle) { - case CapProjecting: - vertices[V_BOTTOM] = saveBottom; - vertices[V_RIGHT] = saveRight; - slopes[V_RIGHT].k = saveK; - break; - case CapRound: - if (!first) { - if (dx < 0) { - lcapFace.xa = -vertices[V_LEFT].x; - lcapFace.ya = -vertices[V_LEFT].y; - lcapFace.k = slopes[V_LEFT].k; - } else { - lcapFace.xa = vertices[V_TOP].x; - lcapFace.ya = vertices[V_TOP].y; - lcapFace.k = -slopes[V_LEFT].k; - } - miLineArc (pGC, foreground, spanData, - &lcapFace, (LineFacePtr) NULL, lcenterx, lcentery, FALSE); - } - if (dx < 0) { - rcapFace.xa = vertices[V_BOTTOM].x; - rcapFace.ya = vertices[V_BOTTOM].y; - rcapFace.k = slopes[V_RIGHT].k; - } else { - rcapFace.xa = -vertices[V_RIGHT].x; - rcapFace.ya = -vertices[V_RIGHT].y; - rcapFace.k = -slopes[V_RIGHT].k; - } - miLineArc (pGC, foreground, spanData, - (LineFacePtr) NULL, &rcapFace, rcenterx, rcentery, FALSE); - break; - } - } - } - LRemain -= dashRemain; - ++dashIndex; - if (dashIndex == pGC->numInDashList) - dashIndex = 0; - dashRemain = pDash[dashIndex]; - - lcenterx = rcenterx; - lcentery = rcentery; - - vertices[V_TOP] = vertices[V_RIGHT]; - vertices[V_LEFT] = vertices[V_BOTTOM]; - slopes[V_LEFT].k = -slopes[V_RIGHT].k; - first = FALSE; - } - - if (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1)) { - vertices[V_TOP].x -= dx; - vertices[V_TOP].y -= dy; - - vertices[V_LEFT].x -= dx; - vertices[V_LEFT].y -= dy; - - vertices[V_RIGHT].x = rdy; - vertices[V_RIGHT].y = -rdx; - - vertices[V_BOTTOM].x = -rdy; - vertices[V_BOTTOM].y = rdx; - - - if (projectRight) { - vertices[V_RIGHT].x += rdx; - vertices[V_RIGHT].y += rdy; - - vertices[V_BOTTOM].x += rdx; - vertices[V_BOTTOM].y += rdy; - slopes[V_RIGHT].k = vertices[V_RIGHT].x * - slopes[V_RIGHT].dy - vertices[V_RIGHT].y * slopes[V_RIGHT].dx; - } else - slopes[V_RIGHT].k = 0; - - if (!first && pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapProjecting) { - vertices[V_TOP].x -= rdx; - vertices[V_TOP].y -= rdy; - - vertices[V_LEFT].x -= rdx; - vertices[V_LEFT].y -= rdy; - slopes[V_LEFT].k = vertices[V_LEFT].x * - slopes[V_LEFT].dy - vertices[V_LEFT].y * slopes[V_LEFT].dx; - } else - slopes[V_LEFT].k += dx * dx + dy * dy; - - - y = miPolyBuildPoly (vertices, slopes, 4, x2, y2, left, right, &nleft, &nright, &h); - - foreground = (dashIndex & 1) == 0; - miFillPolyHelper (pGC, foreground, spanData, y, h, left, right, nleft, nright); - if (!first && pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapRound) { - lcapFace.x = x2; - lcapFace.y = y2; - if (dx < 0) { - lcapFace.xa = -vertices[V_LEFT].x; - lcapFace.ya = -vertices[V_LEFT].y; - lcapFace.k = slopes[V_LEFT].k; - } else { - lcapFace.xa = vertices[V_TOP].x; - lcapFace.ya = vertices[V_TOP].y; - lcapFace.k = -slopes[V_LEFT].k; - } - miLineArc (pGC, foreground, spanData, - &lcapFace, (LineFacePtr) NULL, rcenterx, rcentery, FALSE); - } - } - dashRemain = (int)(((double) dashRemain) - LRemain); - if (dashRemain == 0) { - dashIndex++; - if (dashIndex == pGC->numInDashList) - dashIndex = 0; - dashRemain = pDash[dashIndex]; - } - - leftFace->x = x1; - leftFace->y = y1; - leftFace->dx = dx; - leftFace->dy = dy; - leftFace->xa = rdy; - leftFace->ya = -rdx; - leftFace->k = k; - - rightFace->x = x2; - rightFace->y = y2; - rightFace->dx = -dx; - rightFace->dy = -dy; - rightFace->xa = -rdy; - rightFace->ya = rdx; - rightFace->k = k; - - *pDashIndex = dashIndex; - *pDashOffset = pDash[dashIndex] - dashRemain; -} - -void -miWideDash (GCPtr pGC, int mode, int npt, DDXPointPtr pPts) -{ - int x1, y1, x2, y2; - Boolean foreground; - Boolean projectLeft, projectRight; - LineFaceRec leftFace, rightFace, prevRightFace; - LineFaceRec firstFace; - int first; - int dashIndex, dashOffset; - int prevDashIndex; - SpanDataRec spanDataRec; - SpanDataPtr spanData; - Boolean somethingDrawn = FALSE; - Boolean selfJoin; - Boolean endIsFg = FALSE, startIsFg = FALSE; - Boolean firstIsFg = FALSE, prevIsFg = FALSE; - - if (npt == 0) - return; - spanData = miSetupSpanData (pGC, &spanDataRec, npt); - x2 = pPts->x; - y2 = pPts->y; - first = TRUE; - selfJoin = FALSE; - if (mode == CoordModePrevious) { - int nptTmp; - DDXPointPtr pPtsTmp; - - x1 = x2; - y1 = y2; - nptTmp = npt; - pPtsTmp = pPts + 1; - while (--nptTmp) { - x1 += pPtsTmp->x; - y1 += pPtsTmp->y; - ++pPtsTmp; - } - if (x2 == x1 && y2 == y1) - selfJoin = TRUE; - } else if (x2 == pPts[npt - 1].x && y2 == pPts[npt - 1].y) { - selfJoin = TRUE; - } - projectLeft = pGC->capStyle == CapProjecting && !selfJoin; - projectRight = FALSE; - dashIndex = 0; - dashOffset = 0; - miStepDash ((int) pGC->dashOffset, &dashIndex, - pGC->dash, (int) pGC->numInDashList, &dashOffset); - while (--npt) { - x1 = x2; - y1 = y2; - ++pPts; - x2 = pPts->x; - y2 = pPts->y; - if (mode == CoordModePrevious) { - x2 += x1; - y2 += y1; - } - if (x1 != x2 || y1 != y2) { - somethingDrawn = TRUE; - if (npt == 1 && pGC->capStyle == CapProjecting && (!selfJoin || !firstIsFg)) - projectRight = TRUE; - prevDashIndex = dashIndex; - miWideDashSegment (pGC, spanData, &dashOffset, &dashIndex, - x1, y1, x2, y2, projectLeft, projectRight, &leftFace, &rightFace); - startIsFg = !(prevDashIndex & 1); - endIsFg = (dashIndex & 1) ^ (dashOffset != 0); - if (pGC->lineStyle == LineDoubleDash || startIsFg) { - foreground = startIsFg; - if (first || (pGC->lineStyle == LineOnOffDash && !prevIsFg)) { - if (first && selfJoin) { - firstFace = leftFace; - firstIsFg = startIsFg; - } else if (pGC->capStyle == CapRound) - miLineArc (pGC, foreground, spanData, - &leftFace, (LineFacePtr) NULL, (double) 0.0, (double) 0.0, TRUE); - } else { - miLineJoin (pGC, foreground, spanData, &leftFace, &prevRightFace); - } - } - prevRightFace = rightFace; - prevIsFg = endIsFg; - first = FALSE; - projectLeft = FALSE; - } - if (npt == 1 && somethingDrawn) { - if (pGC->lineStyle == LineDoubleDash || endIsFg) { - foreground = endIsFg; - if (selfJoin && (pGC->lineStyle == LineDoubleDash || firstIsFg)) { - miLineJoin (pGC, foreground, spanData, &firstFace, &rightFace); - } else { - if (pGC->capStyle == CapRound) - miLineArc (pGC, foreground, spanData, - (LineFacePtr) NULL, &rightFace, - (double) 0.0, (double) 0.0, TRUE); - } - } else { - /* glue a cap to the start of the line if - * we're OnOffDash and ended on odd dash - */ - if (selfJoin && firstIsFg) { - foreground = TRUE; - if (pGC->capStyle == CapProjecting) - miLineProjectingCap (pGC, foreground, spanData, - &firstFace, TRUE, (double) 0.0, (double) 0.0, TRUE); - else if (pGC->capStyle == CapRound) - miLineArc (pGC, foreground, spanData, - &firstFace, (LineFacePtr) NULL, - (double) 0.0, (double) 0.0, TRUE); - } - } - } - } - /* handle crock where all points are coincident */ - if (!somethingDrawn && (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1))) { - /* not the same as endIsFg computation above */ - foreground = (dashIndex & 1) == 0; - switch (pGC->capStyle) { - case CapRound: - miLineArc (pGC, foreground, spanData, - (LineFacePtr) NULL, (LineFacePtr) NULL, (double) x2, (double) y2, FALSE); - break; - case CapProjecting: - x1 = pGC->lineWidth; - miFillRectPolyHelper (pGC, foreground, spanData, - x2 - (x1 >> 1), y2 - (x1 >> 1), x1, x1); - break; - } - } - if (spanData) - miCleanupSpanData (pGC, spanData); -} - -#undef ExchangeSpans -#define ExchangeSpans(a, b) \ -{ \ - DDXPointRec tpt; \ - int tw; \ - \ - tpt = spans[a]; spans[a] = spans[b]; spans[b] = tpt; \ - tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \ -} - -static void QuickSortSpans( - DDXPointRec spans[], - int widths[], - int numSpans) -{ - int y; - int i, j, m; - DDXPointPtr r; - - /* Always called with numSpans > 1 */ - /* Sorts only by y, doesn't bother to sort by x */ - - do - { - if (numSpans < 9) - { - /* Do insertion sort */ - int yprev; - - yprev = spans[0].y; - i = 1; - do - { /* while i != numSpans */ - y = spans[i].y; - if (yprev > y) - { - /* spans[i] is out of order. Move into proper location. */ - DDXPointRec tpt; - int tw, k; - - for (j = 0; y >= spans[j].y; j++) {} - tpt = spans[i]; - tw = widths[i]; - for (k = i; k != j; k--) - { - spans[k] = spans[k-1]; - widths[k] = widths[k-1]; - } - spans[j] = tpt; - widths[j] = tw; - y = spans[i].y; - } /* if out of order */ - yprev = y; - i++; - } while (i != numSpans); - return; - } - - /* Choose partition element, stick in location 0 */ - m = numSpans / 2; - if (spans[m].y > spans[0].y) ExchangeSpans(m, 0); - if (spans[m].y > spans[numSpans-1].y) ExchangeSpans(m, numSpans-1); - if (spans[m].y > spans[0].y) ExchangeSpans(m, 0); - y = spans[0].y; - - /* Partition array */ - i = 0; - j = numSpans; - do - { - r = &(spans[i]); - do - { - r++; - i++; - } while (i != numSpans && r->y < y); - r = &(spans[j]); - do - { - r--; - j--; - } while (y < r->y); - if (i < j) - ExchangeSpans(i, j); - } while (i < j); - - /* Move partition element back to middle */ - ExchangeSpans(0, j); - - /* Recurse */ - if (numSpans-j-1 > 1) - QuickSortSpans(&spans[j+1], &widths[j+1], numSpans-j-1); - numSpans = j; - } while (numSpans > 1); -} - -#define NextBand() \ -{ \ - clipy1 = pboxBandStart->y1; \ - clipy2 = pboxBandStart->y2; \ - pboxBandEnd = pboxBandStart + 1; \ - while (pboxBandEnd != pboxLast && pboxBandEnd->y1 == clipy1) { \ - pboxBandEnd++; \ - } \ - for (; ppt != pptLast && ppt->y < clipy1; ppt++, pwidth++) {} \ -} - -/* - Clip a list of scanlines to a region. The caller has allocated the - space. FSorted is non-zero if the scanline origins are in ascending - order. - returns the number of new, clipped scanlines. -*/ - -int spice_canvas_clip_spans(pixman_region32_t *prgnDst, - DDXPointPtr ppt, - int *pwidth, - int nspans, - DDXPointPtr pptNew, - int *pwidthNew, - int fSorted) -{ - DDXPointPtr pptLast; - int *pwidthNewStart; /* the vengeance of Xerox! */ - int y, x1, x2; - int numRects; - pixman_box32_t *pboxBandStart; - - pptLast = ppt + nspans; - pwidthNewStart = pwidthNew; - - pboxBandStart = pixman_region32_rectangles (prgnDst, &numRects); - - if (numRects == 1) { - /* Do special fast code with clip boundaries in registers(?) */ - /* It doesn't pay much to make use of fSorted in this case, - so we lump everything together. */ - - int clipx1, clipx2, clipy1, clipy2; - - clipx1 = pboxBandStart->x1; - clipy1 = pboxBandStart->y1; - clipx2 = pboxBandStart->x2; - clipy2 = pboxBandStart->y2; - - for (; ppt != pptLast; ppt++, pwidth++) { - y = ppt->y; - x1 = ppt->x; - if (clipy1 <= y && y < clipy2) { - x2 = x1 + *pwidth; - if (x1 < clipx1) - x1 = clipx1; - if (x2 > clipx2) - x2 = clipx2; - if (x1 < x2) { - /* part of span in clip rectangle */ - pptNew->x = x1; - pptNew->y = y; - *pwidthNew = x2 - x1; - pptNew++; - pwidthNew++; - } - } - } /* end for */ - } else if (numRects != 0) { - /* Have to clip against many boxes */ - pixman_box32_t *pboxBandEnd, *pbox, *pboxLast; - int clipy1, clipy2; - - /* In this case, taking advantage of sorted spans gains more than - the sorting costs. */ - if ((! fSorted) && (nspans > 1)) - QuickSortSpans(ppt, pwidth, nspans); - - pboxLast = pboxBandStart + numRects; - - NextBand(); - - for (; ppt != pptLast; ) { - y = ppt->y; - if (y < clipy2) { - /* span is in the current band */ - pbox = pboxBandStart; - x1 = ppt->x; - x2 = x1 + *pwidth; - do { /* For each box in band */ - int newx1, newx2; - - newx1 = x1; - newx2 = x2; - if (newx1 < pbox->x1) - newx1 = pbox->x1; - if (newx2 > pbox->x2) - newx2 = pbox->x2; - if (newx1 < newx2) { - /* Part of span in clip rectangle */ - pptNew->x = newx1; - pptNew->y = y; - *pwidthNew = newx2 - newx1; - pptNew++; - pwidthNew++; - } - pbox++; - } while (pbox != pboxBandEnd); - ppt++; - pwidth++; - } else { - /* Move to next band, adjust ppt as needed */ - pboxBandStart = pboxBandEnd; - if (pboxBandStart == pboxLast) - break; /* We're completely done */ - NextBand(); - } - } - } - return (pwidthNew - pwidthNewStart); -} diff -Nru spice-gtk-0.9/common/lines.h spice-gtk-0.12/common/lines.h --- spice-gtk-0.9/common/lines.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/lines.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,130 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef LINES_H -#define LINES_H - -#include -#include -#include -#include "draw.h" - -typedef struct lineGC lineGC; - -typedef struct { - void (*FillSpans)(lineGC * pGC, - int num_spans, SpicePoint * points, int *widths, - int sorted, int foreground); - void (*FillRects)(lineGC * pGC, - int nun_rects, pixman_rectangle32_t * rects, - int foreground); -} lineGCOps; - -struct lineGC { - int width; - int height; - unsigned char alu; - unsigned short lineWidth; - unsigned short dashOffset; - unsigned short numInDashList; - unsigned char *dash; - unsigned int lineStyle:2; - unsigned int capStyle:2; - unsigned int joinStyle:2; - lineGCOps *ops; -}; - -/* CoordinateMode for drawing routines */ - -#define CoordModeOrigin 0 /* relative to the origin */ -#define CoordModePrevious 1 /* relative to previous point */ - -/* LineStyle */ - -#define LineSolid 0 -#define LineOnOffDash 1 -#define LineDoubleDash 2 - -/* capStyle */ - -#define CapNotLast 0 -#define CapButt 1 -#define CapRound 2 -#define CapProjecting 3 - -/* joinStyle */ - -#define JoinMiter 0 -#define JoinRound 1 -#define JoinBevel 2 - -extern void spice_canvas_zero_line(lineGC *pgc, - int mode, - int num_points, - SpicePoint * points); -extern void spice_canvas_zero_dash_line(lineGC * pgc, - int mode, - int n_points, - SpicePoint * points); -extern void spice_canvas_wide_dash_line(lineGC * pGC, - int mode, - int num_points, - SpicePoint * points); -extern void spice_canvas_wide_line(lineGC *pGC, - int mode, - int num_points, - SpicePoint * points); -extern int spice_canvas_clip_spans(pixman_region32_t *clip_region, - SpicePoint *points, - int *widths, - int num_spans, - SpicePoint *new_points, - int *new_widths, - int sorted); - -#endif /* LINES_H */ diff -Nru spice-gtk-0.9/common/lz.c spice-gtk-0.12/common/lz.c --- spice-gtk-0.9/common/lz.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/lz.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,738 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - - Copyright 2009 Red Hat, Inc. and/or its affiliates. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . - - This file incorporates work covered by the following copyright and - permission notice: - Copyright (C) 2007 Ariya Hidayat (ariya@kde.org) - Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) - Copyright (C) 2005 Ariya Hidayat (ariya@kde.org) - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the "Software"), to deal in the Software without - restriction, including without limitation the rights to use, copy, - modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - -*/ - -#include "lz.h" - -#define DEBUG - -#ifdef DEBUG - -#define ASSERT(usr, x) \ - if (!(x)) (usr)->error(usr, "%s: ASSERT %s failed\n", __FUNCTION__, #x); - -#else - -#define ASSERT(usr, x) - -#endif - -#define HASH_LOG 13 -#define HASH_SIZE (1 << HASH_LOG) -#define HASH_MASK (HASH_SIZE - 1) - - -typedef struct LzImageSegment LzImageSegment; -struct LzImageSegment { - uint8_t *lines; - uint8_t *lines_end; - unsigned int size_delta; // total size of the previous segments in units of - // pixels for rgb and bytes for plt. - LzImageSegment *next; -}; - -// TODO: pack? -typedef struct HashEntry { - LzImageSegment *image_seg; - uint8_t *ref; -} HashEntry; - -typedef struct Encoder { - LzUsrContext *usr; - - LzImageType type; - const SpicePalette *palette; // for decoding images with palettes to rgb - int stride; // stride is in bytes. For rgb must be equal to - // width*bytes_per_pix. - // For palettes stride can be bigger than width/pixels_per_byte by 1 only if - // width%pixels_per_byte != 0. - int height; - int width; // the original width (in pixels) - - LzImageSegment *head_image_segs; - LzImageSegment *tail_image_segs; - LzImageSegment *free_image_segs; - - // the dictionary hash table is composed (1) a pointer to the segment the word was found in - // (2) a pointer to the first byte in the segment that matches the word - HashEntry htab[HASH_SIZE]; - - uint8_t *io_start; - uint8_t *io_now; - uint8_t *io_end; - size_t io_bytes_count; - - uint8_t *io_last_copy; // pointer to the last byte in which copy count was written -} Encoder; - -/****************************************************/ -/* functions for managing the pool of image segments*/ -/****************************************************/ -static INLINE LzImageSegment *lz_alloc_image_seg(Encoder *encoder); -static void lz_reset_image_seg(Encoder *encoder); -static int lz_read_image_segments(Encoder *encoder, uint8_t *first_lines, - unsigned int num_first_lines); - - -// return a free image segment if one exists. Make allocation if needed. adds it to the -// tail of the image segments lists -static INLINE LzImageSegment *lz_alloc_image_seg(Encoder *encoder) -{ - LzImageSegment *ret; - - if (encoder->free_image_segs) { - ret = encoder->free_image_segs; - encoder->free_image_segs = ret->next; - } else { - if (!(ret = (LzImageSegment *)encoder->usr->malloc(encoder->usr, sizeof(*ret)))) { - return NULL; - } - } - - ret->next = NULL; - if (encoder->tail_image_segs) { - encoder->tail_image_segs->next = ret; - } - encoder->tail_image_segs = ret; - - if (!encoder->head_image_segs) { - encoder->head_image_segs = ret; - } - - return ret; -} - -// adding seg to the head of free segments (lz_reset_image_seg removes it from used ones) -static INLINE void __lz_free_image_seg(Encoder *encoder, LzImageSegment *seg) -{ - seg->next = encoder->free_image_segs; - encoder->free_image_segs = seg; -} - -// moves all the used image segments to the free pool -static void lz_reset_image_seg(Encoder *encoder) -{ - while (encoder->head_image_segs) { - LzImageSegment *seg = encoder->head_image_segs; - encoder->head_image_segs = seg->next; - __lz_free_image_seg(encoder, seg); - } - encoder->tail_image_segs = NULL; -} - -static void lz_dealloc_free_segments(Encoder *encoder) -{ - while (encoder->free_image_segs) { - LzImageSegment *seg = encoder->free_image_segs; - encoder->free_image_segs = seg->next; - encoder->usr->free(encoder->usr, seg); - } -} - -// return FALSE when operation fails (due to failure in allocation) -static int lz_read_image_segments(Encoder *encoder, uint8_t *first_lines, - unsigned int num_first_lines) -{ - LzImageSegment *image_seg; - uint32_t size_delta = 0; - unsigned int num_lines = num_first_lines; - uint8_t* lines = first_lines; - int row; - - ASSERT(encoder->usr, !encoder->head_image_segs); - - image_seg = lz_alloc_image_seg(encoder); - if (!image_seg) { - goto error_1; - } - - image_seg->lines = lines; - image_seg->lines_end = lines + num_lines * encoder->stride; - image_seg->size_delta = size_delta; - - size_delta += num_lines * encoder->stride / RGB_BYTES_PER_PIXEL[encoder->type]; - - for (row = num_first_lines; row < encoder->height; row += num_lines) { - num_lines = encoder->usr->more_lines(encoder->usr, &lines); - if (num_lines <= 0) { - encoder->usr->error(encoder->usr, "more lines failed\n"); - } - image_seg = lz_alloc_image_seg(encoder); - - if (!image_seg) { - goto error_1; - } - - image_seg->lines = lines; - image_seg->lines_end = lines + num_lines * encoder->stride; - image_seg->size_delta = size_delta; - - size_delta += num_lines * encoder->stride / RGB_BYTES_PER_PIXEL[encoder->type]; - } - - return TRUE; -error_1: - lz_reset_image_seg(encoder); - return FALSE; -} - -/************************************************************************** -* Handling encoding and decoding of a byte -***************************************************************************/ -static INLINE int more_io_bytes(Encoder *encoder) -{ - uint8_t *io_ptr; - int num_io_bytes = encoder->usr->more_space(encoder->usr, &io_ptr); - encoder->io_bytes_count += num_io_bytes; - encoder->io_now = io_ptr; - encoder->io_end = encoder->io_now + num_io_bytes; - return num_io_bytes; -} - -static INLINE void encode(Encoder *encoder, uint8_t byte) -{ - if (encoder->io_now == encoder->io_end) { - if (more_io_bytes(encoder) <= 0) { - encoder->usr->error(encoder->usr, "%s: no more bytes\n", __FUNCTION__); - } - ASSERT(encoder->usr, encoder->io_now); - } - - ASSERT(encoder->usr, encoder->io_now < encoder->io_end); - *(encoder->io_now++) = byte; -} - -static INLINE void encode_32(Encoder *encoder, unsigned int word) -{ - encode(encoder, (uint8_t)(word >> 24)); - encode(encoder, (uint8_t)(word >> 16) & 0x0000ff); - encode(encoder, (uint8_t)(word >> 8) & 0x0000ff); - encode(encoder, (uint8_t)(word & 0x0000ff)); -} - -static INLINE void encode_copy_count(Encoder *encoder, uint8_t copy_count) -{ - encode(encoder, copy_count); - encoder->io_last_copy = encoder->io_now - 1; // io_now cannot be the first byte of the buffer -} - -static INLINE void update_copy_count(Encoder *encoder, uint8_t copy_count) -{ - ASSERT(encoder->usr, encoder->io_last_copy); - *(encoder->io_last_copy) = copy_count; -} - -static INLINE void encode_level(Encoder *encoder, uint8_t level_code) -{ - *(encoder->io_start) |= level_code; -} - -// decrease the io ptr by 1 -static INLINE void compress_output_prev(Encoder *encoder) -{ - // io_now cannot be the first byte of the buffer - encoder->io_now--; - // the function should be called only when copy count is written unnecessarily by lz_compress - ASSERT(encoder->usr, encoder->io_now == encoder->io_last_copy) -} - -static int encoder_reset(Encoder *encoder, uint8_t *io_ptr, uint8_t *io_ptr_end) -{ - ASSERT(encoder->usr, io_ptr <= io_ptr_end); - encoder->io_bytes_count = io_ptr_end - io_ptr; - encoder->io_start = io_ptr; - encoder->io_now = io_ptr; - encoder->io_end = io_ptr_end; - encoder->io_last_copy = NULL; - - return TRUE; -} - -static INLINE uint8_t decode(Encoder *encoder) -{ - if (encoder->io_now == encoder->io_end) { - int num_io_bytes = more_io_bytes(encoder); - if (num_io_bytes <= 0) { - encoder->usr->error(encoder->usr, "%s: no more bytes\n", __FUNCTION__); - } - ASSERT(encoder->usr, encoder->io_now); - } - ASSERT(encoder->usr, encoder->io_now < encoder->io_end); - return *(encoder->io_now++); -} - -static INLINE uint32_t decode_32(Encoder *encoder) -{ - uint32_t word = 0; - word |= decode(encoder); - word <<= 8; - word |= decode(encoder); - word <<= 8; - word |= decode(encoder); - word <<= 8; - word |= decode(encoder); - return word; -} - -static INLINE int is_io_to_decode_end(Encoder *encoder) -{ - if (encoder->io_now != encoder->io_end) { - return FALSE; - } else { - int num_io_bytes = more_io_bytes(encoder); //disable inline optimizations - return (num_io_bytes <= 0); - } -} - -/******************************************************************* -* intialization and finalization of lz -********************************************************************/ -static int init_encoder(Encoder *encoder, LzUsrContext *usr) -{ - encoder->usr = usr; - encoder->free_image_segs = NULL; - encoder->head_image_segs = NULL; - encoder->tail_image_segs = NULL; - return TRUE; -} - -LzContext *lz_create(LzUsrContext *usr) -{ - Encoder *encoder; - - if (!usr || !usr->error || !usr->warn || !usr->info || !usr->malloc || - !usr->free || !usr->more_space || !usr->more_lines) { - return NULL; - } - - if (!(encoder = (Encoder *)usr->malloc(usr, sizeof(Encoder)))) { - return NULL; - } - - if (!init_encoder(encoder, usr)) { - usr->free(usr, encoder); - return NULL; - } - return (LzContext *)encoder; -} - -void lz_destroy(LzContext *lz) -{ - Encoder *encoder = (Encoder *)lz; - - if (!lz) { - return; - } - - if (encoder->head_image_segs) { - encoder->usr->error(encoder->usr, "%s: used_image_segments not empty\n", __FUNCTION__); - lz_reset_image_seg(encoder); - } - lz_dealloc_free_segments(encoder); - - encoder->usr->free(encoder->usr, encoder); -} - -/******************************************************************* -* encoding and decoding the image -********************************************************************/ -/* - * Give hints to the compiler for branch prediction optimization. - */ -#if defined(__GNUC__) && (__GNUC__ > 2) -#define LZ_EXPECT_CONDITIONAL(c) (__builtin_expect((c), 1)) -#define LZ_UNEXPECT_CONDITIONAL(c) (__builtin_expect((c), 0)) -#else -#define LZ_EXPECT_CONDITIONAL(c) (c) -#define LZ_UNEXPECT_CONDITIONAL(c) (c) -#endif - - -#ifdef __GNUC__ -#define ATTR_PACKED __attribute__ ((__packed__)) -#else -#define ATTR_PACKED -#pragma pack(push) -#pragma pack(1) -#endif - - -/* the palette images will be treated as one byte pixels. Their width should be transformed - accordingly. -*/ -typedef struct ATTR_PACKED one_byte_pixel_t { - uint8_t a; -} one_byte_pixel_t; - -typedef struct ATTR_PACKED rgb32_pixel_t { - uint8_t b; - uint8_t g; - uint8_t r; - uint8_t pad; -} rgb32_pixel_t; - -typedef struct ATTR_PACKED rgb24_pixel_t { - uint8_t b; - uint8_t g; - uint8_t r; -} rgb24_pixel_t; - -typedef uint16_t rgb16_pixel_t; - -#ifndef __GNUC__ -#pragma pack(pop) -#endif - -#undef ATTR_PACKED - - -#define MAX_COPY 32 -#define MAX_LEN 264 /* 256 + 8 */ -#define BOUND_OFFSET 2 -#define LIMIT_OFFSET 6 -#define MIN_FILE_SIZE 4 -#define COMP_LEVEL_SIZE_LIMIT 65536 - -// TODO: implemented lz2. should lz1 be an option (no RLE + distance limitation of MAX_DISTANCE) -// TODO: I think MAX_FARDISTANCE can be changed easily to 2^29 -// (and maybe even more when pixel > byte). -// i.e. we can support 512M Bytes/Pixels distance instead of only ~68K. -#define MAX_DISTANCE 8191 // 2^13 -#define MAX_FARDISTANCE (65535 + MAX_DISTANCE - 1) // ~2^16+2^13 - - -#define LZ_PLT -#include "lz_compress_tmpl.c" -#define LZ_PLT -#include "lz_decompress_tmpl.c" - -#define LZ_PLT -#define PLT8 -#define TO_RGB32 -#include "lz_decompress_tmpl.c" - -#define LZ_PLT -#define PLT4_BE -#define TO_RGB32 -#include "lz_decompress_tmpl.c" - -#define LZ_PLT -#define PLT4_LE -#define TO_RGB32 -#include "lz_decompress_tmpl.c" - -#define LZ_PLT -#define PLT1_BE -#define TO_RGB32 -#include "lz_decompress_tmpl.c" - -#define LZ_PLT -#define PLT1_LE -#define TO_RGB32 -#include "lz_decompress_tmpl.c" - - -#define LZ_RGB16 -#include "lz_compress_tmpl.c" -#define LZ_RGB16 -#include "lz_decompress_tmpl.c" -#define LZ_RGB16 -#define TO_RGB32 -#include "lz_decompress_tmpl.c" - -#define LZ_RGB24 -#include "lz_compress_tmpl.c" -#define LZ_RGB24 -#include "lz_decompress_tmpl.c" - - -#define LZ_RGB32 -#include "lz_compress_tmpl.c" -#define LZ_RGB32 -#include "lz_decompress_tmpl.c" - -#define LZ_RGB_ALPHA -#include "lz_compress_tmpl.c" -#define LZ_RGB_ALPHA -#include "lz_decompress_tmpl.c" - -#undef LZ_UNEXPECT_CONDITIONAL -#undef LZ_EXPECT_CONDITIONAL - -int lz_encode(LzContext *lz, LzImageType type, int width, int height, int top_down, - uint8_t *lines, unsigned int num_lines, int stride, - uint8_t *io_ptr, unsigned int num_io_bytes) -{ - Encoder *encoder = (Encoder *)lz; - uint8_t *io_ptr_end = io_ptr + num_io_bytes; - - encoder->type = type; - encoder->width = width; - encoder->height = height; - encoder->stride = stride; - - if (IS_IMAGE_TYPE_PLT[encoder->type]) { - if (encoder->stride > (width / PLT_PIXELS_PER_BYTE[encoder->type])) { - if (((width % PLT_PIXELS_PER_BYTE[encoder->type]) == 0) || ( - (encoder->stride - (width / PLT_PIXELS_PER_BYTE[encoder->type])) > 1)) { - encoder->usr->error(encoder->usr, "stride overflows (plt)\n"); - } - } - } else { - if (encoder->stride != width * RGB_BYTES_PER_PIXEL[encoder->type]) { - encoder->usr->error(encoder->usr, "stride != width*bytes_per_pixel (rgb)\n"); - } - } - - // assign the output buffer - if (!encoder_reset(encoder, io_ptr, io_ptr_end)) { - encoder->usr->error(encoder->usr, "lz encoder io reset failed\n"); - } - - // first read the list of the image segments - if (!lz_read_image_segments(encoder, lines, num_lines)) { - encoder->usr->error(encoder->usr, "lz encoder reading image segments failed\n"); - } - - encode_32(encoder, LZ_MAGIC); - encode_32(encoder, LZ_VERSION); - encode_32(encoder, type); - encode_32(encoder, width); - encode_32(encoder, height); - encode_32(encoder, stride); - encode_32(encoder, top_down); // TODO: maybe compress type and top_down to one byte - - switch (encoder->type) { - case LZ_IMAGE_TYPE_PLT1_BE: - case LZ_IMAGE_TYPE_PLT1_LE: - case LZ_IMAGE_TYPE_PLT4_BE: - case LZ_IMAGE_TYPE_PLT4_LE: - case LZ_IMAGE_TYPE_PLT8: - lz_plt_compress(encoder); - break; - case LZ_IMAGE_TYPE_RGB16: - lz_rgb16_compress(encoder); - break; - case LZ_IMAGE_TYPE_RGB24: - lz_rgb24_compress(encoder); - break; - case LZ_IMAGE_TYPE_RGB32: - lz_rgb32_compress(encoder); - break; - case LZ_IMAGE_TYPE_RGBA: - lz_rgb32_compress(encoder); - lz_rgb_alpha_compress(encoder); - break; - case LZ_IMAGE_TYPE_XXXA: - lz_rgb_alpha_compress(encoder); - break; - case LZ_IMAGE_TYPE_INVALID: - default: - encoder->usr->error(encoder->usr, "bad image type\n"); - } - - // move all the used segments to the free ones - lz_reset_image_seg(encoder); - - encoder->io_bytes_count -= (encoder->io_end - encoder->io_now); - - return encoder->io_bytes_count; -} - -/* - initialize and read lz magic -*/ -void lz_decode_begin(LzContext *lz, uint8_t *io_ptr, unsigned int num_io_bytes, - LzImageType *out_type, int *out_width, int *out_height, - int *out_n_pixels, int *out_top_down, const SpicePalette *palette) -{ - Encoder *encoder = (Encoder *)lz; - uint8_t *io_ptr_end = io_ptr + num_io_bytes; - uint32_t magic; - uint32_t version; - - if (!encoder_reset(encoder, io_ptr, io_ptr_end)) { - encoder->usr->error(encoder->usr, "io reset failed"); - } - - magic = decode_32(encoder); - if (magic != LZ_MAGIC) { - encoder->usr->error(encoder->usr, "bad magic\n"); - } - - version = decode_32(encoder); - if (version != LZ_VERSION) { - encoder->usr->error(encoder->usr, "bad version\n"); - } - - encoder->type = (LzImageType)decode_32(encoder); - encoder->width = decode_32(encoder); - encoder->height = decode_32(encoder); - encoder->stride = decode_32(encoder); - *out_top_down = decode_32(encoder); - - *out_width = encoder->width; - *out_height = encoder->height; -// *out_stride = encoder->stride; - *out_type = encoder->type; - - // TODO: maybe instead of stride we can encode out_n_pixels - // (if stride is not necessary in decoding). - if (IS_IMAGE_TYPE_PLT[encoder->type]) { - encoder->palette = palette; - *out_n_pixels = encoder->stride * PLT_PIXELS_PER_BYTE[encoder->type] * encoder->height; - } else { - *out_n_pixels = encoder->width * encoder->height; - } -} - -void lz_decode(LzContext *lz, LzImageType to_type, uint8_t *buf) -{ - Encoder *encoder = (Encoder *)lz; - size_t out_size = 0; - size_t alpha_size = 0; - size_t size = 0; - if (IS_IMAGE_TYPE_PLT[encoder->type]) { - if (to_type == encoder->type) { - size = encoder->height * encoder->stride; - out_size = lz_plt_decompress(encoder, (one_byte_pixel_t *)buf, size); - } else if (to_type == LZ_IMAGE_TYPE_RGB32) { - size = encoder->height * encoder->stride * PLT_PIXELS_PER_BYTE[encoder->type]; - if (!encoder->palette) { - encoder->usr->error(encoder->usr, - "a palette is missing (for bpp to rgb decoding)\n"); - } - switch (encoder->type) { - case LZ_IMAGE_TYPE_PLT1_BE: - out_size = lz_plt1_be_to_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); - break; - case LZ_IMAGE_TYPE_PLT1_LE: - out_size = lz_plt1_le_to_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); - break; - case LZ_IMAGE_TYPE_PLT4_BE: - out_size = lz_plt4_be_to_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); - break; - case LZ_IMAGE_TYPE_PLT4_LE: - out_size = lz_plt4_le_to_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); - break; - case LZ_IMAGE_TYPE_PLT8: - out_size = lz_plt8_to_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); - break; - case LZ_IMAGE_TYPE_RGB16: - case LZ_IMAGE_TYPE_RGB24: - case LZ_IMAGE_TYPE_RGB32: - case LZ_IMAGE_TYPE_RGBA: - case LZ_IMAGE_TYPE_XXXA: - case LZ_IMAGE_TYPE_INVALID: - default: - encoder->usr->error(encoder->usr, "bad image type\n"); - } - } else { - encoder->usr->error(encoder->usr, "unsupported output format\n"); - } - } else { - size = encoder->height * encoder->width; - switch (encoder->type) { - case LZ_IMAGE_TYPE_RGB16: - if (encoder->type == to_type) { - out_size = lz_rgb16_decompress(encoder, (rgb16_pixel_t *)buf, size); - } else if (to_type == LZ_IMAGE_TYPE_RGB32) { - out_size = lz_rgb16_to_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); - } else { - encoder->usr->error(encoder->usr, "unsupported output format\n"); - } - break; - case LZ_IMAGE_TYPE_RGB24: - if (encoder->type == to_type) { - out_size = lz_rgb24_decompress(encoder, (rgb24_pixel_t *)buf, size); - } else if (to_type == LZ_IMAGE_TYPE_RGB32) { - out_size = lz_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); - } else { - encoder->usr->error(encoder->usr, "unsupported output format\n"); - } - break; - case LZ_IMAGE_TYPE_RGB32: - if (encoder->type == to_type) { - out_size = lz_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); - } else { - encoder->usr->error(encoder->usr, "unsupported output format\n"); - } - break; - case LZ_IMAGE_TYPE_RGBA: - if (encoder->type == to_type) { - out_size = lz_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); - alpha_size = lz_rgb_alpha_decompress(encoder, (rgb32_pixel_t *)buf, size); - ASSERT(encoder->usr, alpha_size == size); - } else { - encoder->usr->error(encoder->usr, "unsupported output format\n"); - } - break; - case LZ_IMAGE_TYPE_XXXA: - if (encoder->type == to_type) { - alpha_size = lz_rgb_alpha_decompress(encoder, (rgb32_pixel_t *)buf, size); - out_size = alpha_size; - } else { - encoder->usr->error(encoder->usr, "unsupported output format\n"); - } - break; - case LZ_IMAGE_TYPE_PLT1_LE: - case LZ_IMAGE_TYPE_PLT1_BE: - case LZ_IMAGE_TYPE_PLT4_LE: - case LZ_IMAGE_TYPE_PLT4_BE: - case LZ_IMAGE_TYPE_PLT8: - case LZ_IMAGE_TYPE_INVALID: - default: - encoder->usr->error(encoder->usr, "bad image type\n"); - } - } - - ASSERT(encoder->usr, is_io_to_decode_end(encoder)); - ASSERT(encoder->usr, out_size == size); - - if (out_size != size) { - encoder->usr->error(encoder->usr, "bad decode size\n"); - } -} - diff -Nru spice-gtk-0.9/common/lz_common.h spice-gtk-0.12/common/lz_common.h --- spice-gtk-0.9/common/lz_common.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/lz_common.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -/*common header for encoder and decoder*/ - -#ifndef _LZ_COMMON_H -#define _LZ_COMMON_H - -//#define DEBUG - -/* change the max window size will require change in the encoding format*/ -#define LZ_MAX_WINDOW_SIZE (1 << 25) -#define MAX_COPY 32 - -typedef enum { - LZ_IMAGE_TYPE_INVALID, - LZ_IMAGE_TYPE_PLT1_LE, - LZ_IMAGE_TYPE_PLT1_BE, // PLT stands for palette - LZ_IMAGE_TYPE_PLT4_LE, - LZ_IMAGE_TYPE_PLT4_BE, - LZ_IMAGE_TYPE_PLT8, - LZ_IMAGE_TYPE_RGB16, - LZ_IMAGE_TYPE_RGB24, - LZ_IMAGE_TYPE_RGB32, - LZ_IMAGE_TYPE_RGBA, - LZ_IMAGE_TYPE_XXXA -} LzImageType; - -#define LZ_IMAGE_TYPE_MASK 0x0f -#define LZ_IMAGE_TYPE_LOG 4 // number of bits required for coding the image type - -/* access to the arrays is based on the image types */ -static const int IS_IMAGE_TYPE_PLT[] = {0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}; -static const int IS_IMAGE_TYPE_RGB[] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}; -static const int PLT_PIXELS_PER_BYTE[] = {0, 8, 8, 2, 2, 1}; -static const int RGB_BYTES_PER_PIXEL[] = {0, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4}; - - -#define LZ_MAGIC (*(uint32_t *)"LZ ") -#define LZ_VERSION_MAJOR 1U -#define LZ_VERSION_MINOR 1U -#define LZ_VERSION ((LZ_VERSION_MAJOR << 16) | (LZ_VERSION_MINOR & 0xffff)) - - -#endif // _LZ_COMMON_H diff -Nru spice-gtk-0.9/common/lz_compress_tmpl.c spice-gtk-0.12/common/lz_compress_tmpl.c --- spice-gtk-0.9/common/lz_compress_tmpl.c 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/lz_compress_tmpl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,526 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - - Copyright 2009 Red Hat, Inc. and/or its affiliates. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - This file incorporates work covered by the following copyright and - permission notice: - Copyright (C) 2007 Ariya Hidayat (ariya@kde.org) - Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) - Copyright (C) 2005 Ariya Hidayat (ariya@kde.org) - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the "Software"), to deal in the Software without - restriction, including without limitation the rights to use, copy, - modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - -*/ - -#define DJB2_START 5381; -#define DJB2_HASH(hash, c) (hash = ((hash << 5) + hash) ^ (c)) //|{hash = ((hash << 5) + hash) + c;} - -/* - For each pixel type the following macros are defined: - PIXEL : input type - FNAME(name) - ENCODE_PIXEL(encoder, pixel) : writing a pixel to the compressed buffer (byte by byte) - SAME_PIXEL(pix1, pix2) : comparing two pixels - HASH_FUNC(value, pix_ptr) : hash func of 3 consecutive pixels -*/ - -#ifdef LZ_PLT -#define PIXEL one_byte_pixel_t -#define FNAME(name) lz_plt_##name -#define ENCODE_PIXEL(e, pix) encode(e, (pix).a) // gets the pixel and write only the needed bytes - // from the pixel -#define SAME_PIXEL(pix1, pix2) ((pix1).a == (pix2).a) -#define HASH_FUNC(v, p) { \ - v = DJB2_START; \ - DJB2_HASH(v, p[0].a); \ - DJB2_HASH(v, p[1].a); \ - DJB2_HASH(v, p[2].a); \ - v &= HASH_MASK; \ - } -#endif - -#ifdef LZ_RGB_ALPHA -//#undef LZ_RGB_ALPHA -#define PIXEL rgb32_pixel_t -#define FNAME(name) lz_rgb_alpha_##name -#define ENCODE_PIXEL(e, pix) {encode(e, (pix).pad);} -#define SAME_PIXEL(pix1, pix2) ((pix1).pad == (pix2).pad) -#define HASH_FUNC(v, p) { \ - v = DJB2_START; \ - DJB2_HASH(v, p[0].pad); \ - DJB2_HASH(v, p[1].pad); \ - DJB2_HASH(v, p[2].pad); \ - v &= HASH_MASK; \ - } -#endif - - -#ifdef LZ_RGB16 -#define PIXEL rgb16_pixel_t -#define FNAME(name) lz_rgb16_##name -#define GET_r(pix) (((pix) >> 10) & 0x1f) -#define GET_g(pix) (((pix) >> 5) & 0x1f) -#define GET_b(pix) ((pix) & 0x1f) -#define ENCODE_PIXEL(e, pix) {encode(e, (pix) >> 8); encode(e, (pix) & 0xff);} - -#define HASH_FUNC(v, p) { \ - v = DJB2_START; \ - DJB2_HASH(v, p[0] & (0x00ff)); \ - DJB2_HASH(v, (p[0] >> 8) & (0x007f)); \ - DJB2_HASH(v, p[1]&(0x00ff)); \ - DJB2_HASH(v, (p[1] >> 8) & (0x007f)); \ - DJB2_HASH(v, p[2] & (0x00ff)); \ - DJB2_HASH(v, (p[2] >> 8) & (0x007f)); \ - v &= HASH_MASK; \ -} -#endif - -#ifdef LZ_RGB24 -#define PIXEL rgb24_pixel_t -#define FNAME(name) lz_rgb24_##name -#define ENCODE_PIXEL(e, pix) {encode(e, (pix).b); encode(e, (pix).g); encode(e, (pix).r);} -#endif - -#ifdef LZ_RGB32 -#define PIXEL rgb32_pixel_t -#define FNAME(name) lz_rgb32_##name -#define ENCODE_PIXEL(e, pix) {encode(e, (pix).b); encode(e, (pix).g); encode(e, (pix).r);} -#endif - - -#if defined(LZ_RGB24) || defined(LZ_RGB32) -#define GET_r(pix) ((pix).r) -#define GET_g(pix) ((pix).g) -#define GET_b(pix) ((pix).b) -#define HASH_FUNC(v, p) { \ - v = DJB2_START; \ - DJB2_HASH(v, p[0].r); \ - DJB2_HASH(v, p[0].g); \ - DJB2_HASH(v, p[0].b); \ - DJB2_HASH(v, p[1].r); \ - DJB2_HASH(v, p[1].g); \ - DJB2_HASH(v, p[1].b); \ - DJB2_HASH(v, p[2].r); \ - DJB2_HASH(v, p[2].g); \ - DJB2_HASH(v, p[2].b); \ - v &= HASH_MASK; \ - } -#endif - -#if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32) -#define SAME_PIXEL(p1, p2) (GET_r(p1) == GET_r(p2) && GET_g(p1) == GET_g(p2) && \ - GET_b(p1) == GET_b(p2)) - -#endif - -#define PIXEL_ID(pix_ptr, seg_ptr) (pix_ptr - ((PIXEL *)seg_ptr->lines) + seg_ptr->size_delta) - -// when encoding, the ref can be in previous segment, and we should check that it doesn't -// exceeds its bounds. -// TODO: optimization: when only one chunk exists or when the reference is in the same segment, -// don't make checks if we reach end of segments -// TODO: optimize to continue match between segments? -// TODO: check hash function -// TODO: check times - -/* compresses one segment starting from 'from'.*/ -static void FNAME(compress_seg)(Encoder *encoder, LzImageSegment *seg, PIXEL *from, int copied) -{ - const PIXEL *ip = from; - const PIXEL *ip_bound = (PIXEL *)(seg->lines_end) - BOUND_OFFSET; - const PIXEL *ip_limit = (PIXEL *)(seg->lines_end) - LIMIT_OFFSET; - HashEntry *hslot; - int hval; - int copy = copied; - - if (copy == 0) { - encode_copy_count(encoder, MAX_COPY - 1); - } - - - while (LZ_EXPECT_CONDITIONAL(ip < ip_limit)) { // TODO: maybe change ip_limit and enabling - // moving to the next seg - const PIXEL *ref; - const PIXEL *ref_limit; - size_t distance; - - /* minimum match length */ -#if defined(LZ_PLT) || defined(LZ_RGB_ALPHA) - size_t len = 3; -#elif defined(LZ_RGB16) - size_t len = 2; -#else - size_t len = 1; -#endif - /* comparison starting-point */ - const PIXEL *anchor = ip; - - - - // TODO: RLE without checking if not first byte. - // TODO: optimize comparisons - - /* check for a run */ // TODO for RGB we can use less pixels - if (LZ_EXPECT_CONDITIONAL(ip > (PIXEL *)(seg->lines))) { - if (SAME_PIXEL(ip[-1], ip[0]) && SAME_PIXEL(ip[0], ip[1]) && SAME_PIXEL(ip[1], ip[2])) { - distance = 1; - ip += 3; - ref = anchor + 2; - ref_limit = (PIXEL *)(seg->lines_end); -#if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32) - len = 3; -#endif - goto match; - } - } - - /* find potential match */ - HASH_FUNC(hval, ip); - hslot = encoder->htab + hval; - ref = (PIXEL *)(hslot->ref); - ref_limit = (PIXEL *)(hslot->image_seg->lines_end); - - /* calculate distance to the match */ - distance = PIXEL_ID(anchor, seg) - PIXEL_ID(ref, hslot->image_seg); - - /* update hash table */ - hslot->image_seg = seg; - hslot->ref = (uint8_t *)anchor; - - /* is this a match? check the first 3 pixels */ - if (distance == 0 || (distance >= MAX_FARDISTANCE)) { - goto literal; - } - /* check if the hval key identical*/ - // no need to check ref limit here because the word size in the htab is 3 pixels - if (!SAME_PIXEL(*ref, *ip)) { - ref++; - ip++; - goto literal; - } - ref++; - ip++; - - /* minimum match length for rgb16 is 2 and for plt and alpha is 3 */ -#if defined(LZ_PLT) || defined(LZ_RGB_ALPHA) || defined(LZ_RGB16) - if (!SAME_PIXEL(*ref, *ip)) { - ref++; - ip++; - goto literal; - } - ref++; - ip++; -#endif - -#if defined(LZ_PLT) || defined(LZ_RGB_ALPHA) - if (!SAME_PIXEL(*ref, *ip)) { - ref++; - ip++; - goto literal; - } - ref++; - ip++; -#endif - /* far, needs at least 5-byte match */ - if (distance >= MAX_DISTANCE) { -#if defined(LZ_PLT) || defined(LZ_RGB_ALPHA) - if (ref >= (ref_limit - 1)) { - goto literal; - } -#else - if (ref > (ref_limit - 1)) { - goto literal; - } -#endif - if (!SAME_PIXEL(*ref, *ip)) { - ref++; - ip++; - goto literal; - } - ref++; - ip++; - len++; -#if defined(LZ_PLT) || defined(LZ_RGB_ALPHA) - if (!SAME_PIXEL(*ref, *ip)) { - ref++; - ip++; - goto literal; - } - ref++; - ip++; - len++; -#endif - } -match: // RLE or dictionary (both are encoded by distance from ref (-1) and length) - - /* distance is biased */ - distance--; - - // ip is located now at the position of the second mismatch. - // later it will be subtracted by 3 - - if (!distance) { - /* zero distance means a run */ - PIXEL x = *ref; - while ((ip < ip_bound) && (ref < ref_limit)) { // TODO: maybe separate a run from - // the same seg or from different - // ones in order to spare - // ref < ref_limit - if (!SAME_PIXEL(*ref, x)) { - ref++; - break; - } else { - ref++; - ip++; - } - } - } else { - // TODO: maybe separate a run from the same seg or from different ones in order - // to spare ref < ref_limit and that way we can also perform 8 calls of - // (ref++ != ip++) outside a loop - for (;;) { - while ((ip < ip_bound) && (ref < ref_limit)) { - if (!SAME_PIXEL(*ref, *ip)) { - ref++; - ip++; - break; - } else { - ref++; - ip++; - } - } - break; - } - } - - /* if we have copied something, adjust the copy count */ - if (copy) { - /* copy is biased, '0' means 1 byte copy */ - update_copy_count(encoder, copy - 1); - } else { - /* back, to overwrite the copy count */ - compress_output_prev(encoder); - } - - /* reset literal counter */ - copy = 0; - - /* length is biased, '1' means a match of 3 pixels for PLT and alpha*/ - /* for RGB 16 1 means 2 */ - /* for RGB24/32 1 means 1...*/ - ip -= 3; - len = ip - anchor; -#if defined(LZ_RGB16) - len++; -#elif defined(LZ_RGB24) || defined(LZ_RGB32) - len += 2; -#endif - /* encode the match (like fastlz level 2)*/ - if (distance < MAX_DISTANCE) { // MAX_DISTANCE is 2^13 - 1 - // when copy is performed, the byte that holds the copy count is smaller than 32. - // When there is a reference, the first byte is always larger then 32 - - // 3 bits = length, 5 bits = 5 MSB of distance, 8 bits = 8 LSB of distance - if (len < 7) { - encode(encoder, (uint8_t)((len << 5) + (distance >> 8))); - encode(encoder, (uint8_t)(distance & 255)); - } else { // more than 3 bits are needed for length - // 3 bits 7, 5 bits = 5 MSB of distance, next bytes are 255 till we - // receive a smaller number, last byte = 8 LSB of distance - encode(encoder, (uint8_t)((7 << 5) + (distance >> 8))); - for (len -= 7; len >= 255; len -= 255) { - encode(encoder, 255); - } - encode(encoder, (uint8_t)len); - encode(encoder, (uint8_t)(distance & 255)); - } - } else { - /* far away */ - if (len < 7) { // the max_far_distance is ~2^16+2^13 so two more bytes are needed - // 3 bits = length, 5 bits = 5 MSB of MAX_DISTANCE, 8 bits = 8 LSB of MAX_DISTANCE, - // 8 bits = 8 MSB distance-MAX_distance (smaller than 2^16),8 bits=8 LSB of - // distance-MAX_distance - distance -= MAX_DISTANCE; - encode(encoder, (uint8_t)((len << 5) + 31)); - encode(encoder, (uint8_t)255); - encode(encoder, (uint8_t)(distance >> 8)); - encode(encoder, (uint8_t)(distance & 255)); - } else { - // same as before, but the first byte is followed by the left overs of len - distance -= MAX_DISTANCE; - encode(encoder, (uint8_t)((7 << 5) + 31)); - for (len -= 7; len >= 255; len -= 255) { - encode(encoder, 255); - } - encode(encoder, (uint8_t)len); - encode(encoder, 255); - encode(encoder, (uint8_t)(distance >> 8)); - encode(encoder, (uint8_t)(distance & 255)); - } - } - - /* update the hash at match boundary */ -#if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32) - if (ip > anchor) { -#endif - HASH_FUNC(hval, ip); - encoder->htab[hval].ref = (uint8_t *)ip; - ip++; - encoder->htab[hval].image_seg = seg; -#if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32) - } else {ip++; - } -#endif -#if defined(LZ_RGB24) || defined(LZ_RGB32) - if (ip > anchor) { -#endif - HASH_FUNC(hval, ip); - encoder->htab[hval].ref = (uint8_t *)ip; - ip++; - encoder->htab[hval].image_seg = seg; -#if defined(LZ_RGB24) || defined(LZ_RGB32) - } else {ip++; - } -#endif - /* assuming literal copy */ - encode_copy_count(encoder, MAX_COPY - 1); - continue; - -literal: - ENCODE_PIXEL(encoder, *anchor); - anchor++; - ip = anchor; - copy++; - - if (LZ_UNEXPECT_CONDITIONAL(copy == MAX_COPY)) { - copy = 0; - encode_copy_count(encoder, MAX_COPY - 1); - } - } // END LOOP (ip < ip_limit) - - - /* left-over as literal copy */ - ip_bound++; - while (ip <= ip_bound) { - ENCODE_PIXEL(encoder, *ip); - ip++; - copy++; - if (copy == MAX_COPY) { - copy = 0; - encode_copy_count(encoder, MAX_COPY - 1); - } - } - - /* if we have copied something, adjust the copy length */ - if (copy) { - update_copy_count(encoder, copy - 1); - } else { - compress_output_prev(encoder); // in case we created a new buffer for copy, check that - // red_worker could handle size that do not contain the - // ne buffer - } -} - - -/* initializes the hash table. if the file is very small, copies it. - copies the first two pixels of the first segment, and sends the segments - one by one to compress_seg. - the number of bytes compressed are stored inside encoder. - */ -static void FNAME(compress)(Encoder *encoder) -{ - LzImageSegment *cur_seg = encoder->head_image_segs; - HashEntry *hslot; - PIXEL *ip; - - // fetch the first image segment that is not too small - while (cur_seg && ((((PIXEL *)cur_seg->lines_end) - ((PIXEL *)cur_seg->lines)) < 4)) { - // coping the segment - if (cur_seg->lines != cur_seg->lines_end) { - ip = (PIXEL *)cur_seg->lines; - // Note: we assume MAX_COPY > 3 - encode_copy_count(encoder, (uint8_t)( - (((PIXEL *)cur_seg->lines_end) - ((PIXEL *)cur_seg->lines)) - 1)); - while (ip < (PIXEL *)cur_seg->lines_end) { - ENCODE_PIXEL(encoder, *ip); - ip++; - } - } - cur_seg = cur_seg->next; - } - - if (!cur_seg) { - return; - } - - ip = (PIXEL *)cur_seg->lines; - - /* initialize hash table */ - for (hslot = encoder->htab; hslot < encoder->htab + HASH_SIZE; hslot++) { - hslot->ref = (uint8_t*)ip; - hslot->image_seg = cur_seg; - } - - encode_copy_count(encoder, MAX_COPY - 1); - ENCODE_PIXEL(encoder, *ip); - ip++; - ENCODE_PIXEL(encoder, *ip); - ip++; - - // compressing the first segment - FNAME(compress_seg)(encoder, cur_seg, ip, 2); - - // compressing the next segments - for (cur_seg = cur_seg->next; cur_seg; cur_seg = cur_seg->next) { - FNAME(compress_seg)(encoder, cur_seg, (PIXEL *)cur_seg->lines, 0); - } -} - -#undef FNAME -#undef PIXEL_ID -#undef PIXEL -#undef ENCODE_PIXEL -#undef SAME_PIXEL -#undef LZ_READU16 -#undef HASH_FUNC -#undef BYTES_TO_16 -#undef HASH_FUNC_16 -#undef GET_r -#undef GET_g -#undef GET_b -#undef GET_CODE -#undef LZ_PLT -#undef LZ_RGB_ALPHA -#undef LZ_RGB16 -#undef LZ_RGB24 -#undef LZ_RGB32 -#undef HASH_FUNC2 diff -Nru spice-gtk-0.9/common/lz_config.h spice-gtk-0.12/common/lz_config.h --- spice-gtk-0.9/common/lz_config.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/lz_config.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef __LZ_CONFIG_H -#define __LZ_CONFIG_H - -#include -#include - -#ifdef __GNUC__ - -#include - -#define INLINE inline - -#else - -#ifdef QXLDD -#include -#include "os_dep.h" -#define INLINE _inline - -#else -#include -#include - -#define INLINE inline -#endif // QXLDD - -#endif //__GNUC__ -#endif //__LZ_CONFIG_H diff -Nru spice-gtk-0.9/common/lz_decompress_tmpl.c spice-gtk-0.12/common/lz_decompress_tmpl.c --- spice-gtk-0.9/common/lz_decompress_tmpl.c 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/lz_decompress_tmpl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,323 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - - Copyright 2009 Red Hat, Inc. and/or its affiliates. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . - - This file incorporates work covered by the following copyright and - permission notice: - Copyright (C) 2007 Ariya Hidayat (ariya@kde.org) - Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) - Copyright (C) 2005 Ariya Hidayat (ariya@kde.org) - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the "Software"), to deal in the Software without - restriction, including without limitation the rights to use, copy, - modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - -*/ - -// External defines: PLT, RGBX/PLTXX/ALPHA, TO_RGB32. -// If PLT4/1 and TO_RGB32 are defined, we need CAST_PLT_DISTANCE (because then the number of -// pixels differ from the units used in the compression) - -/* - For each output pixel type the following macros are defined: - OUT_PIXEL - the output pixel type - COPY_PIXEL(p, out) - assigns the pixel to the place pointed by out and increases - out. Used in RLE. Need special handling because in alpha we - copy only the pad byte. - COPY_REF_PIXEL(ref, out) - copies the pixel pointed by ref to the pixel pointed by out. - Increases ref and out. - COPY_COMP_PIXEL(encoder, out) - copies pixel from the compressed buffer to the decompressed - buffer. Increases out. -*/ -#if !defined(LZ_RGB_ALPHA) -#define COPY_PIXEL(p, out) (*out++ = p) -#define COPY_REF_PIXEL(ref, out) (*out++ = *ref++) -#endif - - -// decompressing plt to plt -#ifdef LZ_PLT -#ifndef TO_RGB32 -#define OUT_PIXEL one_byte_pixel_t -#define FNAME(name) lz_plt_##name -#define COPY_COMP_PIXEL(encoder, out) {out->a = decode(encoder); out++;} -#else // TO_RGB32 -#define OUT_PIXEL rgb32_pixel_t -#define COPY_PLT_ENTRY(ent, out) { \ - (out)->b = ent; \ - (out)->g = (ent >> 8); \ - (out)->r = (ent >> 16); \ - (out)->pad = 0; \ -} -#ifdef PLT8 -#define FNAME(name) lz_plt8_to_rgb32_##name -#define COPY_COMP_PIXEL(encoder, out) { \ - uint32_t rgb = encoder->palette->ents[decode(encoder)]; \ - COPY_PLT_ENTRY(rgb, out); \ - out++;} -#elif defined(PLT4_BE) -#define FNAME(name) lz_plt4_be_to_rgb32_##name -#define COPY_COMP_PIXEL(encoder, out){ \ - uint8_t byte = decode(encoder); \ - uint32_t rgb = encoder->palette->ents[((byte >> 4) & 0x0f) % (encoder->palette->num_ents)]; \ - COPY_PLT_ENTRY(rgb, out); \ - out++; \ - rgb = encoder->palette->ents[(byte & 0x0f) % (encoder->palette->num_ents)]; \ - COPY_PLT_ENTRY(rgb, out); \ - out++; \ -} -#define CAST_PLT_DISTANCE(dist) (dist*2) -#elif defined(PLT4_LE) -#define FNAME(name) lz_plt4_le_to_rgb32_##name -#define COPY_COMP_PIXEL(encoder, out){ \ - uint8_t byte = decode(encoder); \ - uint32_t rgb = encoder->palette->ents[(byte & 0x0f) % (encoder->palette->num_ents)]; \ - COPY_PLT_ENTRY(rgb, out); \ - out++; \ - rgb = encoder->palette->ents[((byte >> 4) & 0x0f) % (encoder->palette->num_ents)]; \ - COPY_PLT_ENTRY(rgb, out); \ - out++; \ -} -#define CAST_PLT_DISTANCE(dist) (dist*2) -#elif defined(PLT1_BE) // TODO store palette entries for direct access -#define FNAME(name) lz_plt1_be_to_rgb32_##name -#define COPY_COMP_PIXEL(encoder, out){ \ - uint8_t byte = decode(encoder); \ - int i; \ - uint32_t fore = encoder->palette->ents[1]; \ - uint32_t back = encoder->palette->ents[0]; \ - for (i = 7; i >= 0; i--) \ - { \ - if ((byte >> i) & 1) { \ - COPY_PLT_ENTRY(fore, out); \ - } else { \ - COPY_PLT_ENTRY(back, out); \ - } \ - out++; \ - } \ -} -#define CAST_PLT_DISTANCE(dist) (dist*8) -#elif defined(PLT1_LE) -#define FNAME(name) lz_plt1_le_to_rgb32_##name -#define COPY_COMP_PIXEL(encoder, out){ \ - uint8_t byte = decode(encoder); \ - int i; \ - uint32_t fore = encoder->palette->ents[1]; \ - uint32_t back = encoder->palette->ents[0]; \ - for (i = 0; i < 8; i++) \ - { \ - if ((byte >> i) & 1) { \ - COPY_PLT_ENTRY(fore, out); \ - } else { \ - COPY_PLT_ENTRY(back, out); \ - } \ - out++; \ - } \ -} -#define CAST_PLT_DISTANCE(dist) (dist*8) -#endif // PLT Type -#endif // TO_RGB32 -#endif - -#ifdef LZ_RGB16 -#ifndef TO_RGB32 -#define OUT_PIXEL rgb16_pixel_t -#define FNAME(name) lz_rgb16_##name -#define COPY_COMP_PIXEL(e, out) {*out = ((decode(e) << 8) | decode(e)); out++;} -#else -#define OUT_PIXEL rgb32_pixel_t -#define FNAME(name) lz_rgb16_to_rgb32_##name -#define COPY_COMP_PIXEL(e, out) { \ - out->r = decode(e); \ - out->b = decode(e); \ - out->g = (((out->r) << 6) | ((out->b) >> 2)) & ~0x07; \ - out->g |= (out->g >> 5); \ - out->r = ((out->r << 1) & ~0x07)| ((out->r >> 4) & 0x07); \ - out->b = (out->b << 3) | ((out->b >> 2) & 0x07); \ - out->pad = 0; \ - out++; \ -} -#endif -#endif - -#ifdef LZ_RGB24 -#define OUT_PIXEL rgb24_pixel_t -#define FNAME(name) lz_rgb24_##name -#define COPY_COMP_PIXEL(e, out) {out->b = decode(e); out->g = decode(e); out->r = decode(e); out++;} -#endif - -#ifdef LZ_RGB32 -#define OUT_PIXEL rgb32_pixel_t -#define FNAME(name) lz_rgb32_##name -#define COPY_COMP_PIXEL(e, out) { \ - out->b = decode(e); \ - out->g = decode(e); \ - out->r = decode(e); \ - out->pad = 0; \ - out++; \ -} -#endif - -#ifdef LZ_RGB_ALPHA -#define OUT_PIXEL rgb32_pixel_t -#define FNAME(name) lz_rgb_alpha_##name -#define COPY_PIXEL(p, out) {out->pad = p.pad; out++;} -#define COPY_REF_PIXEL(ref, out) {out->pad = ref->pad; out++; ref++;} -#define COPY_COMP_PIXEL(e, out) {out->pad = decode(e); out++;} -#endif - -// return num of bytes in out_buf -static size_t FNAME(decompress)(Encoder *encoder, OUT_PIXEL *out_buf, int size) -{ - OUT_PIXEL *op = out_buf; - OUT_PIXEL *op_limit = out_buf + size; - uint32_t ctrl = decode(encoder); - int loop = TRUE; - - do { - const OUT_PIXEL *ref = op; - uint32_t len = ctrl >> 5; - uint32_t ofs = (ctrl & 31) << 8; // 5 MSb of distance - - if (ctrl >= MAX_COPY) { // reference (dictionary/RLE) - /* retrieving the reference and the match length */ - - uint8_t code; - len--; - //ref -= ofs; - if (len == 7 - 1) { // match length is bigger than 7 - do { - code = decode(encoder); - len += code; - } while (code == 255); // remaining of len - } - code = decode(encoder); - ofs += code; - - /* match from 16-bit distance */ - if (LZ_UNEXPECT_CONDITIONAL(code == 255)) { - if (LZ_EXPECT_CONDITIONAL((ofs - code) == (31 << 8))) { - ofs = decode(encoder) << 8; - ofs += decode(encoder); - ofs += MAX_DISTANCE; - } - } - -#if defined(LZ_PLT) || defined(LZ_RGB_ALPHA) - len += 3; // length is biased by 2 + 1 (fixing bias) -#elif defined(LZ_RGB16) - len += 2; // length is biased by 1 + 1 (fixing bias) -#else - len += 1; -#endif - ofs += 1; // offset is biased by 1 (fixing bias) - -#if defined(TO_RGB32) -#if defined(PLT4_BE) || defined(PLT4_LE) || defined(PLT1_BE) || defined(PLT1_LE) - ofs = CAST_PLT_DISTANCE(ofs); - len = CAST_PLT_DISTANCE(len); -#endif -#endif - ref -= ofs; - - ASSERT(encoder->usr, op + len <= op_limit); - ASSERT(encoder->usr, ref + len <= op_limit); - ASSERT(encoder->usr, ref >= out_buf); - - // TODO: optimize by not calling loop at least 3 times when not PLT_TO_RGB32 (len is - // always >=3). in PLT_TO_RGB32 len >= 3*number_of_pixels_per_byte - - /* copying the match*/ - - if (ref == (op - 1)) { // run // TODO: this will never be called in PLT4/1_TO_RGB - // because the number of pixel copied is larger - // then one... - /* optimize copy for a run */ - OUT_PIXEL b = *ref; - for (; len; --len) { - COPY_PIXEL(b, op); - ASSERT(encoder->usr, op <= op_limit); - } - } else { - for (; len; --len) { - COPY_REF_PIXEL(ref, op); - ASSERT(encoder->usr, op <= op_limit); - } - } - } else { // copy - ctrl++; // copy count is biased by 1 -#if defined(TO_RGB32) && (defined(PLT4_BE) || defined(PLT4_LE) || defined(PLT1_BE) || \ - defined(PLT1_LE)) - ASSERT(encoder->usr, op + CAST_PLT_DISTANCE(ctrl) <= op_limit); -#else - ASSERT(encoder->usr, op + ctrl <= op_limit); -#endif - COPY_COMP_PIXEL(encoder, op); - - ASSERT(encoder->usr, op <= op_limit); - - for (--ctrl; ctrl; ctrl--) { - COPY_COMP_PIXEL(encoder, op); - ASSERT(encoder->usr, op <= op_limit); - } - } - - if (LZ_EXPECT_CONDITIONAL(op < op_limit)) { - ctrl = decode(encoder); - } else { - loop = FALSE; - } - } while (LZ_EXPECT_CONDITIONAL(loop)); - - return (op - out_buf); -} - -#undef LZ_PLT -#undef PLT8 -#undef PLT4_BE -#undef PLT4_LE -#undef PLT1_BE -#undef PLT1_LE -#undef LZ_RGB16 -#undef LZ_RGB24 -#undef LZ_RGB32 -#undef LZ_RGB_ALPHA -#undef TO_RGB32 -#undef OUT_PIXEL -#undef FNAME -#undef COPY_PIXEL -#undef COPY_REF_PIXEL -#undef COPY_COMP_PIXEL -#undef COPY_PLT_ENTRY -#undef CAST_PLT_DISTANCE - diff -Nru spice-gtk-0.9/common/lz.h spice-gtk-0.12/common/lz.h --- spice-gtk-0.9/common/lz.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/lz.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - dictionary compression for images based on fastlz (http://www.fastlz.org/) - (Distributed under MIT license). -*/ -#ifndef __LZ_H -#define __LZ_H - -#include "lz_common.h" -#include "lz_config.h" -#include "draw.h" - -typedef void *LzContext; - -typedef struct LzUsrContext LzUsrContext; -struct LzUsrContext { - void (*error)(LzUsrContext *usr, const char *fmt, ...); - void (*warn)(LzUsrContext *usr, const char *fmt, ...); - void (*info)(LzUsrContext *usr, const char *fmt, ...); - void *(*malloc)(LzUsrContext *usr, int size); - void (*free)(LzUsrContext *usr, void *ptr); - int (*more_space)(LzUsrContext *usr, uint8_t **io_ptr); // get the next chunk of the - // compressed buffer. return - // number of bytes in the chunk. - int (*more_lines)(LzUsrContext *usr, uint8_t **lines); // get the next chunk of the - // original image. If the image - // is down to top, return it from - // the last line to the first one - // (stride should always be - // positive) -}; - -/* - assumes width is in pixels and stride is in bytes - return: the number of bytes in the compressed data - - TODO : determine size limit for the first segment and each chunk. check validity - of the segment or go to literal copy. - TODO : currently support only rgb images in which width*bytes_per_pixel = stride OR - palette images in which stride equals the min number of bytes to - hold a line. stride is not necessary for now. just for sanity check. - stride should be > 0 -*/ -int lz_encode(LzContext *lz, LzImageType type, int width, int height, int top_down, - uint8_t *lines, unsigned int num_lines, int stride, - uint8_t *io_ptr, unsigned int num_io_bytes); - -/* - prepare encoder and read lz magic. - out_n_pixels number of compressed pixels. May differ from Width*height in plt1/4. - Use it for allocation the decompressed buffer. - -*/ -void lz_decode_begin(LzContext *lz, uint8_t *io_ptr, unsigned int num_io_bytes, - LzImageType *out_type, int *out_width, int *out_height, - int *out_n_pixels, int *out_top_down, const SpicePalette *palette); - -/* - to_type = the image output type. - We assume the buffer is consecutive. i.e. width = stride - - Important: if the image is plt1/4 and to_type is rgb32, the image - will decompressed including the last bits in each line. This means buffer should be - larger than width*height if needed and you should use stride to fix it. - Note: If the image is down to top, set the stride in the sw surface to negative. - use alloc_lz_image_surface create the surface. -*/ -void lz_decode(LzContext *lz, LzImageType to_type, uint8_t *buf); - -LzContext *lz_create(LzUsrContext *usr); - -void lz_destroy(LzContext *lz); - - -#endif // __LZ_H diff -Nru spice-gtk-0.9/common/Makefile.am spice-gtk-0.12/common/Makefile.am --- spice-gtk-0.9/common/Makefile.am 2011-12-22 11:22:01.000000000 +0000 +++ spice-gtk-0.12/common/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -NULL = - -COMMON_SRCS = \ - sw_canvas.h \ - sw_canvas.c \ - pixman_utils.h \ - pixman_utils.c \ - canvas_base.h \ - canvas_base.c \ - canvas_utils.h \ - canvas_utils.c \ - demarshallers.h \ - draw.h \ - gdi_canvas.h \ - gdi_canvas.c \ - gl_canvas.h \ - gl_canvas.c \ - glc.h \ - glc.c \ - gl_utils.h \ - lz_common.h \ - mutex.h \ - ogl_ctx.h \ - ogl_ctx.c \ - quic.h \ - quic.c \ - quic_config.h \ - rect.h \ - region.h \ - region.c \ - ring.h \ - rop3.h \ - rop3.c \ - lines.h \ - lines.c \ - lz.c \ - lz_compress_tmpl.c \ - lz_config.h \ - lz_decompress_tmpl.c \ - lz.h \ - marshaller.h \ - marshaller.c \ - marshallers.h \ - messages.h \ - mem.h \ - mem.c \ - quic_family_tmpl.c \ - quic_rgb_tmpl.c \ - quic_tmpl.c \ - ssl_verify.h \ - ssl_verify.c \ - $(NULL) - -EXTRA_DIST = $(COMMON_SRCS) - diff -Nru spice-gtk-0.9/common/Makefile.in spice-gtk-0.12/common/Makefile.in --- spice-gtk-0.9/common/Makefile.in 2012-01-31 10:22:59.000000000 +0000 +++ spice-gtk-0.12/common/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,524 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = common -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/check_python.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/intltool.m4 \ - $(top_srcdir)/m4/ld-version.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ACL_HELPER_DIR = @ACL_HELPER_DIR@ -ACL_LIBS = @ACL_LIBS@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CAIRO_CFLAGS = @CAIRO_CFLAGS@ -CAIRO_LIBS = @CAIRO_LIBS@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CELT051_CFLAGS = @CELT051_CFLAGS@ -CELT051_LIBDIR = @CELT051_LIBDIR@ -CELT051_LIBS = @CELT051_LIBS@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ -GLIB2_CFLAGS = @GLIB2_CFLAGS@ -GLIB2_LIBS = @GLIB2_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GOBJECT2_CFLAGS = @GOBJECT2_CFLAGS@ -GOBJECT2_LIBS = @GOBJECT2_LIBS@ -GREP = @GREP@ -GST_CFLAGS = @GST_CFLAGS@ -GST_LIBS = @GST_LIBS@ -GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ -GTHREAD_LIBS = @GTHREAD_LIBS@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ -GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ -GTKDOC_MKPDF = @GTKDOC_MKPDF@ -GTKDOC_REBASE = @GTKDOC_REBASE@ -GTK_API_VERSION = @GTK_API_VERSION@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -GTK_REQUIRED = @GTK_REQUIRED@ -HTML_DIR = @HTML_DIR@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ -INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ -INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ -INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ -JPEG_LIBS = @JPEG_LIBS@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBM = @LIBM@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PIE_CFLAGS = @PIE_CFLAGS@ -PIE_LDFLAGS = @PIE_LDFLAGS@ -PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ -PIXMAN_LIBS = @PIXMAN_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PNP_IDS = @PNP_IDS@ -POFILES = @POFILES@ -POLICYDIR = @POLICYDIR@ -POLKIT_CFLAGS = @POLKIT_CFLAGS@ -POLKIT_LIBS = @POLKIT_LIBS@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PROTOCOL_CFLAGS = @PROTOCOL_CFLAGS@ -PROTOCOL_LIBS = @PROTOCOL_LIBS@ -PULSE_CFLAGS = @PULSE_CFLAGS@ -PULSE_LIBS = @PULSE_LIBS@ -PYGTK_CFLAGS = @PYGTK_CFLAGS@ -PYGTK_LIBS = @PYGTK_LIBS@ -PYTHON = @PYTHON@ -PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_PLATFORM = @PYTHON_PLATFORM@ -PYTHON_PREFIX = @PYTHON_PREFIX@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -SASL_CFLAGS = @SASL_CFLAGS@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SMARTCARD_CFLAGS = @SMARTCARD_CFLAGS@ -SMARTCARD_LIBS = @SMARTCARD_LIBS@ -SPICE_CFLAGS = @SPICE_CFLAGS@ -SPICE_COMMON_SRCDIR = @SPICE_COMMON_SRCDIR@ -SPICE_GLIB_CFLAGS = @SPICE_GLIB_CFLAGS@ -SPICE_GLIB_REQUIRES = @SPICE_GLIB_REQUIRES@ -SPICE_GTK_API_VERSION = @SPICE_GTK_API_VERSION@ -SPICE_GTK_CFLAGS = @SPICE_GTK_CFLAGS@ -SPICE_GTK_LOCALEDIR = @SPICE_GTK_LOCALEDIR@ -SPICE_GTK_REQUIRES = @SPICE_GTK_REQUIRES@ -SSL_CFLAGS = @SSL_CFLAGS@ -SSL_LIBS = @SSL_LIBS@ -STRIP = @STRIP@ -USBREDIR_CFLAGS = @USBREDIR_CFLAGS@ -USBREDIR_LIBS = @USBREDIR_LIBS@ -USE_NLS = @USE_NLS@ -VALAC = @VALAC@ -VAPIDIR = @VAPIDIR@ -VAPIGEN = @VAPIGEN@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -XRANDR_CFLAGS = @XRANDR_CFLAGS@ -XRANDR_LIBS = @XRANDR_LIBS@ -Z_LIBS = @Z_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgpyexecdir = @pkgpyexecdir@ -pkgpythondir = @pkgpythondir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pyexecdir = @pyexecdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -NULL = -COMMON_SRCS = \ - sw_canvas.h \ - sw_canvas.c \ - pixman_utils.h \ - pixman_utils.c \ - canvas_base.h \ - canvas_base.c \ - canvas_utils.h \ - canvas_utils.c \ - demarshallers.h \ - draw.h \ - gdi_canvas.h \ - gdi_canvas.c \ - gl_canvas.h \ - gl_canvas.c \ - glc.h \ - glc.c \ - gl_utils.h \ - lz_common.h \ - mutex.h \ - ogl_ctx.h \ - ogl_ctx.c \ - quic.h \ - quic.c \ - quic_config.h \ - rect.h \ - region.h \ - region.c \ - ring.h \ - rop3.h \ - rop3.c \ - lines.h \ - lines.c \ - lz.c \ - lz_compress_tmpl.c \ - lz_config.h \ - lz_decompress_tmpl.c \ - lz.h \ - marshaller.h \ - marshaller.c \ - marshallers.h \ - messages.h \ - mem.h \ - mem.c \ - quic_family_tmpl.c \ - quic_rgb_tmpl.c \ - quic_tmpl.c \ - ssl_verify.h \ - ssl_verify.c \ - $(NULL) - -EXTRA_DIST = $(COMMON_SRCS) -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign common/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign common/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru spice-gtk-0.9/common/marshaller.c spice-gtk-0.12/common/marshaller.c --- spice-gtk-0.9/common/marshaller.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/marshaller.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,614 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2010 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#include "config.h" - -#include "marshaller.h" -#include "mem.h" -#include -#include -#include - -#ifdef WORDS_BIGENDIAN -#define write_int8(ptr,v) (*((int8_t *)(ptr)) = v) -#define write_uint8(ptr,v) (*((uint8_t *)(ptr)) = v) -#define write_int16(ptr,v) (*((int16_t *)(ptr)) = SPICE_BYTESWAP16((uint16_t)(v))) -#define write_uint16(ptr,v) (*((uint16_t *)(ptr)) = SPICE_BYTESWAP16((uint16_t)(v))) -#define write_int32(ptr,v) (*((int32_t *)(ptr)) = SPICE_BYTESWAP32((uint32_t)(v))) -#define write_uint32(ptr,v) (*((uint32_t *)(ptr)) = SPICE_BYTESWAP32((uint32_t)(v))) -#define write_int64(ptr,v) (*((int64_t *)(ptr)) = SPICE_BYTESWAP64((uint64_t)(v))) -#define write_uint64(ptr,v) (*((uint64_t *)(ptr)) = SPICE_BYTESWAP64((uint64_t)(v))) -#else -#define write_int8(ptr,v) (*((int8_t *)(ptr)) = v) -#define write_uint8(ptr,v) (*((uint8_t *)(ptr)) = v) -#define write_int16(ptr,v) (*((int16_t *)(ptr)) = v) -#define write_uint16(ptr,v) (*((uint16_t *)(ptr)) = v) -#define write_int32(ptr,v) (*((int32_t *)(ptr)) = v) -#define write_uint32(ptr,v) (*((uint32_t *)(ptr)) = v) -#define write_int64(ptr,v) (*((int64_t *)(ptr)) = v) -#define write_uint64(ptr,v) (*((uint64_t *)(ptr)) = v) -#endif - -typedef struct { - uint8_t *data; - size_t len; - spice_marshaller_item_free_func free_data; - void *opaque; -} MarshallerItem; - -/* Try to fit in 4k page with 2*pointer-size overhead (next ptr and malloc size) */ -#define MARSHALLER_BUFFER_SIZE (4096 - sizeof(void *) * 2) - -typedef struct MarshallerBuffer MarshallerBuffer; -struct MarshallerBuffer { - MarshallerBuffer *next; - uint8_t data[MARSHALLER_BUFFER_SIZE]; -}; - -#define N_STATIC_ITEMS 4 - -typedef struct SpiceMarshallerData SpiceMarshallerData; - -typedef struct { - SpiceMarshaller *marshaller; - int item_nr; - int is_64bit; - size_t offset; -} MarshallerRef; - -struct SpiceMarshaller { - size_t total_size; - SpiceMarshallerData *data; - SpiceMarshaller *next; - - MarshallerRef pointer_ref; - - int n_items; - int items_size; /* number of items availible in items */ - MarshallerItem *items; - - MarshallerItem static_items[N_STATIC_ITEMS]; -}; - -struct SpiceMarshallerData { - size_t total_size; - size_t base; - SpiceMarshaller *marshallers; - SpiceMarshaller *last_marshaller; - - size_t current_buffer_position; - MarshallerBuffer *current_buffer; - MarshallerItem *current_buffer_item; - MarshallerBuffer *buffers; - - SpiceMarshaller static_marshaller; - MarshallerBuffer static_buffer; -}; - -static void spice_marshaller_init(SpiceMarshaller *m, - SpiceMarshallerData *data) -{ - m->data = data; - m->next = NULL; - m->total_size = 0; - m->pointer_ref.marshaller = NULL; - m->n_items = 0; - m->items_size = N_STATIC_ITEMS; - m->items = m->static_items; -} - -SpiceMarshaller *spice_marshaller_new(void) -{ - SpiceMarshallerData *d; - SpiceMarshaller *m; - - d = spice_new(SpiceMarshallerData, 1); - - d->last_marshaller = d->marshallers = &d->static_marshaller; - d->total_size = 0; - d->base = 0; - d->buffers = &d->static_buffer; - d->buffers->next = NULL; - d->current_buffer = d->buffers; - d->current_buffer_position = 0; - d->current_buffer_item = NULL; - - m = &d->static_marshaller; - spice_marshaller_init(m, d); - - return m; -} - -static void free_item_data(SpiceMarshaller *m) -{ - MarshallerItem *item; - int i; - - /* Free all user data */ - for (i = 0; i < m->n_items; i++) { - item = &m->items[i]; - if (item->free_data != NULL) { - item->free_data(item->data, item->opaque); - } - } -} - -static void free_items(SpiceMarshaller *m) -{ - if (m->items != m->static_items) { - free(m->items); - } -} - -void spice_marshaller_reset(SpiceMarshaller *m) -{ - SpiceMarshaller *m2, *next; - SpiceMarshallerData *d; - - /* Only supported for root marshaller */ - assert(m->data->marshallers == m); - - for (m2 = m; m2 != NULL; m2 = next) { - next = m2->next; - free_item_data(m2); - - /* Free non-root marshallers */ - if (m2 != m) { - free_items(m2); - free(m2); - } - } - - m->next = NULL; - m->n_items = 0; - m->total_size = 0; - - d = m->data; - d->last_marshaller = d->marshallers; - d->total_size = 0; - d->base = 0; - d->current_buffer_item = NULL; - d->current_buffer = d->buffers; - d->current_buffer_position = 0; -} - -void spice_marshaller_destroy(SpiceMarshaller *m) -{ - MarshallerBuffer *buf, *next; - SpiceMarshallerData *d; - - /* Only supported for root marshaller */ - assert(m->data->marshallers == m); - - spice_marshaller_reset(m); - - free_items(m); - - d = m->data; - - buf = d->buffers->next; - while (buf != NULL) { - next = buf->next; - free(buf); - buf = next; - } - - free(d); -} - -static MarshallerItem *spice_marshaller_add_item(SpiceMarshaller *m) -{ - MarshallerItem *item; - - if (m->n_items == m->items_size) { - int items_size = m->items_size * 2; - - if (m->items == m->static_items) { - m->items = spice_new(MarshallerItem, items_size); - memcpy(m->items, m->static_items, sizeof(MarshallerItem) * m->n_items); - } else { - m->items = spice_renew(MarshallerItem, m->items, items_size); - } - m->items_size = items_size; - } - item = &m->items[m->n_items++]; - item->free_data = NULL; - - return item; -} - -static size_t remaining_buffer_size(SpiceMarshallerData *d) -{ - return MARSHALLER_BUFFER_SIZE - d->current_buffer_position; -} - -uint8_t *spice_marshaller_reserve_space(SpiceMarshaller *m, size_t size) -{ - MarshallerItem *item; - SpiceMarshallerData *d; - uint8_t *res; - - if (size == 0) { - return NULL; - } - - d = m->data; - - /* Check current item */ - item = &m->items[m->n_items - 1]; - if (item == d->current_buffer_item && - remaining_buffer_size(d) >= size) { - assert(m->n_items >= 1); - /* We can piggy back on existing item+buffer */ - res = item->data + item->len; - item->len += size; - d->current_buffer_position += size; - d->total_size += size; - m->total_size += size; - return res; - } - - item = spice_marshaller_add_item(m); - - if (remaining_buffer_size(d) >= size) { - /* Fits in current buffer */ - item->data = d->current_buffer->data + d->current_buffer_position; - item->len = size; - d->current_buffer_position += size; - d->current_buffer_item = item; - } else if (size > MARSHALLER_BUFFER_SIZE / 2) { - /* Large item, allocate by itself */ - item->data = (uint8_t *)spice_malloc(size); - item->len = size; - item->free_data = (spice_marshaller_item_free_func)free; - item->opaque = NULL; - } else { - /* Use next buffer */ - if (d->current_buffer->next == NULL) { - d->current_buffer->next = spice_new(MarshallerBuffer, 1); - d->current_buffer->next->next = NULL; - } - d->current_buffer = d->current_buffer->next; - d->current_buffer_position = size; - d->current_buffer_item = item; - item->data = d->current_buffer->data; - item->len = size; - } - - d->total_size += size; - m->total_size += size; - return item->data; -} - -void spice_marshaller_unreserve_space(SpiceMarshaller *m, size_t size) -{ - MarshallerItem *item; - - if (size == 0) { - return; - } - - item = &m->items[m->n_items - 1]; - - assert(item->len >= size); - item->len -= size; -} - -uint8_t *spice_marshaller_add_ref_full(SpiceMarshaller *m, uint8_t *data, size_t size, - spice_marshaller_item_free_func free_data, void *opaque) -{ - MarshallerItem *item; - SpiceMarshallerData *d; - - if (data == NULL || size == 0) { - return NULL; - } - - item = spice_marshaller_add_item(m); - item->data = data; - item->len = size; - item->free_data = free_data; - item->opaque = opaque; - - d = m->data; - m->total_size += size; - d->total_size += size; - - return data; -} - -uint8_t *spice_marshaller_add(SpiceMarshaller *m, const uint8_t *data, size_t size) -{ - uint8_t *ptr; - - ptr = spice_marshaller_reserve_space(m, size); - memcpy(ptr, data, size); - return ptr; -} - -uint8_t *spice_marshaller_add_ref(SpiceMarshaller *m, uint8_t *data, size_t size) -{ - return spice_marshaller_add_ref_full(m, data, size, NULL, NULL); -} - -void spice_marshaller_add_ref_chunks(SpiceMarshaller *m, SpiceChunks *chunks) -{ - unsigned int i; - - for (i = 0; i < chunks->num_chunks; i++) { - spice_marshaller_add_ref(m, chunks->chunk[i].data, - chunks->chunk[i].len); - } -} - -SpiceMarshaller *spice_marshaller_get_submarshaller(SpiceMarshaller *m) -{ - SpiceMarshallerData *d; - SpiceMarshaller *m2; - - d = m->data; - - m2 = spice_new(SpiceMarshaller, 1); - spice_marshaller_init(m2, d); - - d->last_marshaller->next = m2; - d->last_marshaller = m2; - - return m2; -} - -SpiceMarshaller *spice_marshaller_get_ptr_submarshaller(SpiceMarshaller *m, int is_64bit) -{ - SpiceMarshaller *m2; - uint8_t *p; - int size; - - size = is_64bit ? 8 : 4; - - p = spice_marshaller_reserve_space(m, size); - memset(p, 0, size); - m2 = spice_marshaller_get_submarshaller(m); - m2->pointer_ref.marshaller = m; - m2->pointer_ref.item_nr = m->n_items - 1; - m2->pointer_ref.offset = m->items[m->n_items - 1].len - size; - m2->pointer_ref.is_64bit = is_64bit; - - return m2; -} - -uint8_t *lookup_ref(MarshallerRef *ref) -{ - MarshallerItem *item; - - item = &ref->marshaller->items[ref->item_nr]; - return item->data + ref->offset; -} - - -void spice_marshaller_set_base(SpiceMarshaller *m, size_t base) -{ - /* Only supported for root marshaller */ - assert(m->data->marshallers == m); - - m->data->base = base; -} - -uint8_t *spice_marshaller_linearize(SpiceMarshaller *m, size_t skip_bytes, - size_t *len, int *free_res) -{ - MarshallerItem *item; - uint8_t *res, *p; - int i; - - /* Only supported for root marshaller */ - assert(m->data->marshallers == m); - - if (m->n_items == 1) { - *free_res = FALSE; - if (m->items[0].len <= skip_bytes) { - *len = 0; - return NULL; - } - *len = m->items[0].len - skip_bytes; - return m->items[0].data + skip_bytes; - } - - *free_res = TRUE; - res = (uint8_t *)spice_malloc(m->data->total_size - skip_bytes); - *len = m->data->total_size - skip_bytes; - p = res; - - do { - for (i = 0; i < m->n_items; i++) { - item = &m->items[i]; - - if (item->len <= skip_bytes) { - skip_bytes -= item->len; - continue; - } - memcpy(p, item->data + skip_bytes, item->len - skip_bytes); - p += item->len - skip_bytes; - skip_bytes = 0; - } - m = m->next; - } while (m != NULL); - - return res; -} - -uint8_t *spice_marshaller_get_ptr(SpiceMarshaller *m) -{ - return m->items[0].data; -} - -size_t spice_marshaller_get_offset(SpiceMarshaller *m) -{ - SpiceMarshaller *m2; - size_t offset; - - offset = 0; - m2 = m->data->marshallers; - while (m2 != m) { - offset += m2->total_size; - m2 = m2->next; - } - return offset - m->data->base; -} - -size_t spice_marshaller_get_size(SpiceMarshaller *m) -{ - return m->total_size; -} - -size_t spice_marshaller_get_total_size(SpiceMarshaller *m) -{ - return m->data->total_size; -} - -void spice_marshaller_flush(SpiceMarshaller *m) -{ - SpiceMarshaller *m2; - uint8_t *ptr_pos; - - /* Only supported for root marshaller */ - assert(m->data->marshallers == m); - - for (m2 = m; m2 != NULL; m2 = m2->next) { - if (m2->pointer_ref.marshaller != NULL && m2->total_size > 0) { - ptr_pos = lookup_ref(&m2->pointer_ref); - if (m2->pointer_ref.is_64bit) { - write_uint64(ptr_pos, - spice_marshaller_get_offset(m2)); - } else { - write_uint32(ptr_pos, - spice_marshaller_get_offset(m2)); - } - } - } -} - -#ifndef WIN32 -int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec, - int n_vec, size_t skip_bytes) -{ - MarshallerItem *item; - int v, i; - - /* Only supported for root marshaller */ - assert(m->data->marshallers == m); - - v = 0; - do { - for (i = 0; i < m->n_items; i++) { - item = &m->items[i]; - - if (item->len <= skip_bytes) { - skip_bytes -= item->len; - continue; - } - if (v == n_vec) { - return v; /* Not enough space in vec */ - } - vec[v].iov_base = item->data + skip_bytes; - vec[v].iov_len = item->len - skip_bytes; - skip_bytes = 0; - v++; - } - m = m->next; - } while (m != NULL); - - return v; -} -#endif - -void *spice_marshaller_add_uint64(SpiceMarshaller *m, uint64_t v) -{ - uint8_t *ptr; - - ptr = spice_marshaller_reserve_space(m, sizeof(uint64_t)); - write_uint64(ptr, v); - return (void *)ptr; -} - -void *spice_marshaller_add_int64(SpiceMarshaller *m, int64_t v) -{ - uint8_t *ptr; - - ptr = spice_marshaller_reserve_space(m, sizeof(int64_t)); - write_int64(ptr, v); - return (void *)ptr; -} - -void *spice_marshaller_add_uint32(SpiceMarshaller *m, uint32_t v) -{ - uint8_t *ptr; - - ptr = spice_marshaller_reserve_space(m, sizeof(uint32_t)); - write_uint32(ptr, v); - return (void *)ptr; -} - -void spice_marshaller_set_uint32(SpiceMarshaller *m, void *ref, uint32_t v) -{ - write_uint32((uint8_t *)ref, v); -} - -void *spice_marshaller_add_int32(SpiceMarshaller *m, int32_t v) -{ - uint8_t *ptr; - - ptr = spice_marshaller_reserve_space(m, sizeof(int32_t)); - write_int32(ptr, v); - return (void *)ptr; -} - -void *spice_marshaller_add_uint16(SpiceMarshaller *m, uint16_t v) -{ - uint8_t *ptr; - - ptr = spice_marshaller_reserve_space(m, sizeof(uint16_t)); - write_uint16(ptr, v); - return (void *)ptr; -} - -void *spice_marshaller_add_int16(SpiceMarshaller *m, int16_t v) -{ - uint8_t *ptr; - - ptr = spice_marshaller_reserve_space(m, sizeof(int16_t)); - write_int16(ptr, v); - return (void *)ptr; -} - -void *spice_marshaller_add_uint8(SpiceMarshaller *m, uint8_t v) -{ - uint8_t *ptr; - - ptr = spice_marshaller_reserve_space(m, sizeof(uint8_t)); - write_uint8(ptr, v); - return (void *)ptr; -} - -void *spice_marshaller_add_int8(SpiceMarshaller *m, int8_t v) -{ - uint8_t *ptr; - - ptr = spice_marshaller_reserve_space(m, sizeof(int8_t)); - write_int8(ptr, v); - return (void *)ptr; -} diff -Nru spice-gtk-0.9/common/marshaller.h spice-gtk-0.12/common/marshaller.h --- spice-gtk-0.9/common/marshaller.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/marshaller.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2010 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H_MARSHALLER -#define _H_MARSHALLER - -#include -#include "mem.h" -#ifndef WIN32 -#include -#endif - -typedef struct SpiceMarshaller SpiceMarshaller; -typedef void (*spice_marshaller_item_free_func)(uint8_t *data, void *opaque); - -SpiceMarshaller *spice_marshaller_new(void); -void spice_marshaller_reset(SpiceMarshaller *m); -void spice_marshaller_destroy(SpiceMarshaller *m); -uint8_t *spice_marshaller_reserve_space(SpiceMarshaller *m, size_t size); -void spice_marshaller_unreserve_space(SpiceMarshaller *m, size_t size); -uint8_t *spice_marshaller_add(SpiceMarshaller *m, const uint8_t *data, size_t size); -uint8_t *spice_marshaller_add_ref(SpiceMarshaller *m, uint8_t *data, size_t size); -uint8_t *spice_marshaller_add_ref_full(SpiceMarshaller *m, uint8_t *data, size_t size, - spice_marshaller_item_free_func free_data, void *opaque); -void spice_marshaller_add_ref_chunks(SpiceMarshaller *m, SpiceChunks *chunks); -void spice_marshaller_flush(SpiceMarshaller *m); -void spice_marshaller_set_base(SpiceMarshaller *m, size_t base); -uint8_t *spice_marshaller_linearize(SpiceMarshaller *m, size_t skip, - size_t *len, int *free_res); -uint8_t *spice_marshaller_get_ptr(SpiceMarshaller *m); -size_t spice_marshaller_get_offset(SpiceMarshaller *m); -size_t spice_marshaller_get_size(SpiceMarshaller *m); -size_t spice_marshaller_get_total_size(SpiceMarshaller *m); -SpiceMarshaller *spice_marshaller_get_submarshaller(SpiceMarshaller *m); -SpiceMarshaller *spice_marshaller_get_ptr_submarshaller(SpiceMarshaller *m, int is_64bit); -#ifndef WIN32 -int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec, - int n_vec, size_t skip_bytes); -#endif -void *spice_marshaller_add_uint64(SpiceMarshaller *m, uint64_t v); -void *spice_marshaller_add_int64(SpiceMarshaller *m, int64_t v); -void *spice_marshaller_add_uint32(SpiceMarshaller *m, uint32_t v); -void *spice_marshaller_add_int32(SpiceMarshaller *m, int32_t v); -void *spice_marshaller_add_uint16(SpiceMarshaller *m, uint16_t v); -void *spice_marshaller_add_int16(SpiceMarshaller *m, int16_t v); -void *spice_marshaller_add_uint8(SpiceMarshaller *m, uint8_t v); -void *spice_marshaller_add_int8(SpiceMarshaller *m, int8_t v); - -void spice_marshaller_set_uint32(SpiceMarshaller *m, void *ref, uint32_t v); - -#endif diff -Nru spice-gtk-0.9/common/marshallers.h spice-gtk-0.12/common/marshallers.h --- spice-gtk-0.9/common/marshallers.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/marshallers.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2010 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H_MARSHALLERS -#define _H_MARSHALLERS - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include - -typedef struct { - void (*msg_SpiceMsgEmpty)(SpiceMarshaller *m, SpiceMsgEmpty *msg); - void (*msg_SpiceMsgData)(SpiceMarshaller *m, SpiceMsgData *msg); - void (*msg_SpiceMsgAudioVolume)(SpiceMarshaller *m, SpiceMsgAudioVolume *msg); - void (*msg_SpiceMsgAudioMute)(SpiceMarshaller *m, SpiceMsgAudioMute *msg); - void (*msgc_ack_sync)(SpiceMarshaller *m, SpiceMsgcAckSync *msg); - void (*msgc_pong)(SpiceMarshaller *m, SpiceMsgPing *msg); - void (*msgc_disconnecting)(SpiceMarshaller *m, SpiceMsgDisconnect *msg); - void (*msgc_main_client_info)(SpiceMarshaller *m, SpiceMsgcClientInfo *msg); - void (*msgc_main_mouse_mode_request)(SpiceMarshaller *m, SpiceMsgcMainMouseModeRequest *msg); - void (*msgc_main_agent_start)(SpiceMarshaller *m, SpiceMsgcMainAgentStart *msg); - void (*msgc_main_agent_token)(SpiceMarshaller *m, SpiceMsgcMainAgentTokens *msg); - void (*msgc_display_init)(SpiceMarshaller *m, SpiceMsgcDisplayInit *msg); - void (*msgc_inputs_key_down)(SpiceMarshaller *m, SpiceMsgcKeyDown *msg); - void (*msgc_inputs_key_up)(SpiceMarshaller *m, SpiceMsgcKeyUp *msg); - void (*msgc_inputs_key_modifiers)(SpiceMarshaller *m, SpiceMsgcKeyModifiers *msg); - void (*msgc_inputs_mouse_motion)(SpiceMarshaller *m, SpiceMsgcMouseMotion *msg); - void (*msgc_inputs_mouse_position)(SpiceMarshaller *m, SpiceMsgcMousePosition *msg); - void (*msgc_inputs_mouse_press)(SpiceMarshaller *m, SpiceMsgcMousePress *msg); - void (*msgc_inputs_mouse_release)(SpiceMarshaller *m, SpiceMsgcMouseRelease *msg); - void (*msgc_record_data)(SpiceMarshaller *m, SpiceMsgcRecordPacket *msg); - void (*msgc_record_mode)(SpiceMarshaller *m, SpiceMsgcRecordMode *msg); - void (*msgc_record_start_mark)(SpiceMarshaller *m, SpiceMsgcRecordStartMark *msg); - void (*msgc_tunnel_service_add)(SpiceMarshaller *m, SpiceMsgcTunnelAddGenericService *msg, SpiceMarshaller **name_out, SpiceMarshaller **description_out); - void (*msgc_tunnel_service_remove)(SpiceMarshaller *m, SpiceMsgcTunnelRemoveService *msg); - void (*msgc_tunnel_socket_open_ack)(SpiceMarshaller *m, SpiceMsgcTunnelSocketOpenAck *msg); - void (*msgc_tunnel_socket_open_nack)(SpiceMarshaller *m, SpiceMsgcTunnelSocketOpenNack *msg); - void (*msgc_tunnel_socket_fin)(SpiceMarshaller *m, SpiceMsgcTunnelSocketFin *msg); - void (*msgc_tunnel_socket_closed)(SpiceMarshaller *m, SpiceMsgcTunnelSocketClosed *msg); - void (*msgc_tunnel_socket_closed_ack)(SpiceMarshaller *m, SpiceMsgcTunnelSocketClosedAck *msg); - void (*msgc_tunnel_socket_data)(SpiceMarshaller *m, SpiceMsgcTunnelSocketData *msg); - void (*msgc_tunnel_socket_token)(SpiceMarshaller *m, SpiceMsgcTunnelSocketTokens *msg); -#ifdef USE_SMARTCARD - void (*msgc_smartcard_atr)(SpiceMarshaller *m, VSCMsgATR *msg); - void (*msgc_smartcard_error)(SpiceMarshaller *m, VSCMsgError *msg); - void (*msgc_smartcard_header)(SpiceMarshaller *m, VSCMsgHeader *msg); - void (*msgc_smartcard_msg)(SpiceMarshaller *m, SpiceMsgcSmartcard *msg, SpiceMarshaller **reader_name_out); - void (*msgc_smartcard_reader_add)(SpiceMarshaller *m, VSCMsgReaderAdd *msg); -#endif -} SpiceMessageMarshallers; - -SpiceMessageMarshallers *spice_message_marshallers_get(void); -SpiceMessageMarshallers *spice_message_marshallers_get1(void); - -#endif diff -Nru spice-gtk-0.9/common/mem.c spice-gtk-0.12/common/mem.c --- spice-gtk-0.9/common/mem.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/mem.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,243 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2010 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#include "mem.h" -#include -#include -#include - -#ifndef MALLOC_ERROR -#define MALLOC_ERROR(format, ...) { \ - printf(format "\n", ## __VA_ARGS__); \ - abort(); \ -} -#endif - -size_t spice_strnlen(const char *str, size_t max_len) -{ - size_t len = 0; - - while (len < max_len && *str != 0) { - len++; - str++; - } - - return len; -} - -char *spice_strdup(const char *str) -{ - char *copy; - - if (str == NULL) { - return NULL; - } - - copy = (char *)spice_malloc(strlen(str) + 1); - strcpy(copy, str); - return copy; -} - -char *spice_strndup(const char *str, size_t n_bytes) -{ - char *copy; - - if (str == NULL) { - return NULL; - } - - copy = (char *)spice_malloc(n_bytes + 1); - strncpy(copy, str, n_bytes); - copy[n_bytes] = 0; - return copy; -} - -void *spice_memdup(const void *mem, size_t n_bytes) -{ - void *copy; - - if (mem == NULL) { - return NULL; - } - - copy = spice_malloc(n_bytes); - memcpy(copy, mem, n_bytes); - return copy; -} - -void *spice_malloc(size_t n_bytes) -{ - void *mem; - - if (SPICE_LIKELY(n_bytes)) { - mem = malloc(n_bytes); - - if (SPICE_LIKELY(mem != NULL)) { - return mem; - } - - MALLOC_ERROR("spice_malloc: panic: unable to allocate %lu bytes\n", - (unsigned long)n_bytes); - } - return NULL; -} - -void *spice_malloc0(size_t n_bytes) -{ - void *mem; - - if (SPICE_LIKELY(n_bytes)) { - mem = calloc(1, n_bytes); - - if (SPICE_LIKELY(mem != NULL)) { - return mem; - } - - MALLOC_ERROR("spice_malloc0: panic: unable to allocate %lu bytes\n", - (unsigned long)n_bytes); - } - return NULL; -} - -void *spice_realloc(void *mem, size_t n_bytes) -{ - if (SPICE_LIKELY(n_bytes)) { - mem = realloc(mem, n_bytes); - - if (SPICE_LIKELY(mem != NULL)) { - return mem; - } - - MALLOC_ERROR("spice_realloc: panic: unable to allocate %lu bytes\n", - (unsigned long)n_bytes); - } - - if (mem) { - free(mem); - } - - return NULL; -} - -#define SIZE_OVERFLOWS(a,b) (SPICE_UNLIKELY ((a) > SIZE_MAX / (b))) - -void *spice_malloc_n(size_t n_blocks, size_t n_block_bytes) -{ - if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) { - MALLOC_ERROR("spice_malloc_n: overflow allocating %lu*%lu bytes", - (unsigned long)n_blocks, (unsigned long)n_block_bytes); - } - - return spice_malloc(n_blocks * n_block_bytes); -} - -void *spice_malloc_n_m(size_t n_blocks, size_t n_block_bytes, size_t extra_size) -{ - size_t size1, size2; - if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) { - MALLOC_ERROR("spice_malloc_n: overflow allocating %lu*%lu + %lubytes", - (unsigned long)n_blocks, (unsigned long)n_block_bytes, (unsigned long)extra_size); - } - size1 = n_blocks * n_block_bytes; - size2 = size1 + extra_size; - if (size2 < size1) { - MALLOC_ERROR("spice_malloc_n: overflow allocating %lu*%lu + %lubytes", - (unsigned long)n_blocks, (unsigned long)n_block_bytes, (unsigned long)extra_size); - } - return spice_malloc(size2); -} - - -void *spice_malloc0_n(size_t n_blocks, size_t n_block_bytes) -{ - if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) { - MALLOC_ERROR("spice_malloc0_n: overflow allocating %lu*%lu bytes", - (unsigned long)n_blocks, (unsigned long)n_block_bytes); - } - - return spice_malloc0 (n_blocks * n_block_bytes); -} - -void *spice_realloc_n(void *mem, size_t n_blocks, size_t n_block_bytes) -{ - if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) { - MALLOC_ERROR("spice_realloc_n: overflow allocating %lu*%lu bytes", - (unsigned long)n_blocks, (unsigned long)n_block_bytes); - } - - return spice_realloc(mem, n_blocks * n_block_bytes); -} - -SpiceChunks *spice_chunks_new(uint32_t count) -{ - SpiceChunks *chunks; - - chunks = (SpiceChunks *)spice_malloc_n_m(count, sizeof(SpiceChunk), sizeof(SpiceChunks)); - chunks->flags = 0; - chunks->num_chunks = count; - - return chunks; -} - -SpiceChunks *spice_chunks_new_linear(uint8_t *data, uint32_t len) -{ - SpiceChunks *chunks; - - chunks = spice_chunks_new(1); - chunks->data_size = chunks->chunk[0].len = len; - chunks->chunk[0].data = data; - return chunks; -} - -void spice_chunks_destroy(SpiceChunks *chunks) -{ - unsigned int i; - - if (chunks->flags & SPICE_CHUNKS_FLAGS_FREE) { - for (i = 0; i < chunks->num_chunks; i++) { - free(chunks->chunk[i].data); - } - } - - free(chunks); -} - -void spice_chunks_linearize(SpiceChunks *chunks) -{ - uint8_t *data, *p; - unsigned int i; - - if (chunks->num_chunks > 1) { - data = (uint8_t*)spice_malloc(chunks->data_size); - for (p = data, i = 0; i < chunks->num_chunks; i++) { - memcpy(p, chunks->chunk[i].data, - chunks->chunk[i].len); - p += chunks->chunk[i].len; - } - if (chunks->flags & SPICE_CHUNKS_FLAGS_FREE) { - for (i = 0; i < chunks->num_chunks; i++) { - free(chunks->chunk[i].data); - } - } - chunks->num_chunks = 1; - chunks->flags |= SPICE_CHUNKS_FLAGS_FREE; - chunks->flags &= ~SPICE_CHUNKS_FLAGS_UNSTABLE; - chunks->chunk[0].data = data; - chunks->chunk[0].len = chunks->data_size; - } -} diff -Nru spice-gtk-0.9/common/mem.h spice-gtk-0.12/common/mem.h --- spice-gtk-0.9/common/mem.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/mem.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,129 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2010 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H_MEM -#define _H_MEM - -#include -#include - -/* alloca definition from glib/galloca.h */ -#ifdef __GNUC__ -/* GCC does the right thing */ -# undef alloca -# define alloca(size) __builtin_alloca (size) -#elif defined (GLIB_HAVE_ALLOCA_H) -/* a native and working alloca.h is there */ -# include -#else /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */ -# if defined(_MSC_VER) || defined(__DMC__) -# include -# define alloca _alloca -# else /* !_MSC_VER && !__DMC__ */ -# ifdef _AIX -# pragma alloca -# else /* !_AIX */ -# ifndef alloca /* predefined by HP cc +Olibcalls */ -char *alloca (); -# endif /* !alloca */ -# endif /* !_AIX */ -# endif /* !_MSC_VER && !__DMC__ */ -#endif /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */ - -typedef struct SpiceChunk { - uint8_t *data; - uint32_t len; -} SpiceChunk; - -enum { - SPICE_CHUNKS_FLAGS_UNSTABLE = (1<<0), - SPICE_CHUNKS_FLAGS_FREE = (1<<1) -}; - -typedef struct SpiceChunks { - uint32_t data_size; - uint32_t num_chunks; - uint32_t flags; - SpiceChunk chunk[0]; -} SpiceChunks; - -char *spice_strdup(const char *str) SPICE_GNUC_MALLOC; -char *spice_strndup(const char *str, size_t n_bytes) SPICE_GNUC_MALLOC; -void *spice_memdup(const void *mem, size_t n_bytes) SPICE_GNUC_MALLOC; -void *spice_malloc(size_t n_bytes) SPICE_GNUC_MALLOC SPICE_GNUC_ALLOC_SIZE(1); -void *spice_malloc0(size_t n_bytes) SPICE_GNUC_MALLOC SPICE_GNUC_ALLOC_SIZE(1); -void *spice_realloc(void *mem, size_t n_bytes) SPICE_GNUC_WARN_UNUSED_RESULT; -void *spice_malloc_n(size_t n_blocks, size_t n_block_bytes) SPICE_GNUC_MALLOC SPICE_GNUC_ALLOC_SIZE2(1,2); -void *spice_malloc_n_m(size_t n_blocks, size_t n_block_bytes, size_t extra_size) SPICE_GNUC_MALLOC; -void *spice_malloc0_n(size_t n_blocks, size_t n_block_bytes) SPICE_GNUC_MALLOC SPICE_GNUC_ALLOC_SIZE2(1,2); -void *spice_realloc_n(void *mem, size_t n_blocks, size_t n_block_bytes) SPICE_GNUC_WARN_UNUSED_RESULT; -SpiceChunks *spice_chunks_new(uint32_t count) SPICE_GNUC_MALLOC; -SpiceChunks *spice_chunks_new_linear(uint8_t *data, uint32_t len) SPICE_GNUC_MALLOC; -void spice_chunks_destroy(SpiceChunks *chunks); -void spice_chunks_linearize(SpiceChunks *chunks); - -size_t spice_strnlen(const char *str, size_t max_len); - -/* Optimize: avoid the call to the (slower) _n function if we can - * determine at compile-time that no overflow happens. - */ -#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) -# define _SPICE_NEW(struct_type, n_structs, func) \ - (struct_type *) (__extension__ ({ \ - size_t __n = (size_t) (n_structs); \ - size_t __s = sizeof (struct_type); \ - void *__p; \ - if (__s == 1) \ - __p = spice_##func (__n); \ - else if (__builtin_constant_p (__n) && \ - __n <= SIZE_MAX / __s) \ - __p = spice_##func (__n * __s); \ - else \ - __p = spice_##func##_n (__n, __s); \ - __p; \ - })) -# define _SPICE_RENEW(struct_type, mem, n_structs, func) \ - (struct_type *) (__extension__ ({ \ - size_t __n = (size_t) (n_structs); \ - size_t __s = sizeof (struct_type); \ - void *__p = (void *) (mem); \ - if (__s == 1) \ - __p = spice_##func (__p, __n); \ - else if (__builtin_constant_p (__n) && \ - __n <= SIZE_MAX / __s) \ - __p = spice_##func (__p, __n * __s); \ - else \ - __p = spice_##func##_n (__p, __n, __s); \ - __p; \ - })) -#else - -/* Unoptimized version: always call the _n() function. */ - -#define _SPICE_NEW(struct_type, n_structs, func) \ - ((struct_type *) spice_##func##_n ((n_structs), sizeof (struct_type))) -#define _SPICE_RENEW(struct_type, mem, n_structs, func) \ - ((struct_type *) spice_##func##_n (mem, (n_structs), sizeof (struct_type))) - -#endif - -#define spice_new(struct_type, n_structs) _SPICE_NEW(struct_type, n_structs, malloc) -#define spice_new0(struct_type, n_structs) _SPICE_NEW(struct_type, n_structs, malloc0) -#define spice_renew(struct_type, mem, n_structs) _SPICE_RENEW(struct_type, mem, n_structs, realloc) - -#endif diff -Nru spice-gtk-0.9/common/messages.h spice-gtk-0.12/common/messages.h --- spice-gtk-0.9/common/messages.h 2011-12-22 11:22:01.000000000 +0000 +++ spice-gtk-0.12/common/messages.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,541 +0,0 @@ -/* - Copyright (C) 2009-2010 Red Hat, Inc. - - 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 copyright holder 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 HOLDER 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 - HOLDER OR CONTRIBUTORS 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. -*/ - -#ifndef _H_MESSAGES -#define _H_MESSAGES - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#ifdef USE_SMARTCARD -#include -#endif -#include "draw.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct SpiceMsgData { - uint32_t data_size; - uint8_t data[0]; -} SpiceMsgData; - -typedef struct SpiceMsgEmpty { -} SpiceMsgEmpty; - -typedef struct SpiceMsgInputsInit { - uint32_t keyboard_modifiers; -} SpiceMsgInputsInit; - -typedef struct SpiceMsgInputsKeyModifiers { - uint32_t modifiers; -} SpiceMsgInputsKeyModifiers; - -typedef struct SpiceMsgMainMultiMediaTime { - uint32_t time; -} SpiceMsgMainMultiMediaTime; - -typedef struct SpiceMsgMainMigrationBegin { - uint16_t port; - uint16_t sport; - uint32_t host_size; - uint8_t *host_data; - uint16_t pub_key_type; - uint32_t pub_key_size; - uint8_t *pub_key_data; - uint32_t cert_subject_size; - uint8_t *cert_subject_data; -} SpiceMsgMainMigrationBegin; - -typedef struct SpiceMsgMainMigrationSwitchHost { - uint16_t port; - uint16_t sport; - uint32_t host_size; - uint8_t *host_data; - uint32_t cert_subject_size; - uint8_t *cert_subject_data; -} SpiceMsgMainMigrationSwitchHost; - - -typedef struct SpiceMsgMigrate { - uint32_t flags; -} SpiceMsgMigrate; - -typedef struct SpiceResourceID { - uint8_t type; - uint64_t id; -} SpiceResourceID; - -typedef struct SpiceResourceList { - uint16_t count; - SpiceResourceID resources[0]; -} SpiceResourceList; - -typedef struct SpiceMsgSetAck { - uint32_t generation; - uint32_t window; -} SpiceMsgSetAck; - -typedef struct SpiceMsgcAckSync { - uint32_t generation; -} SpiceMsgcAckSync; - -typedef struct SpiceWaitForChannel { - uint8_t channel_type; - uint8_t channel_id; - uint64_t message_serial; -} SpiceWaitForChannel; - -typedef struct SpiceMsgWaitForChannels { - uint8_t wait_count; - SpiceWaitForChannel wait_list[0]; -} SpiceMsgWaitForChannels; - -typedef struct SpiceChannelId { - uint8_t type; - uint8_t id; -} SpiceChannelId; - -typedef struct SpiceMsgMainInit { - uint32_t session_id; - uint32_t display_channels_hint; - uint32_t supported_mouse_modes; - uint32_t current_mouse_mode; - uint32_t agent_connected; - uint32_t agent_tokens; - uint32_t multi_media_time; - uint32_t ram_hint; -} SpiceMsgMainInit; - -typedef struct SpiceMsgDisconnect { - uint64_t time_stamp; - uint32_t reason; // SPICE_ERR_? -} SpiceMsgDisconnect; - -typedef struct SpiceMsgNotify { - uint64_t time_stamp; - uint32_t severity; - uint32_t visibilty; - uint32_t what; - uint32_t message_len; - uint8_t message[0]; -} SpiceMsgNotify; - -typedef struct SpiceMsgChannels { - uint32_t num_of_channels; - SpiceChannelId channels[0]; -} SpiceMsgChannels; - -typedef struct SpiceMsgMainMouseMode { - uint32_t supported_modes; - uint32_t current_mode; -} SpiceMsgMainMouseMode; - -typedef struct SpiceMsgPing { - uint32_t id; - uint64_t timestamp; - void *data; - uint32_t data_len; -} SpiceMsgPing; - -typedef struct SpiceMsgMainAgentDisconnect { - uint32_t error_code; // SPICE_ERR_? -} SpiceMsgMainAgentDisconnect; - -#define SPICE_AGENT_MAX_DATA_SIZE 2048 - -typedef struct SpiceMsgMainAgentTokens { - uint32_t num_tokens; -} SpiceMsgMainAgentTokens, SpiceMsgcMainAgentTokens, SpiceMsgcMainAgentStart; - -typedef struct SpiceMsgcClientInfo { - uint64_t cache_size; -} SpiceMsgcClientInfo; - -typedef struct SpiceMsgcMainMouseModeRequest { - uint32_t mode; -} SpiceMsgcMainMouseModeRequest; - -typedef struct SpiceCursor { - uint32_t flags; - SpiceCursorHeader header; - uint32_t data_size; - uint8_t *data; -} SpiceCursor; - -typedef struct SpiceMsgDisplayMode { - uint32_t x_res; - uint32_t y_res; - uint32_t bits; -} SpiceMsgDisplayMode; - -typedef struct SpiceMsgSurfaceCreate { - uint32_t surface_id; - uint32_t width; - uint32_t height; - uint32_t format; - uint32_t flags; -} SpiceMsgSurfaceCreate; - -typedef struct SpiceMsgSurfaceDestroy { - uint32_t surface_id; -} SpiceMsgSurfaceDestroy; - -typedef struct SpiceMsgDisplayBase { - uint32_t surface_id; - SpiceRect box; - SpiceClip clip; -} SpiceMsgDisplayBase; - -typedef struct SpiceMsgDisplayDrawFill { - SpiceMsgDisplayBase base; - SpiceFill data; -} SpiceMsgDisplayDrawFill; - -typedef struct SpiceMsgDisplayDrawOpaque { - SpiceMsgDisplayBase base; - SpiceOpaque data; -} SpiceMsgDisplayDrawOpaque; - -typedef struct SpiceMsgDisplayDrawCopy { - SpiceMsgDisplayBase base; - SpiceCopy data; -} SpiceMsgDisplayDrawCopy; - -typedef struct SpiceMsgDisplayDrawTransparent { - SpiceMsgDisplayBase base; - SpiceTransparent data; -} SpiceMsgDisplayDrawTransparent; - -typedef struct SpiceMsgDisplayDrawAlphaBlend { - SpiceMsgDisplayBase base; - SpiceAlphaBlend data; -} SpiceMsgDisplayDrawAlphaBlend; - -typedef struct SpiceMsgDisplayCopyBits { - SpiceMsgDisplayBase base; - SpicePoint src_pos; -} SpiceMsgDisplayCopyBits; - -typedef SpiceMsgDisplayDrawCopy SpiceMsgDisplayDrawBlend; - -typedef struct SpiceMsgDisplayDrawRop3 { - SpiceMsgDisplayBase base; - SpiceRop3 data; -} SpiceMsgDisplayDrawRop3; - -typedef struct SpiceMsgDisplayDrawBlackness { - SpiceMsgDisplayBase base; - SpiceBlackness data; -} SpiceMsgDisplayDrawBlackness; - -typedef struct SpiceMsgDisplayDrawWhiteness { - SpiceMsgDisplayBase base; - SpiceWhiteness data; -} SpiceMsgDisplayDrawWhiteness; - -typedef struct SpiceMsgDisplayDrawInvers { - SpiceMsgDisplayBase base; - SpiceInvers data; -} SpiceMsgDisplayDrawInvers; - -typedef struct SpiceMsgDisplayDrawStroke { - SpiceMsgDisplayBase base; - SpiceStroke data; -} SpiceMsgDisplayDrawStroke; - -typedef struct SpiceMsgDisplayDrawText { - SpiceMsgDisplayBase base; - SpiceText data; -} SpiceMsgDisplayDrawText; - -typedef struct SpiceMsgDisplayInvalOne { - uint64_t id; -} SpiceMsgDisplayInvalOne; - -typedef struct SpiceMsgDisplayStreamCreate { - uint32_t surface_id; - uint32_t id; - uint32_t flags; - uint32_t codec_type; - uint64_t stamp; - uint32_t stream_width; - uint32_t stream_height; - uint32_t src_width; - uint32_t src_height; - SpiceRect dest; - SpiceClip clip; -} SpiceMsgDisplayStreamCreate; - -typedef struct SpiceMsgDisplayStreamData { - uint32_t id; - uint32_t multi_media_time; - uint32_t data_size; - uint8_t data[0]; -} SpiceMsgDisplayStreamData; - -typedef struct SpiceMsgDisplayStreamClip { - uint32_t id; - SpiceClip clip; -} SpiceMsgDisplayStreamClip; - -typedef struct SpiceMsgDisplayStreamDestroy { - uint32_t id; -} SpiceMsgDisplayStreamDestroy; - -typedef struct SpiceMsgCursorInit { - SpicePoint16 position; - uint16_t trail_length; - uint16_t trail_frequency; - uint8_t visible; - SpiceCursor cursor; -} SpiceMsgCursorInit; - -typedef struct SpiceMsgCursorSet { - SpicePoint16 position; - uint8_t visible; - SpiceCursor cursor; -} SpiceMsgCursorSet; - -typedef struct SpiceMsgCursorMove { - SpicePoint16 position; -} SpiceMsgCursorMove; - -typedef struct SpiceMsgCursorTrail { - uint16_t length; - uint16_t frequency; -} SpiceMsgCursorTrail; - -typedef struct SpiceMsgcDisplayInit { - uint8_t pixmap_cache_id; - int64_t pixmap_cache_size; //in pixels - uint8_t glz_dictionary_id; - int32_t glz_dictionary_window_size; // in pixels -} SpiceMsgcDisplayInit; - -typedef struct SpiceMsgcKeyDown { - uint32_t code; -} SpiceMsgcKeyDown; - -typedef struct SpiceMsgcKeyUp { - uint32_t code; -} SpiceMsgcKeyUp; - -typedef struct SpiceMsgcKeyModifiers { - uint32_t modifiers; -} SpiceMsgcKeyModifiers; - -typedef struct SpiceMsgcMouseMotion { - int32_t dx; - int32_t dy; - uint32_t buttons_state; -} SpiceMsgcMouseMotion; - -typedef struct SpiceMsgcMousePosition { - uint32_t x; - uint32_t y; - uint32_t buttons_state; - uint8_t display_id; -} SpiceMsgcMousePosition; - -typedef struct SpiceMsgcMousePress { - int32_t button; - int32_t buttons_state; -} SpiceMsgcMousePress; - -typedef struct SpiceMsgcMouseRelease { - int32_t button; - int32_t buttons_state; -} SpiceMsgcMouseRelease; - -typedef struct SpiceMsgAudioVolume { - uint8_t nchannels; - uint16_t volume[0]; -} SpiceMsgAudioVolume; - -typedef struct SpiceMsgAudioMute { - uint8_t mute; -} SpiceMsgAudioMute; - -typedef struct SpiceMsgPlaybackMode { - uint32_t time; - uint32_t mode; //SPICE_AUDIO_DATA_MODE_? - uint8_t *data; - uint32_t data_size; -} SpiceMsgPlaybackMode, SpiceMsgcRecordMode; - -typedef struct SpiceMsgPlaybackStart { - uint32_t channels; - uint32_t format; //SPICE_AUDIO_FMT_? - uint32_t frequency; - uint32_t time; -} SpiceMsgPlaybackStart; - -typedef struct SpiceMsgPlaybackPacket { - uint32_t time; - uint8_t *data; - uint32_t data_size; -} SpiceMsgPlaybackPacket, SpiceMsgcRecordPacket; - -typedef struct SpiceMsgRecordStart { - uint32_t channels; - uint32_t format; //SPICE_AUDIO_FMT_? - uint32_t frequency; -} SpiceMsgRecordStart; - -typedef struct SpiceMsgcRecordStartMark { - uint32_t time; -} SpiceMsgcRecordStartMark; - -typedef struct SpiceMsgTunnelInit { - uint16_t max_num_of_sockets; - uint32_t max_socket_data_size; -} SpiceMsgTunnelInit; - -typedef uint8_t SpiceTunnelIPv4[4]; - -typedef struct SpiceMsgTunnelIpInfo { - uint16_t type; - union { - SpiceTunnelIPv4 ipv4; - } u; - uint8_t data[0]; -} SpiceMsgTunnelIpInfo; - -typedef struct SpiceMsgTunnelServiceIpMap { - uint32_t service_id; - SpiceMsgTunnelIpInfo virtual_ip; -} SpiceMsgTunnelServiceIpMap; - -typedef struct SpiceMsgTunnelSocketOpen { - uint16_t connection_id; - uint32_t service_id; - uint32_t tokens; -} SpiceMsgTunnelSocketOpen; - -/* connection id must be the first field in msgs directed to a specific connection */ - -typedef struct SpiceMsgTunnelSocketFin { - uint16_t connection_id; -} SpiceMsgTunnelSocketFin; - -typedef struct SpiceMsgTunnelSocketClose { - uint16_t connection_id; -} SpiceMsgTunnelSocketClose; - -typedef struct SpiceMsgTunnelSocketData { - uint16_t connection_id; - uint8_t data[0]; -} SpiceMsgTunnelSocketData; - -typedef struct SpiceMsgTunnelSocketTokens { - uint16_t connection_id; - uint32_t num_tokens; -} SpiceMsgTunnelSocketTokens; - -typedef struct SpiceMsgTunnelSocketClosedAck { - uint16_t connection_id; -} SpiceMsgTunnelSocketClosedAck; - -typedef struct SpiceMsgcTunnelAddGenericService { - uint32_t type; - uint32_t id; - uint32_t group; - uint32_t port; - uint64_t name; - uint64_t description; - union { - SpiceMsgTunnelIpInfo ip; - } u; -} SpiceMsgcTunnelAddGenericService; - -typedef struct SpiceMsgcTunnelRemoveService { - uint32_t id; -} SpiceMsgcTunnelRemoveService; - -/* connection id must be the first field in msgs directed to a specific connection */ - -typedef struct SpiceMsgcTunnelSocketOpenAck { - uint16_t connection_id; - uint32_t tokens; -} SpiceMsgcTunnelSocketOpenAck; - -typedef struct SpiceMsgcTunnelSocketOpenNack { - uint16_t connection_id; -} SpiceMsgcTunnelSocketOpenNack; - -typedef struct SpiceMsgcTunnelSocketData { - uint16_t connection_id; - uint8_t data[0]; -} SpiceMsgcTunnelSocketData; - -typedef struct SpiceMsgcTunnelSocketFin { - uint16_t connection_id; -} SpiceMsgcTunnelSocketFin; - -typedef struct SpiceMsgcTunnelSocketClosed { - uint16_t connection_id; -} SpiceMsgcTunnelSocketClosed; - -typedef struct SpiceMsgcTunnelSocketClosedAck { - uint16_t connection_id; -} SpiceMsgcTunnelSocketClosedAck; - -typedef struct SpiceMsgcTunnelSocketTokens { - uint16_t connection_id; - uint32_t num_tokens; -} SpiceMsgcTunnelSocketTokens; - -#ifdef USE_SMARTCARD -typedef struct SpiceMsgSmartcard { - VSCMsgType type; - uint32_t length; - uint32_t reader_id; - uint8_t data[0]; -} SpiceMsgSmartcard; - -typedef struct SpiceMsgcSmartcard { - VSCMsgHeader header; - union { - VSCMsgError error; - VSCMsgATR atr_data; - VSCMsgReaderAdd add; - }; -} SpiceMsgcSmartcard; -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _H_SPICE_PROTOCOL */ diff -Nru spice-gtk-0.9/common/mutex.h spice-gtk-0.12/common/mutex.h --- spice-gtk-0.9/common/mutex.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/mutex.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H_MUTEX -#define _H_MUTEX -#ifdef _WIN32 -#include -typedef CRITICAL_SECTION mutex_t; -#define MUTEX_INIT(mutex) InitializeCriticalSection(&mutex) -#define MUTEX_LOCK(mutex) EnterCriticalSection(&mutex) -#define MUTEX_UNLOCK(mutex) LeaveCriticalSection(&mutex) -#else -#include -typedef pthread_mutex_t mutex_t; -#define MUTEX_INIT(mutex) pthread_mutex_init(&mutex, NULL); -#define MUTEX_LOCK(mutex) pthread_mutex_lock(&mutex) -#define MUTEX_UNLOCK(mutex) pthread_mutex_unlock(&mutex) -#endif - -#endif // _H_MUTEX diff -Nru spice-gtk-0.9/common/ogl_ctx.c spice-gtk-0.12/common/ogl_ctx.c --- spice-gtk-0.9/common/ogl_ctx.c 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/ogl_ctx.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,254 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#include -#include -#include -#include - -#include "ogl_ctx.h" - - -#define PANIC(str) { \ - printf("%s: panic: %s", __FUNCTION__, str); \ - abort(); \ -} - -enum { - OGLCTX_TYPE_PBUF, - OGLCTX_TYPE_PIXMAP, -}; - -struct OGLCtx { - int type; - Display *x_display; - GLXContext glx_context; - GLXDrawable drawable; -}; - -typedef struct OGLPixmapCtx { - OGLCtx base; - Pixmap pixmap; -} OGLPixmapCtx; - - - -const char *oglctx_type_str(OGLCtx *ctx) -{ - static const char *pbuf_str = "pbuf"; - static const char *pixmap_str = "pixmap"; - static const char *invalid_str = "invalid"; - - switch (ctx->type) { - case OGLCTX_TYPE_PBUF: - return pbuf_str; - case OGLCTX_TYPE_PIXMAP: - return pixmap_str; - default: - return invalid_str; - } -} - -void oglctx_make_current(OGLCtx *ctx) -{ - if (!glXMakeCurrent(ctx->x_display, ctx->drawable, ctx->glx_context)) { - printf("%s: failed\n", __FUNCTION__); - } -} - -OGLCtx *pbuf_create(int width, int heigth) -{ - OGLCtx *ctx; - Display *x_display; - int num_configs; - GLXFBConfig *fb_config; - GLXPbuffer glx_pbuf; - GLXContext glx_context; - - const int glx_attributes[] = { GLX_RENDER_TYPE, GLX_RGBA_BIT, - GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT, - GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, - GLX_ALPHA_SIZE, 8, - GLX_STENCIL_SIZE, 4, - 0 }; - - int pbuf_attrib[] = { GLX_PRESERVED_CONTENTS, True, - GLX_PBUFFER_WIDTH, width, - GLX_PBUFFER_HEIGHT, heigth, - GLX_LARGEST_PBUFFER, False, - 0, 0 }; - - if (!(ctx = calloc(1, sizeof(*ctx)))) { - printf("%s: alloc pbuf failed\n", __FUNCTION__); - return NULL; - } - - if (!(x_display = XOpenDisplay(NULL))) { - printf("%s: open display failed\n", __FUNCTION__); - goto error_1; - } - - if (!(fb_config = glXChooseFBConfig(x_display, 0, glx_attributes, &num_configs)) || - !num_configs) { - printf("%s: choose fb config failed\n", __FUNCTION__); - goto error_2; - } - - if (!(glx_pbuf = glXCreatePbuffer(x_display, fb_config[0], pbuf_attrib))) { - goto error_3; - } - - if (!(glx_context = glXCreateNewContext(x_display, fb_config[0], GLX_RGBA_TYPE, NULL, True))) { - printf("%s: create context failed\n", __FUNCTION__); - goto error_4; - } - - XFree(fb_config); - - ctx->type = OGLCTX_TYPE_PBUF; - ctx->drawable = glx_pbuf; - ctx->glx_context = glx_context; - ctx->x_display = x_display; - - return ctx; - -error_4: - glXDestroyPbuffer(x_display, glx_pbuf); - -error_3: - XFree(fb_config); - -error_2: - XCloseDisplay(x_display); - -error_1: - free(ctx); - - return NULL; -} - -OGLCtx *pixmap_create(int width, int heigth) -{ - Display *x_display; - int num_configs; - GLXFBConfig *fb_config; - GLXPixmap glx_pixmap; - GLXContext glx_context; - Pixmap pixmap; - int screen; - Window root_window; - OGLPixmapCtx *pix; - - const int glx_attributes[] = { GLX_RENDER_TYPE, GLX_RGBA_BIT, - GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT, - GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, - GLX_ALPHA_SIZE, 8, - GLX_STENCIL_SIZE, 4, - 0 }; - - if (!(pix = calloc(1, sizeof(*pix)))) { - printf("%s: alloc pix failed\n", __FUNCTION__); - return NULL; - } - - if (!(x_display = XOpenDisplay(NULL))) { - printf("%s: open display failed\n", __FUNCTION__); - goto error_1; - } - - screen = DefaultScreen(x_display); - root_window = RootWindow(x_display, screen); - - if (!(fb_config = glXChooseFBConfig(x_display, 0, glx_attributes, &num_configs)) || - !num_configs) { - printf("%s: choose fb config failed\n", __FUNCTION__); - goto error_2; - } - - if (!(pixmap = XCreatePixmap(x_display, root_window, width, heigth, 32 /*use fb config*/))) { - printf("%s: create x pixmap failed\n", __FUNCTION__); - goto error_3; - } - - if (!(glx_pixmap = glXCreatePixmap(x_display, fb_config[0], pixmap, NULL))) { - printf("%s: create glx pixmap failed\n", __FUNCTION__); - goto error_4; - } - - - if (!(glx_context = glXCreateNewContext(x_display, fb_config[0], GLX_RGBA_TYPE, NULL, True))) { - printf("%s: create context failed\n", __FUNCTION__); - goto error_5; - } - - XFree(fb_config); - - pix->base.type = OGLCTX_TYPE_PIXMAP; - pix->base.x_display = x_display; - pix->base.drawable = glx_pixmap; - pix->base.glx_context = glx_context; - pix->pixmap = pixmap; - - return &pix->base; - -error_5: - glXDestroyPixmap(x_display, glx_pixmap); - -error_4: - XFreePixmap(x_display, pixmap); - -error_3: - XFree(fb_config); - -error_2: - XCloseDisplay(x_display); - -error_1: - free(pix); - - return NULL; -} - -void oglctx_destroy(OGLCtx *ctx) -{ - if (!ctx) { - return; - } - // test is current ? - - glXDestroyContext(ctx->x_display, ctx->glx_context); - switch (ctx->type) { - case OGLCTX_TYPE_PBUF: - glXDestroyPbuffer(ctx->x_display, ctx->drawable); - break; - case OGLCTX_TYPE_PIXMAP: - glXDestroyPixmap(ctx->x_display, ctx->drawable); - XFreePixmap(ctx->x_display, ((OGLPixmapCtx *)ctx)->pixmap); - break; - default: - PANIC("invalid ogl ctx type"); - } - - XCloseDisplay(ctx->x_display); - free(ctx); -} - diff -Nru spice-gtk-0.9/common/ogl_ctx.h spice-gtk-0.12/common/ogl_ctx.h --- spice-gtk-0.9/common/ogl_ctx.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/ogl_ctx.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H_GLCTX -#define _H_GLCTX - -typedef struct OGLCtx OGLCtx; - -const char *oglctx_type_str(OGLCtx *ctx); -void oglctx_make_current(OGLCtx *ctx); -OGLCtx *pbuf_create(int width, int heigth); -OGLCtx *pixmap_create(int width, int heigth); -void oglctx_destroy(OGLCtx *ctx); - -#endif - diff -Nru spice-gtk-0.9/common/pixman_utils.c spice-gtk-0.12/common/pixman_utils.c --- spice-gtk-0.9/common/pixman_utils.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/pixman_utils.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1614 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#include -#include "pixman_utils.h" -#include - -#include -#include -#include -#include "mem.h" - -#ifndef ASSERT -#define ASSERT(x) if (!(x)) { \ - printf("%s: ASSERT %s failed\n", __FUNCTION__, #x); \ - abort(); \ -} -#endif - -#ifndef PANIC -#define PANIC(str) { \ - printf("%s: panic: %s", __FUNCTION__, str); \ - abort(); \ -} -#endif - -#define SOLID_RASTER_OP(_name, _size, _type, _equation) \ -static void \ -solid_rop_ ## _name ## _ ## _size (_type *ptr, int len, _type src) \ -{ \ - while (len--) { \ - _type dst = *ptr; \ - if (dst) /* avoid unused warning */{}; \ - *ptr = (_type)(_equation); \ - ptr++; \ - } \ -} \ - -#define TILED_RASTER_OP(_name, _size, _type, _equation) \ -static void \ -tiled_rop_ ## _name ## _ ## _size (_type *ptr, int len, _type *tile, _type *tile_end, int tile_width) \ -{ \ - while (len--) { \ - _type src = *tile; \ - _type dst = *ptr; \ - if (src) /* avoid unused warning */{}; \ - if (dst) /* avoid unused warning */{}; \ - *ptr = (_type)(_equation); \ - ptr++; \ - tile++; \ - if (tile == tile_end) \ - tile -= tile_width; \ - } \ -} \ - -#define COPY_RASTER_OP(_name, _size, _type, _equation) \ -static void \ - copy_rop_ ## _name ## _ ## _size (_type *ptr, _type *src_line, int len) \ -{ \ - while (len--) { \ - _type src = *src_line; \ - _type dst = *ptr; \ - if (src) /* avoid unused warning */ {}; \ - if (dst) /* avoid unused warning */{}; \ - *ptr = (_type)(_equation); \ - ptr++; \ - src_line++; \ - } \ -} \ - -#define RASTER_OP(name, equation) \ - SOLID_RASTER_OP(name, 8, uint8_t, equation) \ - SOLID_RASTER_OP(name, 16, uint16_t, equation) \ - SOLID_RASTER_OP(name, 32, uint32_t, equation) \ - TILED_RASTER_OP(name, 8, uint8_t, equation) \ - TILED_RASTER_OP(name, 16, uint16_t, equation) \ - TILED_RASTER_OP(name, 32, uint32_t, equation) \ - COPY_RASTER_OP(name, 8, uint8_t, equation) \ - COPY_RASTER_OP(name, 16, uint16_t, equation) \ - COPY_RASTER_OP(name, 32, uint32_t, equation) - -RASTER_OP(clear, 0x0) -RASTER_OP(and, src & dst) -RASTER_OP(and_reverse, src & ~dst) -RASTER_OP(copy, src) -RASTER_OP(and_inverted, ~src & dst) -RASTER_OP(noop, dst) -RASTER_OP(xor, src ^ dst) -RASTER_OP(or, src | dst) -RASTER_OP(nor, ~src & ~dst) -RASTER_OP(equiv, ~src ^ dst) -RASTER_OP(invert, ~dst) -RASTER_OP(or_reverse, src | ~dst) -RASTER_OP(copy_inverted, ~src) -RASTER_OP(or_inverted, ~src | dst) -RASTER_OP(nand, ~src | ~dst) -RASTER_OP(set, 0xffffffff) - -typedef void (*solid_rop_8_func_t)(uint8_t *ptr, int len, uint8_t src); -typedef void (*solid_rop_16_func_t)(uint16_t *ptr, int len, uint16_t src); -typedef void (*solid_rop_32_func_t)(uint32_t *ptr, int len, uint32_t src); -typedef void (*tiled_rop_8_func_t)(uint8_t *ptr, int len, - uint8_t *tile, uint8_t *tile_end, int tile_width); -typedef void (*tiled_rop_16_func_t)(uint16_t *ptr, int len, - uint16_t *tile, uint16_t *tile_end, int tile_width); -typedef void (*tiled_rop_32_func_t)(uint32_t *ptr, int len, - uint32_t *tile, uint32_t *tile_end, int tile_width); -typedef void (*copy_rop_8_func_t)(uint8_t *ptr, uint8_t *src, int len); -typedef void (*copy_rop_16_func_t)(uint16_t *ptr, uint16_t *src, int len); -typedef void (*copy_rop_32_func_t)(uint32_t *ptr, uint32_t *src, int len); - -#define ROP_TABLE(_type, _size) \ -static void (*solid_rops_ ## _size[16]) (_type *ptr, int len, _type src) = { \ - solid_rop_clear_ ## _size, \ - solid_rop_and_ ## _size, \ - solid_rop_and_reverse_ ## _size, \ - solid_rop_copy_ ## _size, \ - solid_rop_and_inverted_ ## _size, \ - solid_rop_noop_ ## _size, \ - solid_rop_xor_ ## _size, \ - solid_rop_or_ ## _size, \ - solid_rop_nor_ ## _size, \ - solid_rop_equiv_ ## _size, \ - solid_rop_invert_ ## _size, \ - solid_rop_or_reverse_ ## _size, \ - solid_rop_copy_inverted_ ## _size, \ - solid_rop_or_inverted_ ## _size, \ - solid_rop_nand_ ## _size, \ - solid_rop_set_ ## _size \ -}; \ -static void (*tiled_rops_ ## _size[16]) (_type *ptr, int len, _type *tile, _type *tile_end, int tile_width) = { \ - tiled_rop_clear_ ## _size, \ - tiled_rop_and_ ## _size, \ - tiled_rop_and_reverse_ ## _size, \ - tiled_rop_copy_ ## _size, \ - tiled_rop_and_inverted_ ## _size, \ - tiled_rop_noop_ ## _size, \ - tiled_rop_xor_ ## _size, \ - tiled_rop_or_ ## _size, \ - tiled_rop_nor_ ## _size, \ - tiled_rop_equiv_ ## _size, \ - tiled_rop_invert_ ## _size, \ - tiled_rop_or_reverse_ ## _size, \ - tiled_rop_copy_inverted_ ## _size, \ - tiled_rop_or_inverted_ ## _size, \ - tiled_rop_nand_ ## _size, \ - tiled_rop_set_ ## _size \ -}; \ -static void (*copy_rops_ ## _size[16]) (_type *ptr, _type *tile, int len) = { \ - copy_rop_clear_ ## _size, \ - copy_rop_and_ ## _size, \ - copy_rop_and_reverse_ ## _size, \ - copy_rop_copy_ ## _size, \ - copy_rop_and_inverted_ ## _size, \ - copy_rop_noop_ ## _size, \ - copy_rop_xor_ ## _size, \ - copy_rop_or_ ## _size, \ - copy_rop_nor_ ## _size, \ - copy_rop_equiv_ ## _size, \ - copy_rop_invert_ ## _size, \ - copy_rop_or_reverse_ ## _size, \ - copy_rop_copy_inverted_ ## _size, \ - copy_rop_or_inverted_ ## _size, \ - copy_rop_nand_ ## _size, \ - copy_rop_set_ ## _size \ -}; - -ROP_TABLE(uint8_t, 8) -ROP_TABLE(uint16_t, 16) -ROP_TABLE(uint32_t, 32) - -/* We can't get the real bits per pixel info from pixman_image_t, - only the DEPTH which is the sum of all a+r+g+b bits, which - is e.g. 24 for 32bit xRGB. We really want the bpp, so - we have this ugly conversion thing */ -int spice_pixman_image_get_bpp(pixman_image_t *image) -{ - int depth; - - depth = pixman_image_get_depth(image); - if (depth == 24) { - return 32; - } - if (depth == 15) { - return 16; - } - return depth; -} - -void spice_pixman_fill_rect(pixman_image_t *dest, - int x, int y, - int width, int height, - uint32_t value) -{ - uint32_t *bits; - int stride, depth; - uint32_t byte_width; - uint8_t *byte_line; - - bits = pixman_image_get_data(dest); - stride = pixman_image_get_stride(dest); - depth = spice_pixman_image_get_bpp(dest); - /* stride is in bytes, depth in bits */ - - ASSERT(x >= 0); - ASSERT(y >= 0); - ASSERT(width > 0); - ASSERT(height > 0); - ASSERT(x + width <= pixman_image_get_width(dest)); - ASSERT(y + height <= pixman_image_get_height(dest)); - - if (pixman_fill(bits, - stride / 4, - depth, - x, y, - width, height, - value)) { - return; - } - - if (depth == 8) { - byte_line = ((uint8_t *)bits) + stride * y + x; - byte_width = width; - value = (value & 0xff) * 0x01010101; - } else if (depth == 16) { - byte_line = ((uint8_t *)bits) + stride * y + x * 2; - byte_width = 2 * width; - value = (value & 0xffff) * 0x00010001; - } else { - ASSERT (depth == 32) - byte_line = ((uint8_t *)bits) + stride * y + x * 4; - byte_width = 4 * width; - } - - while (height--) { - int w; - uint8_t *d = byte_line; - - byte_line += stride; - w = byte_width; - - while (w >= 1 && ((unsigned long)d & 1)) { - *(uint8_t *)d = (value & 0xff); - w--; - d++; - } - - while (w >= 2 && ((unsigned long)d & 3)) { - *(uint16_t *)d = value; - w -= 2; - d += 2; - } - - while (w >= 4 && ((unsigned long)d & 7)) { - *(uint32_t *)d = value; - - w -= 4; - d += 4; - } - - while (w >= 4) { - *(uint32_t *)d = value; - - w -= 4; - d += 4; - } - - while (w >= 2) { - *(uint16_t *)d = value; - w -= 2; - d += 2; - } - - while (w >= 1) { - *(uint8_t *)d = (value & 0xff); - w--; - d++; - } - } -} - -void spice_pixman_fill_rect_rop(pixman_image_t *dest, - int x, int y, - int width, int height, - uint32_t value, - SpiceROP rop) -{ - uint32_t *bits; - int stride, depth; - uint8_t *byte_line; - - bits = pixman_image_get_data(dest); - stride = pixman_image_get_stride(dest); - depth = spice_pixman_image_get_bpp(dest); - /* stride is in bytes, depth in bits */ - - ASSERT(x >= 0); - ASSERT(y >= 0); - ASSERT(width > 0); - ASSERT(height > 0); - ASSERT(x + width <= pixman_image_get_width(dest)); - ASSERT(y + height <= pixman_image_get_height(dest)); - ASSERT(rop >= 0 && rop < 16); - - if (depth == 8) { - solid_rop_8_func_t rop_func = solid_rops_8[rop]; - - byte_line = ((uint8_t *)bits) + stride * y + x; - while (height--) { - rop_func((uint8_t *)byte_line, width, (uint8_t)value); - byte_line += stride; - } - - } else if (depth == 16) { - solid_rop_16_func_t rop_func = solid_rops_16[rop]; - - byte_line = ((uint8_t *)bits) + stride * y + x * 2; - while (height--) { - rop_func((uint16_t *)byte_line, width, (uint16_t)value); - byte_line += stride; - } - } else { - solid_rop_32_func_t rop_func = solid_rops_32[rop]; - - byte_line = ((uint8_t *)bits) + stride * y + x * 4; - while (height--) { - rop_func((uint32_t *)byte_line, width, (uint32_t)value); - byte_line += stride; - } - } -} - -void spice_pixman_tile_rect(pixman_image_t *dest, - int x, int y, - int width, int height, - pixman_image_t *tile, - int offset_x, - int offset_y) -{ - uint32_t *bits, *tile_bits; - int stride, depth; - int tile_width, tile_height, tile_stride; - uint8_t *byte_line; - uint8_t *tile_line; - int tile_start_x, tile_start_y, tile_end_dx; - - bits = pixman_image_get_data(dest); - stride = pixman_image_get_stride(dest); - depth = spice_pixman_image_get_bpp(dest); - /* stride is in bytes, depth in bits */ - - tile_bits = pixman_image_get_data(tile); - tile_stride = pixman_image_get_stride(tile); - tile_width = pixman_image_get_width(tile); - tile_height = pixman_image_get_height(tile); - - ASSERT(x >= 0); - ASSERT(y >= 0); - ASSERT(width > 0); - ASSERT(height > 0); - ASSERT(x + width <= pixman_image_get_width(dest)); - ASSERT(y + height <= pixman_image_get_height(dest)); - ASSERT(depth == spice_pixman_image_get_bpp(tile)); - - tile_start_x = (x - offset_x) % tile_width; - if (tile_start_x < 0) { - tile_start_x += tile_width; - } - tile_start_y = (y - offset_y) % tile_height; - if (tile_start_y < 0) { - tile_start_y += tile_height; - } - tile_end_dx = tile_width - tile_start_x; - - if (depth == 8) { - byte_line = ((uint8_t *)bits) + stride * y + x; - tile_line = ((uint8_t *)tile_bits) + tile_stride * tile_start_y + tile_start_x; - while (height--) { - tiled_rop_copy_8((uint8_t *)byte_line, width, - (uint8_t *)tile_line, (uint8_t *)tile_line + tile_end_dx, - tile_width); - byte_line += stride; - tile_line += tile_stride; - if (++tile_start_y == tile_height) { - tile_line -= tile_height * tile_stride; - tile_start_y = 0; - } - } - - } else if (depth == 16) { - byte_line = ((uint8_t *)bits) + stride * y + x * 2; - tile_line = ((uint8_t *)tile_bits) + tile_stride * tile_start_y + tile_start_x * 2; - while (height--) { - tiled_rop_copy_16((uint16_t *)byte_line, width, - (uint16_t *)tile_line, (uint16_t *)tile_line + tile_end_dx, - tile_width); - byte_line += stride; - tile_line += tile_stride; - if (++tile_start_y == tile_height) { - tile_line -= tile_height * tile_stride; - tile_start_y = 0; - } - } - } else { - ASSERT (depth == 32); - - byte_line = ((uint8_t *)bits) + stride * y + x * 4; - tile_line = ((uint8_t *)tile_bits) + tile_stride * tile_start_y + tile_start_x * 4; - while (height--) { - tiled_rop_copy_32((uint32_t *)byte_line, width, - (uint32_t *)tile_line, (uint32_t *)tile_line + tile_end_dx, - tile_width); - byte_line += stride; - tile_line += tile_stride; - if (++tile_start_y == tile_height) { - tile_line -= tile_height * tile_stride; - tile_start_y = 0; - } - } - } -} - -void spice_pixman_tile_rect_rop(pixman_image_t *dest, - int x, int y, - int width, int height, - pixman_image_t *tile, - int offset_x, - int offset_y, - SpiceROP rop) -{ - uint32_t *bits, *tile_bits; - int stride, depth; - int tile_width, tile_height, tile_stride; - uint8_t *byte_line; - uint8_t *tile_line; - int tile_start_x, tile_start_y, tile_end_dx; - - bits = pixman_image_get_data(dest); - stride = pixman_image_get_stride(dest); - depth = spice_pixman_image_get_bpp(dest); - /* stride is in bytes, depth in bits */ - - tile_bits = pixman_image_get_data(tile); - tile_stride = pixman_image_get_stride(tile); - tile_width = pixman_image_get_width(tile); - tile_height = pixman_image_get_height(tile); - - ASSERT(x >= 0); - ASSERT(y >= 0); - ASSERT(width > 0); - ASSERT(height > 0); - ASSERT(x + width <= pixman_image_get_width(dest)); - ASSERT(y + height <= pixman_image_get_height(dest)); - ASSERT(rop >= 0 && rop < 16); - ASSERT(depth == spice_pixman_image_get_bpp(tile)); - - tile_start_x = (x - offset_x) % tile_width; - if (tile_start_x < 0) { - tile_start_x += tile_width; - } - tile_start_y = (y - offset_y) % tile_height; - if (tile_start_y < 0) { - tile_start_y += tile_height; - } - tile_end_dx = tile_width - tile_start_x; - - if (depth == 8) { - tiled_rop_8_func_t rop_func = tiled_rops_8[rop]; - - byte_line = ((uint8_t *)bits) + stride * y + x; - tile_line = ((uint8_t *)tile_bits) + tile_stride * tile_start_y + tile_start_x; - while (height--) { - rop_func((uint8_t *)byte_line, width, - (uint8_t *)tile_line, (uint8_t *)tile_line + tile_end_dx, - tile_width); - byte_line += stride; - tile_line += tile_stride; - if (++tile_start_y == tile_height) { - tile_line -= tile_height * tile_stride; - tile_start_y = 0; - } - } - - } else if (depth == 16) { - tiled_rop_16_func_t rop_func = tiled_rops_16[rop]; - - byte_line = ((uint8_t *)bits) + stride * y + x * 2; - tile_line = ((uint8_t *)tile_bits) + tile_stride * tile_start_y + tile_start_x * 2; - while (height--) { - rop_func((uint16_t *)byte_line, width, - (uint16_t *)tile_line, (uint16_t *)tile_line + tile_end_dx, - tile_width); - byte_line += stride; - tile_line += tile_stride; - if (++tile_start_y == tile_height) { - tile_line -= tile_height * tile_stride; - tile_start_y = 0; - } - } - } else { - tiled_rop_32_func_t rop_func = tiled_rops_32[rop]; - - ASSERT (depth == 32); - - byte_line = ((uint8_t *)bits) + stride * y + x * 4; - tile_line = ((uint8_t *)tile_bits) + tile_stride * tile_start_y + tile_start_x * 4; - while (height--) { - rop_func((uint32_t *)byte_line, width, - (uint32_t *)tile_line, (uint32_t *)tile_line + tile_end_dx, - tile_width); - byte_line += stride; - tile_line += tile_stride; - if (++tile_start_y == tile_height) { - tile_line -= tile_height * tile_stride; - tile_start_y = 0; - } - } - } -} - - -void spice_pixman_blit(pixman_image_t *dest, - pixman_image_t *src, - int src_x, int src_y, - int dest_x, int dest_y, - int width, int height) -{ - uint32_t *bits, *src_bits; - int stride, depth, src_depth; - int src_width, src_height, src_stride; - uint8_t *byte_line; - uint8_t *src_line; - int byte_width; - - if (!src) { - fprintf(stderr, "missing src!"); - return; - } - - bits = pixman_image_get_data(dest); - stride = pixman_image_get_stride(dest); - depth = spice_pixman_image_get_bpp(dest); - /* stride is in bytes, depth in bits */ - - src_bits = pixman_image_get_data(src); - src_stride = pixman_image_get_stride(src); - src_width = pixman_image_get_width(src); - src_height = pixman_image_get_height(src); - src_depth = spice_pixman_image_get_bpp(src); - - /* Clip source */ - if (src_x < 0) { - width += src_x; - dest_x -= src_x; - src_x = 0; - } - if (src_y < 0) { - height += src_y; - dest_y -= src_y; - src_y = 0; - } - if (src_x + width > src_width) { - width = src_width - src_x; - } - if (src_y + height > src_height) { - height = src_height - src_y; - } - - if (width <= 0 || height <= 0) { - return; - } - - ASSERT(src_x >= 0); - ASSERT(src_y >= 0); - ASSERT(dest_x >= 0); - ASSERT(dest_y >= 0); - ASSERT(width > 0); - ASSERT(height > 0); - ASSERT(dest_x + width <= pixman_image_get_width(dest)); - ASSERT(dest_y + height <= pixman_image_get_height(dest)); - ASSERT(src_x + width <= pixman_image_get_width(src)); - ASSERT(src_y + height <= pixman_image_get_height(src)); - ASSERT(depth == src_depth); - - if (pixman_blt(src_bits, - bits, - src_stride / 4, - stride / 4, - depth, depth, - src_x, src_y, - dest_x, dest_y, - width, height)) { - return; - } - - if (depth == 8) { - byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x; - byte_width = width; - src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x; - } else if (depth == 16) { - byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 2; - byte_width = width * 2; - src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 2; - } else { - ASSERT (depth == 32); - byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 4; - byte_width = width * 4; - src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 4; - } - - while (height--) { - memcpy(byte_line, src_line, byte_width); - byte_line += stride; - src_line += src_stride; - } -} - -void spice_pixman_blit_rop (pixman_image_t *dest, - pixman_image_t *src, - int src_x, int src_y, - int dest_x, int dest_y, - int width, int height, - SpiceROP rop) -{ - uint32_t *bits, *src_bits; - int stride, depth, src_depth; - int src_width, src_height, src_stride; - uint8_t *byte_line; - uint8_t *src_line; - - bits = pixman_image_get_data(dest); - stride = pixman_image_get_stride(dest); - depth = spice_pixman_image_get_bpp(dest); - /* stride is in bytes, depth in bits */ - - src_bits = pixman_image_get_data(src); - src_stride = pixman_image_get_stride(src); - src_width = pixman_image_get_width(src); - src_height = pixman_image_get_height(src); - src_depth = spice_pixman_image_get_bpp(src); - - /* Clip source */ - if (src_x < 0) { - width += src_x; - dest_x -= src_x; - src_x = 0; - } - if (src_y < 0) { - height += src_y; - dest_y -= src_y; - src_y = 0; - } - if (src_x + width > src_width) { - width = src_width - src_x; - } - if (src_y + height > src_height) { - height = src_height - src_y; - } - - if (width <= 0 || height <= 0) { - return; - } - - ASSERT(src_x >= 0); - ASSERT(src_y >= 0); - ASSERT(dest_x >= 0); - ASSERT(dest_y >= 0); - ASSERT(width > 0); - ASSERT(height > 0); - ASSERT(dest_x + width <= pixman_image_get_width(dest)); - ASSERT(dest_y + height <= pixman_image_get_height(dest)); - ASSERT(src_x + width <= pixman_image_get_width(src)); - ASSERT(src_y + height <= pixman_image_get_height(src)); - ASSERT(depth == src_depth); - - if (depth == 8) { - copy_rop_8_func_t rop_func = copy_rops_8[rop]; - - byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x; - src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x; - - while (height--) { - rop_func((uint8_t *)byte_line, (uint8_t *)src_line, width); - byte_line += stride; - src_line += src_stride; - } - } else if (depth == 16) { - copy_rop_16_func_t rop_func = copy_rops_16[rop]; - - byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 2; - src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 2; - - while (height--) { - rop_func((uint16_t *)byte_line, (uint16_t *)src_line, width); - byte_line += stride; - src_line += src_stride; - } - } else { - copy_rop_32_func_t rop_func = copy_rops_32[rop]; - - ASSERT (depth == 32); - byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 4; - src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 4; - - while (height--) { - rop_func((uint32_t *)byte_line, (uint32_t *)src_line, width); - byte_line += stride; - src_line += src_stride; - } - } - -} - -void spice_pixman_blit_colorkey (pixman_image_t *dest, - pixman_image_t *src, - int src_x, int src_y, - int dest_x, int dest_y, - int width, int height, - uint32_t transparent_color) -{ - uint32_t *bits, *src_bits; - int stride, depth; - int src_width, src_height, src_stride; - uint8_t *byte_line; - uint8_t *src_line; - int x; - - bits = pixman_image_get_data(dest); - stride = pixman_image_get_stride(dest); - depth = spice_pixman_image_get_bpp(dest); - /* stride is in bytes, depth in bits */ - - src_bits = pixman_image_get_data(src); - src_stride = pixman_image_get_stride(src); - src_width = pixman_image_get_width(src); - src_height = pixman_image_get_height(src); - - /* Clip source */ - if (src_x < 0) { - width += src_x; - dest_x -= src_x; - src_x = 0; - } - if (src_y < 0) { - height += src_y; - dest_y -= src_y; - src_y = 0; - } - if (src_x + width > src_width) { - width = src_width - src_x; - } - if (src_y + height > src_height) { - height = src_height - src_y; - } - - if (width <= 0 || height <= 0) { - return; - } - - ASSERT(src_x >= 0); - ASSERT(src_y >= 0); - ASSERT(dest_x >= 0); - ASSERT(dest_y >= 0); - ASSERT(width > 0); - ASSERT(height > 0); - ASSERT(dest_x + width <= pixman_image_get_width(dest)); - ASSERT(dest_y + height <= pixman_image_get_height(dest)); - ASSERT(src_x + width <= pixman_image_get_width(src)); - ASSERT(src_y + height <= pixman_image_get_height(src)); - ASSERT(depth == spice_pixman_image_get_bpp(src)); - - if (depth == 8) { - byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x; - src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x; - - while (height--) { - uint8_t *d = (uint8_t *)byte_line; - uint8_t *s = (uint8_t *)byte_line; - - s = (uint8_t *)src_line; - for (x = 0; x < width; x++) { - uint8_t val = *s; - if (val != (uint8_t)transparent_color) { - *d = val; - } - s++; d++; - } - - byte_line += stride; - src_line += src_stride; - } - } else if (depth == 16) { - byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 2; - src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 2; - - while (height--) { - uint16_t *d = (uint16_t *)byte_line; - uint16_t *s = (uint16_t *)byte_line; - - s = (uint16_t *)src_line; - for (x = 0; x < width; x++) { - uint16_t val = *s; - if (val != (uint16_t)transparent_color) { - *d = val; - } - s++; d++; - } - - byte_line += stride; - src_line += src_stride; - } - } else { - ASSERT (depth == 32); - byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 4; - src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 4; - - while (height--) { - uint32_t *d = (uint32_t *)byte_line; - uint32_t *s = (uint32_t *)byte_line; - - transparent_color &= 0xffffff; - s = (uint32_t *)src_line; - for (x = 0; x < width; x++) { - uint32_t val = *s; - if ((0xffffff & val) != transparent_color) { - *d = val; - } - s++; d++; - } - - byte_line += stride; - src_line += src_stride; - } - } -} - -static void copy_bits_up(uint8_t *data, const int stride, int bpp, - const int src_x, const int src_y, - const int width, const int height, - const int dest_x, const int dest_y) -{ - uint8_t *src = data + src_y * stride + src_x * bpp; - uint8_t *dest = data + dest_y * stride + dest_x * bpp; - uint8_t *end = dest + height * stride; - for (; dest != end; dest += stride, src += stride) { - memcpy(dest, src, width * bpp); - } -} - -static void copy_bits_down(uint8_t *data, const int stride, int bpp, - const int src_x, const int src_y, - const int width, const int height, - const int dest_x, const int dest_y) -{ - uint8_t *src = data + (src_y + height - 1) * stride + src_x * bpp; - uint8_t *end = data + (dest_y - 1) * stride + dest_x * bpp; - uint8_t *dest = end + height * stride; - - for (; dest != end; dest -= stride, src -= stride) { - memcpy(dest, src, width * bpp); - } -} - -static void copy_bits_same_line(uint8_t *data, const int stride, int bpp, - const int src_x, const int src_y, - const int width, const int height, - const int dest_x, const int dest_y) -{ - uint8_t *src = data + src_y * stride + src_x * bpp; - uint8_t *dest = data + dest_y * stride + dest_x * bpp; - uint8_t *end = dest + height * stride; - for (; dest != end; dest += stride, src += stride) { - memmove(dest, src, width * bpp); - } -} - -void spice_pixman_copy_rect (pixman_image_t *image, - int src_x, int src_y, - int width, int height, - int dest_x, int dest_y) -{ - uint8_t *data; - int stride; - int bpp; - - data = (uint8_t *)pixman_image_get_data(image); - stride = pixman_image_get_stride(image); - bpp = spice_pixman_image_get_bpp(image) / 8; - - if (dest_y > src_y) { - copy_bits_down(data, stride, bpp, - src_x, src_y, - width, height, - dest_x, dest_y); - } else if (dest_y < src_y) { - copy_bits_up(data, stride, bpp, - src_x, src_y, - width, height, - dest_x, dest_y); - } else { - copy_bits_same_line(data, stride, bpp, - src_x, src_y, - width, height, - dest_x, dest_y); - } -} - -pixman_bool_t spice_pixman_region32_init_rects (pixman_region32_t *region, - const SpiceRect *rects, - int count) -{ - /* These types are compatible, so just cast */ - return pixman_region32_init_rects(region, (pixman_box32_t *)rects, count); -} - -pixman_format_code_t spice_surface_format_to_pixman(uint32_t surface_format) -{ - switch (surface_format) { - case SPICE_SURFACE_FMT_1_A: - return PIXMAN_a1; - case SPICE_SURFACE_FMT_8_A: - return PIXMAN_a8; - case SPICE_SURFACE_FMT_16_555: - return PIXMAN_x1r5g5b5; - case SPICE_SURFACE_FMT_16_565: - return PIXMAN_r5g6b5; - case SPICE_SURFACE_FMT_32_xRGB: - return PIXMAN_x8r8g8b8; - case SPICE_SURFACE_FMT_32_ARGB: - return PIXMAN_a8r8g8b8; - default: - printf("Unknown surface format %d\n", surface_format); - abort(); - break; - } - return (pixman_format_code_t)0; /* Not reached */ -} - -/* Returns the "spice native" pixman version of a specific bitmap format. - * This isn't bitwise the same as the bitmap format, for instance we - * typically convert indexed to real color modes and use the standard - * surface modes rather than weird things like 24bit - */ -pixman_format_code_t spice_bitmap_format_to_pixman(int bitmap_format, - uint32_t palette_surface_format) -{ - switch (bitmap_format) { - case SPICE_BITMAP_FMT_1BIT_LE: - case SPICE_BITMAP_FMT_1BIT_BE: - case SPICE_BITMAP_FMT_4BIT_LE: - case SPICE_BITMAP_FMT_4BIT_BE: - case SPICE_BITMAP_FMT_8BIT: - /* Indexed mode palettes are the same as their destination canvas format */ - return spice_surface_format_to_pixman(palette_surface_format); - - case SPICE_BITMAP_FMT_16BIT: - return PIXMAN_x1r5g5b5; - - case SPICE_BITMAP_FMT_24BIT: - case SPICE_BITMAP_FMT_32BIT: - return PIXMAN_x8r8g8b8; - - case SPICE_BITMAP_FMT_RGBA: - return PIXMAN_a8r8g8b8; - - case SPICE_BITMAP_FMT_INVALID: - default: - printf("Unknown bitmap format %d\n", bitmap_format); - abort(); - return PIXMAN_a8r8g8b8; - } -} - -/* Tries to view a spice bitmap as a pixman_image_t without copying, - * will often fail due to unhandled formats or strides. - */ -pixman_image_t *spice_bitmap_try_as_pixman(int src_format, - int flags, - int width, - int height, - uint8_t *data, - int stride) -{ - pixman_format_code_t pixman_format; - - /* Pixman stride must be multiple of 4 */ - if (stride % 4 != 0) { - return NULL; - } - - switch (src_format) { - case SPICE_BITMAP_FMT_32BIT: -#ifdef WORDS_BIGENDIAN - pixman_format = PIXMAN_b8g8r8x8; -#else - pixman_format = PIXMAN_x8r8g8b8; -#endif - break; - case SPICE_BITMAP_FMT_RGBA: -#ifdef WORDS_BIGENDIAN - pixman_format = PIXMAN_b8g8r8a8; -#else - pixman_format = PIXMAN_a8r8g8b8; -#endif - break; - case SPICE_BITMAP_FMT_24BIT: -#ifdef WORDS_BIGENDIAN - pixman_format = PIXMAN_b8g8r8; -#else - pixman_format = PIXMAN_r8g8b8; -#endif - break; - case SPICE_BITMAP_FMT_16BIT: -#ifdef WORDS_BIGENDIAN - return NULL; -#else - pixman_format = PIXMAN_x1r5g5b5; -#endif - break; - - default: - return NULL; - } - - if (!(flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) { - data += stride * (height - 1); - stride = -stride; - } - - return pixman_image_create_bits (pixman_format, - width, - height, - (uint32_t *)data, - stride); -} - -#ifdef WORDS_BIGENDIAN -#define UINT16_FROM_LE(x) SPICE_BYTESWAP16(x) -#define UINT32_FROM_LE(x) SPICE_BYTESWAP32(x) -#else -#define UINT16_FROM_LE(x) (x) -#define UINT32_FROM_LE(x) (x) -#endif - -static inline uint32_t rgb_16_555_to_32(uint16_t color) -{ - uint32_t ret; - - ret = ((color & 0x001f) << 3) | ((color & 0x001c) >> 2); - ret |= ((color & 0x03e0) << 6) | ((color & 0x0380) << 1); - ret |= ((color & 0x7c00) << 9) | ((color & 0x7000) << 4); - - return ret; -} - -static inline uint16_t rgb_32_to_16_555(uint32_t color) -{ - return - (((color) >> 3) & 0x001f) | - (((color) >> 6) & 0x03e0) | - (((color) >> 9) & 0x7c00); -} - - -static void bitmap_32_to_32(uint8_t* dest, int dest_stride, - uint8_t* src, int src_stride, - int width, uint8_t* end) -{ -#ifdef WORDS_BIGENDIAN - for (; src != end; src += src_stride, dest += dest_stride) { - uint32_t* src_line = (uint32_t *)src; - uint32_t* src_line_end = src_line + width; - uint32_t* dest_line = (uint32_t *)dest; - - for (; src_line < src_line_end; ++dest_line, ++src_line) { - *dest_line = UINT32_FROM_LE(*src_line); - } - } -#else - for (; src != end; src += src_stride, dest += dest_stride) { - memcpy(dest, src, width * 4); - } -#endif -} - -static void bitmap_24_to_32(uint8_t* dest, int dest_stride, - uint8_t* src, int src_stride, - int width, uint8_t* end) -{ - for (; src != end; src += src_stride, dest += dest_stride) { - uint8_t* src_line = src; - uint8_t* src_line_end = src_line + width * 3; - uint32_t* dest_line = (uint32_t *)dest; - - for (; src_line < src_line_end; ++dest_line) { - uint32_t r, g, b; - b = *(src_line++); - g = *(src_line++); - r = *(src_line++); - *dest_line = (r << 16) | (g << 8) | (b); - } - } -} - -static void bitmap_16_to_16_555(uint8_t* dest, int dest_stride, - uint8_t* src, int src_stride, - int width, uint8_t* end) -{ -#ifdef WORDS_BIGENDIAN - for (; src != end; src += src_stride, dest += dest_stride) { - uint16_t* src_line = (uint16_t *)src; - uint16_t* src_line_end = src_line + width; - uint16_t* dest_line = (uint16_t *)dest; - - for (; src_line < src_line_end; ++dest_line, ++src_line) { - *dest_line = UINT16_FROM_LE(*src_line); - } - } -#else - for (; src != end; src += src_stride, dest += dest_stride) { - memcpy(dest, src, width * 2); - } -#endif -} - -static void bitmap_8_32_to_32(uint8_t *dest, int dest_stride, - uint8_t *src, int src_stride, - int width, uint8_t *end, - SpicePalette *palette) -{ - uint32_t local_ents[256]; - uint32_t *ents; - int n_ents; -#ifdef WORDS_BIGENDIAN - int i; -#endif - - if (!palette) { - PANIC("No palette"); - return; - } - - n_ents = MIN(palette->num_ents, 256); - ents = palette->ents; - - if (n_ents < 255 -#ifdef WORDS_BIGENDIAN - || TRUE -#endif - ) { - memcpy(local_ents, ents, n_ents*4); - ents = local_ents; - -#ifdef WORDS_BIGENDIAN - for (i = 0; i < n_ents; i++) { - ents[i] = UINT32_FROM_LE(ents[i]); - } -#endif - } - - for (; src != end; src += src_stride, dest += dest_stride) { - uint32_t *dest_line = (uint32_t*)dest; - uint8_t *src_line = src; - uint8_t *src_line_end = src_line + width; - - while (src_line < src_line_end) { - *(dest_line++) = ents[*(src_line++)]; - } - } -} - -static void bitmap_8_16_to_16_555(uint8_t *dest, int dest_stride, - uint8_t *src, int src_stride, - int width, uint8_t *end, - SpicePalette *palette) -{ - uint32_t local_ents[256]; - uint32_t *ents; - int n_ents; -#ifdef WORDS_BIGENDIAN - int i; -#endif - - if (!palette) { - PANIC("No palette"); - return; - } - - n_ents = MIN(palette->num_ents, 256); - ents = palette->ents; - - if (n_ents < 255 -#ifdef WORDS_BIGENDIAN - || TRUE -#endif - ) { - memcpy(local_ents, ents, n_ents*4); - ents = local_ents; - -#ifdef WORDS_BIGENDIAN - for (i = 0; i < n_ents; i++) { - ents[i] = UINT32_FROM_LE(ents[i]); - } -#endif - } - - for (; src != end; src += src_stride, dest += dest_stride) { - uint16_t *dest_line = (uint16_t*)dest; - uint8_t *src_line = src; - uint8_t *src_line_end = src_line + width; - - while (src_line < src_line_end) { - *(dest_line++) = ents[*(src_line++)]; - } - } -} - -static void bitmap_4be_32_to_32(uint8_t* dest, int dest_stride, - uint8_t* src, int src_stride, - int width, uint8_t* end, - SpicePalette *palette) -{ - uint32_t local_ents[16]; - uint32_t *ents; - int n_ents; -#ifdef WORDS_BIGENDIAN - int i; -#endif - - if (!palette) { - PANIC("No palette"); - return; - } - - n_ents = MIN(palette->num_ents, 16); - ents = palette->ents; - - if (n_ents < 16 -#ifdef WORDS_BIGENDIAN - || TRUE -#endif - ) { - memcpy(local_ents, ents, n_ents*4); - ents = local_ents; - -#ifdef WORDS_BIGENDIAN - for (i = 0; i < n_ents; i++) { - ents[i] = UINT32_FROM_LE(ents[i]); - } -#endif - } - - for (; src != end; src += src_stride, dest += dest_stride) { - uint32_t *dest_line = (uint32_t *)dest; - uint8_t *row = src; - int i; - - for (i = 0; i < (width >> 1); i++) { - *(dest_line++) = ents[(*row >> 4) & 0x0f]; - *(dest_line++) = ents[*(row++) & 0x0f]; - } - if (width & 1) { - *(dest_line) = ents[(*row >> 4) & 0x0f]; - } - } -} - -static void bitmap_4be_16_to_16_555(uint8_t* dest, int dest_stride, - uint8_t* src, int src_stride, - int width, uint8_t* end, - SpicePalette *palette) -{ - uint32_t local_ents[16]; - uint32_t *ents; - int n_ents; -#ifdef WORDS_BIGENDIAN - int i; -#endif - - if (!palette) { - PANIC("No palette"); - return; - } - - n_ents = MIN(palette->num_ents, 16); - ents = palette->ents; - - if (n_ents < 16 -#ifdef WORDS_BIGENDIAN - || TRUE -#endif - ) { - memcpy(local_ents, ents, n_ents*4); - ents = local_ents; - -#ifdef WORDS_BIGENDIAN - for (i = 0; i < n_ents; i++) { - ents[i] = UINT32_FROM_LE(ents[i]); - } -#endif - } - - for (; src != end; src += src_stride, dest += dest_stride) { - uint16_t *dest_line = (uint16_t *)dest; - uint8_t *row = src; - int i; - - for (i = 0; i < (width >> 1); i++) { - *(dest_line++) = ents[(*row >> 4) & 0x0f]; - *(dest_line++) = ents[*(row++) & 0x0f]; - } - if (width & 1) { - *(dest_line) = ents[(*row >> 4) & 0x0f]; - } - } -} - -static inline int test_bit_be(void* addr, int bit) -{ - return !!(((uint8_t*)addr)[bit >> 3] & (0x80 >> (bit & 0x07))); -} - -static void bitmap_1be_32_to_32(uint8_t* dest, int dest_stride, - uint8_t* src, int src_stride, - int width, uint8_t* end, - SpicePalette *palette) -{ - uint32_t fore_color; - uint32_t back_color; - - ASSERT(palette != NULL); - - if (!palette) { - return; - } - - fore_color = UINT32_FROM_LE(palette->ents[1]); - back_color = UINT32_FROM_LE(palette->ents[0]); - - for (; src != end; src += src_stride, dest += dest_stride) { - uint32_t* dest_line = (uint32_t*)dest; - int i; - - for (i = 0; i < width; i++) { - if (test_bit_be(src, i)) { - *(dest_line++) = fore_color; - } else { - *(dest_line++) = back_color; - } - } - } -} - - -static void bitmap_1be_16_to_16_555(uint8_t* dest, int dest_stride, - uint8_t* src, int src_stride, - int width, uint8_t* end, - SpicePalette *palette) -{ - uint16_t fore_color; - uint16_t back_color; - - ASSERT(palette != NULL); - - if (!palette) { - return; - } - - fore_color = (uint16_t) UINT32_FROM_LE(palette->ents[1]); - back_color = (uint16_t) UINT32_FROM_LE(palette->ents[0]); - - for (; src != end; src += src_stride, dest += dest_stride) { - uint16_t* dest_line = (uint16_t*)dest; - int i; - - for (i = 0; i < width; i++) { - if (test_bit_be(src, i)) { - *(dest_line++) = fore_color; - } else { - *(dest_line++) = back_color; - } - } - } -} - -#ifdef NOT_USED_ATM - -static void bitmap_16_to_32(uint8_t* dest, int dest_stride, - uint8_t* src, int src_stride, - int width, uint8_t* end) -{ - for (; src != end; src += src_stride, dest += dest_stride) { - uint16_t* src_line = (uint16_t*)src; - uint16_t* src_line_end = src_line + width; - uint32_t* dest_line = (uint32_t*)dest; - - for (; src_line < src_line_end; ++dest_line, src_line++) { - *dest_line = rgb_16_555_to_32(UINT16_FROM_LE(*src_line)); - } - } -} - -static void bitmap_32_to_16_555(uint8_t* dest, int dest_stride, - uint8_t* src, int src_stride, - int width, uint8_t* end) -{ - for (; src != end; src += src_stride, dest += dest_stride) { - uint32_t* src_line = (uint32_t *)src; - uint32_t* src_line_end = src_line + width; - uint16_t* dest_line = (uint16_t *)dest; - - for (; src_line < src_line_end; ++dest_line, ++src_line) { - *dest_line = rgb_32_to_16_555(UINT16_FROM_LE(*src_line)); - } - } -} - - -static void bitmap_24_to_16_555(uint8_t* dest, int dest_stride, - uint8_t* src, int src_stride, - int width, uint8_t* end) -{ - for (; src != end; src += src_stride, dest += dest_stride) { - uint8_t* src_line = src; - uint8_t* src_line_end = src_line + width * 3; - uint16_t* dest_line = (uint16_t *)dest; - - for (; src_line < src_line_end; ++dest_line) { - uint8_t r, g, b; - b = *(src_line++); - g = *(src_line++); - r = *(src_line++); - *dest_line = rgb_32_to_16_555(r << 24 | g << 16 | b); - } - } -} - -#endif - -/* This assumes that the dest, if set is the same format as - spice_bitmap_format_to_pixman would have picked */ -pixman_image_t *spice_bitmap_to_pixman(pixman_image_t *dest_image, - int src_format, - int flags, - int width, - int height, - uint8_t *src, - int src_stride, - uint32_t palette_surface_format, - SpicePalette *palette) -{ - uint8_t* dest; - int dest_stride; - uint8_t* end; - - if (dest_image == NULL) { - pixman_format_code_t dest_format; - - dest_format = spice_bitmap_format_to_pixman(src_format, - palette_surface_format); - dest_image = pixman_image_create_bits (dest_format, - width, height, - NULL, 0); - } - - dest = (uint8_t *)pixman_image_get_data(dest_image); - dest_stride = pixman_image_get_stride(dest_image); - if (!(flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) { - ASSERT(height > 0); - dest += dest_stride * (height - 1); - dest_stride = -dest_stride; - } - end = src + (height * src_stride); - - switch (src_format) { - case SPICE_BITMAP_FMT_32BIT: - case SPICE_BITMAP_FMT_RGBA: - bitmap_32_to_32(dest, dest_stride, src, src_stride, width, end); - break; - case SPICE_BITMAP_FMT_24BIT: - bitmap_24_to_32(dest, dest_stride, src, src_stride, width, end); - break; - case SPICE_BITMAP_FMT_16BIT: - bitmap_16_to_16_555(dest, dest_stride, src, src_stride, width, end); - break; - case SPICE_BITMAP_FMT_8BIT: - if (palette_surface_format == SPICE_SURFACE_FMT_32_ARGB || - palette_surface_format == SPICE_SURFACE_FMT_32_xRGB) { - bitmap_8_32_to_32(dest, dest_stride, src, src_stride, width, end, palette); - } else if (palette_surface_format == SPICE_SURFACE_FMT_16_555) { - bitmap_8_16_to_16_555(dest, dest_stride, src, src_stride, width, end, palette); - } else { - PANIC("Unsupported palette format"); - } - break; - case SPICE_BITMAP_FMT_4BIT_BE: - if (palette_surface_format == SPICE_SURFACE_FMT_32_ARGB || - palette_surface_format == SPICE_SURFACE_FMT_32_xRGB) { - bitmap_4be_32_to_32(dest, dest_stride, src, src_stride, width, end, palette); - } else if (palette_surface_format == SPICE_SURFACE_FMT_16_555) { - bitmap_4be_16_to_16_555(dest, dest_stride, src, src_stride, width, end, palette); - } else { - PANIC("Unsupported palette format"); - } - break; - case SPICE_BITMAP_FMT_1BIT_BE: - if (palette_surface_format == SPICE_SURFACE_FMT_32_ARGB || - palette_surface_format == SPICE_SURFACE_FMT_32_xRGB) { - bitmap_1be_32_to_32(dest, dest_stride, src, src_stride, width, end, palette); - } else if (palette_surface_format == SPICE_SURFACE_FMT_16_555) { - bitmap_1be_16_to_16_555(dest, dest_stride, src, src_stride, width, end, palette); - } else { - PANIC("Unsupported palette format"); - } - break; - default: - PANIC("Unsupported bitmap format"); - break; - } - - return dest_image; -} - -static int pixman_format_compatible (pixman_format_code_t dest_format, - pixman_format_code_t src_format) -{ - if (dest_format == src_format) { - return TRUE; - } - - if (src_format == PIXMAN_a8r8g8b8 && - dest_format == PIXMAN_x8r8g8b8) { - /* This is the same, we just ignore the alphas */ - return TRUE; - } - - return FALSE; -} - -pixman_image_t *spice_bitmap_convert_to_pixman(pixman_format_code_t dest_format, - pixman_image_t *dest_image, - int src_format, - int flags, - int width, - int height, - uint8_t *src, - int src_stride, - uint32_t palette_surface_format, - SpicePalette *palette) -{ - pixman_image_t *src_image; - pixman_format_code_t native_format; - - if (dest_image == NULL) { - dest_image = pixman_image_create_bits (dest_format, - width, height, - NULL, 0); - } - - native_format = - spice_bitmap_format_to_pixman(src_format, palette_surface_format); - - if (pixman_format_compatible (dest_format, native_format)) { - return spice_bitmap_to_pixman(dest_image, - src_format, - flags, width,height, - src, src_stride, - palette_surface_format, palette); - } - - src_image = spice_bitmap_try_as_pixman(src_format, - flags, width,height, - src, src_stride); - - /* Can't convert directly, need a temporary copy - * Hopefully most bitmap reads should not need conversion (i.e. - * hit the spice_bitmap_to_pixmap case above) or work with the - * try_as_pixmap case, but in case some specific combination - * shows up here commonly we might want to add non-temporary - * conversion special casing here */ - if (src_image == NULL) { - src_image = spice_bitmap_to_pixman(NULL, - src_format, - flags, width,height, - src, src_stride, - palette_surface_format, palette); - } - - pixman_image_composite32 (PIXMAN_OP_SRC, - src_image, NULL, dest_image, - 0, 0, - 0, 0, - 0, 0, - width, height); - - pixman_image_unref (src_image); - - return dest_image; -} diff -Nru spice-gtk-0.9/common/pixman_utils.h spice-gtk-0.12/common/pixman_utils.h --- spice-gtk-0.9/common/pixman_utils.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/pixman_utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,128 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H__PIXMAN_UTILS -#define _H__PIXMAN_UTILS - -#include -#include -#define PIXMAN_DONT_DEFINE_STDINT -#include - -#include "draw.h" - -/* This lists all possible 2 argument binary raster ops. - * This enum has the same values as the X11 GXcopy type - * and same as the GL constants (GL_AND etc) if you - * or it with 0x1500. However it is not exactly the - * same as the win32 ROP2 type (they use another order). - */ -typedef enum { - SPICE_ROP_CLEAR, /* 0x0 0 */ - SPICE_ROP_AND, /* 0x1 src AND dst */ - SPICE_ROP_AND_REVERSE, /* 0x2 src AND NOT dst */ - SPICE_ROP_COPY, /* 0x3 src */ - SPICE_ROP_AND_INVERTED, /* 0x4 (NOT src) AND dst */ - SPICE_ROP_NOOP, /* 0x5 dst */ - SPICE_ROP_XOR, /* 0x6 src XOR dst */ - SPICE_ROP_OR, /* 0x7 src OR dst */ - SPICE_ROP_NOR, /* 0x8 (NOT src) AND (NOT dst) */ - SPICE_ROP_EQUIV, /* 0x9 (NOT src) XOR dst */ - SPICE_ROP_INVERT, /* 0xa NOT dst */ - SPICE_ROP_OR_REVERSE, /* 0xb src OR (NOT dst) */ - SPICE_ROP_COPY_INVERTED, /* 0xc NOT src */ - SPICE_ROP_OR_INVERTED, /* 0xd (NOT src) OR dst */ - SPICE_ROP_NAND, /* 0xe (NOT src) OR (NOT dst) */ - SPICE_ROP_SET /* 0xf 1 */ -} SpiceROP; - - -int spice_pixman_image_get_bpp(pixman_image_t *image); - -pixman_format_code_t spice_surface_format_to_pixman(uint32_t surface_format); -pixman_format_code_t spice_bitmap_format_to_pixman(int bitmap_format, - uint32_t palette_surface_format); -pixman_image_t *spice_bitmap_try_as_pixman(int src_format, int flags, - int width, int height, - uint8_t *data, int stride); -pixman_image_t *spice_bitmap_to_pixman(pixman_image_t *dest_image, - int src_format, int flags, - int width, int height, - uint8_t *src, int src_stride, - uint32_t palette_surface_format, - SpicePalette *palette); -pixman_image_t *spice_bitmap_convert_to_pixman(pixman_format_code_t dest_format, - pixman_image_t *dest_image, - int src_format, int flags, - int width, int height, - uint8_t *src, int src_stride, - uint32_t palette_surface_format, - SpicePalette *palette); - -void spice_pixman_region32_init_from_bitmap(pixman_region32_t *region, - uint32_t *data, - int width, int height, - int stride); -pixman_bool_t spice_pixman_region32_init_rects(pixman_region32_t *region, - const SpiceRect *rects, - int count); -void spice_pixman_fill_rect(pixman_image_t *dest, - int x, int y, - int w, int h, - uint32_t value); -void spice_pixman_fill_rect_rop(pixman_image_t *dest, - int x, int y, - int w, int h, - uint32_t value, - SpiceROP rop); -void spice_pixman_tile_rect(pixman_image_t *dest, - int x, int y, - int w, int h, - pixman_image_t *tile, - int offset_x, - int offset_y); -void spice_pixman_tile_rect_rop(pixman_image_t *dest, - int x, int y, - int w, int h, - pixman_image_t *tile, - int offset_x, - int offset_y, - SpiceROP rop); -void spice_pixman_blit(pixman_image_t *dest, - pixman_image_t *src, - int src_x, int src_y, - int dest_x, int dest_y, - int w, int h); -void spice_pixman_blit_rop(pixman_image_t *dest, - pixman_image_t *src, - int src_x, int src_y, - int dest_x, int dest_y, - int w, int h, - SpiceROP rop); -void spice_pixman_blit_colorkey(pixman_image_t *dest, - pixman_image_t *src, - int src_x, int src_y, - int dest_x, int dest_y, - int width, int height, - uint32_t transparent_color); -void spice_pixman_copy_rect(pixman_image_t *image, - int src_x, int src_y, - int w, int h, - int dest_x, int dest_y); - -#endif /* _H__PIXMAN_UTILS */ diff -Nru spice-gtk-0.9/common/quic.c spice-gtk-0.12/common/quic.c --- spice-gtk-0.9/common/quic.c 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/quic.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1706 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -// Red Hat image compression based on SFALIC by Roman Starosolski -// http://sun.iinf.polsl.gliwice.pl/~rstaros/sfalic/index.html - -#include "quic.h" -#include - -//#define DEBUG - -#define RLE -#define RLE_STAT -#define PRED_1 -//#define RLE_PRED_1 -#define RLE_PRED_2 -//#define RLE_PRED_3 -#define QUIC_RGB - -#define QUIC_MAGIC (*(uint32_t *)"QUIC") -#define QUIC_VERSION_MAJOR 0U -#define QUIC_VERSION_MINOR 1U -#define QUIC_VERSION ((QUIC_VERSION_MAJOR << 16) | (QUIC_VERSION_MAJOR & 0xffff)) - -#ifdef DEBUG - -#define ASSERT(usr, x) \ - if (!(x)) (usr)->error(usr, "%s: ASSERT %s failed\n", __FUNCTION__, #x); - -#else - -#define ASSERT(usr, x) - -#endif - -typedef uint8_t BYTE; - -/* maximum number of codes in family */ -#define MAXNUMCODES 8 - -/* model evolution, warning: only 1,3 and 5 allowed */ -#define DEFevol 3 -#define MINevol 0 -#define MAXevol 5 - -/* starting wait mask index */ -#define DEFwmistart 0 -#define MINwmistart 0 - -/* codeword length limit */ -#define DEFmaxclen 26 - -/* target wait mask index */ -#define DEFwmimax 6 - -/* number of symbols to encode before increasing wait mask index */ -#define DEFwminext 2048 -#define MINwminext 1 -#define MAXwminext 100000000 - -typedef struct QuicFamily { - unsigned int nGRcodewords[MAXNUMCODES]; /* indexed by code number, contains number of - unmodified GR codewords in the code */ - unsigned int notGRcwlen[MAXNUMCODES]; /* indexed by code number, contains codeword - length of the not-GR codeword */ - unsigned int notGRprefixmask[MAXNUMCODES]; /* indexed by code number, contains mask to - determine if the codeword is GR or not-GR */ - unsigned int notGRsuffixlen[MAXNUMCODES]; /* indexed by code number, contains suffix - length of the not-GR codeword */ - - /* array for translating distribution U to L for depths up to 8 bpp, - initialized by decorelateinit() */ - BYTE xlatU2L[256]; - - /* array for translating distribution L to U for depths up to 8 bpp, - initialized by corelateinit() */ - unsigned int xlatL2U[256]; -} QuicFamily; - -static QuicFamily family_8bpc; -static QuicFamily family_5bpc; - -typedef unsigned COUNTER; /* counter in the array of counters in bucket of the data model */ - -typedef struct s_bucket { - COUNTER *pcounters; /* pointer to array of counters */ - unsigned int bestcode; /* best code so far */ -} s_bucket; - -typedef struct Encoder Encoder; - -typedef struct CommonState { - Encoder *encoder; - - unsigned int waitcnt; - unsigned int tabrand_seed; - unsigned int wm_trigger; - unsigned int wmidx; - unsigned int wmileft; - -#ifdef RLE_STAT - int melcstate; /* index to the state array */ - - int melclen; /* contents of the state array location - indexed by melcstate: the "expected" - run length is 2^melclen, shorter runs are - encoded by a 1 followed by the run length - in binary representation, wit a fixed length - of melclen bits */ - - unsigned long melcorder; /* 2^ melclen */ -#endif -} CommonState; - - -#define MAX_CHANNELS 4 - -typedef struct FamilyStat { - s_bucket **buckets_ptrs; - s_bucket *buckets_buf; - COUNTER *counters; -} FamilyStat; - -typedef struct Channel { - Encoder *encoder; - - int correlate_row_width; - BYTE *correlate_row; - - s_bucket **_buckets_ptrs; - - FamilyStat family_stat_8bpc; - FamilyStat family_stat_5bpc; - - CommonState state; -} Channel; - -struct Encoder { - QuicUsrContext *usr; - QuicImageType type; - unsigned int width; - unsigned int height; - unsigned int num_channels; - - unsigned int n_buckets_8bpc; - unsigned int n_buckets_5bpc; - - unsigned int io_available_bits; - uint32_t io_word; - uint32_t io_next_word; - uint32_t *io_now; - uint32_t *io_end; - uint32_t io_words_count; - - int rows_completed; - - Channel channels[MAX_CHANNELS]; - - CommonState rgb_state; -}; - -/* target wait mask index */ -static int wmimax = DEFwmimax; - -/* number of symbols to encode before increasing wait mask index */ -static int wminext = DEFwminext; - -/* model evolution mode */ -static int evol = DEFevol; - -/* bppmask[i] contains i ones as lsb-s */ -static const unsigned long int bppmask[33] = { - 0x00000000, /* [0] */ - 0x00000001, 0x00000003, 0x00000007, 0x0000000f, - 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff, - 0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff, - 0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff, - 0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff, - 0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff, - 0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff, - 0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff /* [32] */ -}; - -static const unsigned int bitat[32] = { - 0x00000001, 0x00000002, 0x00000004, 0x00000008, - 0x00000010, 0x00000020, 0x00000040, 0x00000080, - 0x00000100, 0x00000200, 0x00000400, 0x00000800, - 0x00001000, 0x00002000, 0x00004000, 0x00008000, - 0x00010000, 0x00020000, 0x00040000, 0x00080000, - 0x00100000, 0x00200000, 0x00400000, 0x00800000, - 0x01000000, 0x02000000, 0x04000000, 0x08000000, - 0x10000000, 0x20000000, 0x40000000, 0x80000000 /* [31]*/ -}; - - -#define TABRAND_TABSIZE 256 -#define TABRAND_SEEDMASK 0x0ff - -static const unsigned int tabrand_chaos[TABRAND_TABSIZE] = { - 0x02c57542, 0x35427717, 0x2f5a2153, 0x9244f155, 0x7bd26d07, 0x354c6052, 0x57329b28, 0x2993868e, - 0x6cd8808c, 0x147b46e0, 0x99db66af, 0xe32b4cac, 0x1b671264, 0x9d433486, 0x62a4c192, 0x06089a4b, - 0x9e3dce44, 0xdaabee13, 0x222425ea, 0xa46f331d, 0xcd589250, 0x8bb81d7f, 0xc8b736b9, 0x35948d33, - 0xd7ac7fd0, 0x5fbe2803, 0x2cfbc105, 0x013dbc4e, 0x7a37820f, 0x39f88e9e, 0xedd58794, 0xc5076689, - 0xfcada5a4, 0x64c2f46d, 0xb3ba3243, 0x8974b4f9, 0x5a05aebd, 0x20afcd00, 0x39e2b008, 0x88a18a45, - 0x600bde29, 0xf3971ace, 0xf37b0a6b, 0x7041495b, 0x70b707ab, 0x06beffbb, 0x4206051f, 0xe13c4ee3, - 0xc1a78327, 0x91aa067c, 0x8295f72a, 0x732917a6, 0x1d871b4d, 0x4048f136, 0xf1840e7e, 0x6a6048c1, - 0x696cb71a, 0x7ff501c3, 0x0fc6310b, 0x57e0f83d, 0x8cc26e74, 0x11a525a2, 0x946934c7, 0x7cd888f0, - 0x8f9d8604, 0x4f86e73b, 0x04520316, 0xdeeea20c, 0xf1def496, 0x67687288, 0xf540c5b2, 0x22401484, - 0x3478658a, 0xc2385746, 0x01979c2c, 0x5dad73c8, 0x0321f58b, 0xf0fedbee, 0x92826ddf, 0x284bec73, - 0x5b1a1975, 0x03df1e11, 0x20963e01, 0xa17cf12b, 0x740d776e, 0xa7a6bf3c, 0x01b5cce4, 0x1118aa76, - 0xfc6fac0a, 0xce927e9b, 0x00bf2567, 0x806f216c, 0xbca69056, 0x795bd3e9, 0xc9dc4557, 0x8929b6c2, - 0x789d52ec, 0x3f3fbf40, 0xb9197368, 0xa38c15b5, 0xc3b44fa8, 0xca8333b0, 0xb7e8d590, 0xbe807feb, - 0xbf5f8360, 0xd99e2f5c, 0x372928e1, 0x7c757c4c, 0x0db5b154, 0xc01ede02, 0x1fc86e78, 0x1f3985be, - 0xb4805c77, 0x00c880fa, 0x974c1b12, 0x35ab0214, 0xb2dc840d, 0x5b00ae37, 0xd313b026, 0xb260969d, - 0x7f4c8879, 0x1734c4d3, 0x49068631, 0xb9f6a021, 0x6b863e6f, 0xcee5debf, 0x29f8c9fb, 0x53dd6880, - 0x72b61223, 0x1f67a9fd, 0x0a0f6993, 0x13e59119, 0x11cca12e, 0xfe6b6766, 0x16b6effc, 0x97918fc4, - 0xc2b8a563, 0x94f2f741, 0x0bfa8c9a, 0xd1537ae8, 0xc1da349c, 0x873c60ca, 0x95005b85, 0x9b5c080e, - 0xbc8abbd9, 0xe1eab1d2, 0x6dac9070, 0x4ea9ebf1, 0xe0cf30d4, 0x1ef5bd7b, 0xd161043e, 0x5d2fa2e2, - 0xff5d3cae, 0x86ed9f87, 0x2aa1daa1, 0xbd731a34, 0x9e8f4b22, 0xb1c2c67a, 0xc21758c9, 0xa182215d, - 0xccb01948, 0x8d168df7, 0x04238cfe, 0x368c3dbc, 0x0aeadca5, 0xbad21c24, 0x0a71fee5, 0x9fc5d872, - 0x54c152c6, 0xfc329483, 0x6783384a, 0xeddb3e1c, 0x65f90e30, 0x884ad098, 0xce81675a, 0x4b372f7d, - 0x68bf9a39, 0x43445f1e, 0x40f8d8cb, 0x90d5acb6, 0x4cd07282, 0x349eeb06, 0x0c9d5332, 0x520b24ef, - 0x80020447, 0x67976491, 0x2f931ca3, 0xfe9b0535, 0xfcd30220, 0x61a9e6cc, 0xa487d8d7, 0x3f7c5dd1, - 0x7d0127c5, 0x48f51d15, 0x60dea871, 0xc9a91cb7, 0x58b53bb3, 0x9d5e0b2d, 0x624a78b4, 0x30dbee1b, - 0x9bdf22e7, 0x1df5c299, 0x2d5643a7, 0xf4dd35ff, 0x03ca8fd6, 0x53b47ed8, 0x6f2c19aa, 0xfeb0c1f4, - 0x49e54438, 0x2f2577e6, 0xbf876969, 0x72440ea9, 0xfa0bafb8, 0x74f5b3a0, 0x7dd357cd, 0x89ce1358, - 0x6ef2cdda, 0x1e7767f3, 0xa6be9fdb, 0x4f5f88f8, 0xba994a3a, 0x08ca6b65, 0xe0893818, 0x9e00a16a, - 0xf42bfc8f, 0x9972eedc, 0x749c8b51, 0x32c05f5e, 0xd706805f, 0x6bfbb7cf, 0xd9210a10, 0x31a1db97, - 0x923a9559, 0x37a7a1f6, 0x059f8861, 0xca493e62, 0x65157e81, 0x8f6467dd, 0xab85ff9f, 0x9331aff2, - 0x8616b9f5, 0xedbd5695, 0xee7e29b1, 0x313ac44f, 0xb903112f, 0x432ef649, 0xdc0a36c0, 0x61cf2bba, - 0x81474925, 0xa8b6c7ad, 0xee5931de, 0xb2f8158d, 0x59fb7409, 0x2e3dfaed, 0x9af25a3f, 0xe1fed4d5, -}; - -static unsigned int stabrand() -{ - //ASSERT( !(TABRAND_SEEDMASK & TABRAND_TABSIZE)); - //ASSERT( TABRAND_SEEDMASK + 1 == TABRAND_TABSIZE ); - - return TABRAND_SEEDMASK; -} - -static unsigned int tabrand(unsigned int *tabrand_seed) -{ - return tabrand_chaos[++*tabrand_seed & TABRAND_SEEDMASK]; -} - -static const unsigned short besttrigtab[3][11] = { /* array of wm_trigger for waitmask and evol, - used by set_wm_trigger() */ - /* 1 */ { 550, 900, 800, 700, 500, 350, 300, 200, 180, 180, 160}, - /* 3 */ { 110, 550, 900, 800, 550, 400, 350, 250, 140, 160, 140}, - /* 5 */ { 100, 120, 550, 900, 700, 500, 400, 300, 220, 250, 160} -}; - -/* set wm_trigger knowing waitmask (param) and evol (glob)*/ -static void set_wm_trigger(CommonState *state) -{ - unsigned int wm = state->wmidx; - if (wm > 10) { - wm = 10; - } - - ASSERT(state->encoder->usr, evol < 6); - - state->wm_trigger = besttrigtab[evol / 2][wm]; - - ASSERT(state->encoder->usr, state->wm_trigger <= 2000); - ASSERT(state->encoder->usr, state->wm_trigger >= 1); -} - -static int ceil_log_2(int val) /* ceil(log_2(val)) */ -{ - int result; - - //ASSERT(val>0); - - if (val == 1) { - return 0; - } - - result = 1; - val -= 1; - while (val >>= 1) { - result++; - } - - return result; -} - -/* number of leading zeroes in the byte, used by cntlzeroes(uint)*/ -static const BYTE lzeroes[256] = { - 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* count leading zeroes */ -static unsigned int cnt_l_zeroes(const unsigned int bits) -{ - if (bits & 0xff800000) { - return lzeroes[bits >> 24]; - } else if (bits & 0xffff8000) { - return 8 + lzeroes[(bits >> 16) & 0x000000ff]; - } else if (bits & 0xffffff80) { - return 16 + lzeroes[(bits >> 8) & 0x000000ff]; - } else { - return 24 + lzeroes[bits & 0x000000ff]; - } -} - -#define QUIC_FAMILY_8BPC -#include "quic_family_tmpl.c" - -#ifdef QUIC_RGB -#define QUIC_FAMILY_5BPC -#include "quic_family_tmpl.c" -#endif - -static void decorelate_init(QuicFamily *family, int bpc) -{ - const unsigned int pixelbitmask = bppmask[bpc]; - const unsigned int pixelbitmaskshr = pixelbitmask >> 1; - unsigned int s; - - //ASSERT(bpc <= 8); - - for (s = 0; s <= pixelbitmask; s++) { - if (s <= pixelbitmaskshr) { - family->xlatU2L[s] = s << 1; - } else { - family->xlatU2L[s] = ((pixelbitmask - s) << 1) + 1; - } - } -} - -static void corelate_init(QuicFamily *family, int bpc) -{ - const unsigned long int pixelbitmask = bppmask[bpc]; - unsigned long int s; - - //ASSERT(bpc <= 8); - - for (s = 0; s <= pixelbitmask; s++) { - if (s & 0x01) { - family->xlatL2U[s] = pixelbitmask - (s >> 1); - } else { - family->xlatL2U[s] = (s >> 1); - } - } -} - -static void family_init(QuicFamily *family, int bpc, int limit) -{ - int l; - - for (l = 0; l < bpc; l++) { /* fill arrays indexed by code number */ - int altprefixlen, altcodewords; - - altprefixlen = limit - bpc; - if (altprefixlen > (int)(bppmask[bpc - l])) { - altprefixlen = bppmask[bpc - l]; - } - - altcodewords = bppmask[bpc] + 1 - (altprefixlen << l); - - family->nGRcodewords[l] = (altprefixlen << l); - family->notGRcwlen[l] = altprefixlen + ceil_log_2(altcodewords); - family->notGRprefixmask[l] = bppmask[32 - altprefixlen]; /* needed for decoding only */ - family->notGRsuffixlen[l] = ceil_log_2(altcodewords); /* needed for decoding only */ - } - - decorelate_init(family, bpc); - corelate_init(family, bpc); -} - -static void more_io_words(Encoder *encoder) -{ - uint32_t *io_ptr; - int num_io_words = encoder->usr->more_space(encoder->usr, &io_ptr, encoder->rows_completed); - if (num_io_words <= 0) { - encoder->usr->error(encoder->usr, "%s: no more words\n", __FUNCTION__); - } - ASSERT(encoder->usr, io_ptr); - encoder->io_words_count += num_io_words; - encoder->io_now = io_ptr; - encoder->io_end = encoder->io_now + num_io_words; -} - -static void __write_io_word(Encoder *encoder) -{ - more_io_words(encoder); - *(encoder->io_now++) = encoder->io_word; -} - -static void (*__write_io_word_ptr)(Encoder *encoder) = __write_io_word; - -static INLINE void write_io_word(Encoder *encoder) -{ - if (encoder->io_now == encoder->io_end) { - __write_io_word_ptr(encoder); //disable inline optimizations - return; - } - *(encoder->io_now++) = encoder->io_word; -} - -static INLINE void encode(Encoder *encoder, unsigned int word, unsigned int len) -{ - int delta; - - ASSERT(encoder->usr, len > 0 && len < 32); - ASSERT(encoder->usr, !(word & ~bppmask[len])); - if ((delta = ((int)encoder->io_available_bits - len)) >= 0) { - encoder->io_available_bits = delta; - encoder->io_word |= word << encoder->io_available_bits; - return; - } - delta = -delta; - encoder->io_word |= word >> delta; - write_io_word(encoder); - encoder->io_available_bits = 32 - delta; - encoder->io_word = word << encoder->io_available_bits; - - ASSERT(encoder->usr, encoder->io_available_bits < 32); - ASSERT(encoder->usr, (encoder->io_word & bppmask[encoder->io_available_bits]) == 0); -} - -static INLINE void encode_32(Encoder *encoder, unsigned int word) -{ - encode(encoder, word >> 16, 16); - encode(encoder, word & 0x0000ffff, 16); -} - -static INLINE void flush(Encoder *encoder) -{ - if (encoder->io_available_bits > 0 && encoder->io_available_bits != 32) { - encode(encoder, 0, encoder->io_available_bits); - } - encode_32(encoder, 0); - encode(encoder, 0, 1); -} - -static void __read_io_word(Encoder *encoder) -{ - more_io_words(encoder); - encoder->io_next_word = *(encoder->io_now++); -} - -static void (*__read_io_word_ptr)(Encoder *encoder) = __read_io_word; - - -static INLINE void read_io_word(Encoder *encoder) -{ - if (encoder->io_now == encoder->io_end) { - __read_io_word_ptr(encoder); //disable inline optimizations - return; - } - ASSERT(encoder->usr, encoder->io_now < encoder->io_end); - encoder->io_next_word = *(encoder->io_now++); -} - -static INLINE void decode_eatbits(Encoder *encoder, int len) -{ - int delta; - - ASSERT(encoder->usr, len > 0 && len < 32); - encoder->io_word <<= len; - - if ((delta = ((int)encoder->io_available_bits - len)) >= 0) { - encoder->io_available_bits = delta; - encoder->io_word |= encoder->io_next_word >> encoder->io_available_bits; - return; - } - - delta = -delta; - encoder->io_word |= encoder->io_next_word << delta; - read_io_word(encoder); - encoder->io_available_bits = 32 - delta; - encoder->io_word |= (encoder->io_next_word >> encoder->io_available_bits); -} - -static INLINE void decode_eat32bits(Encoder *encoder) -{ - decode_eatbits(encoder, 16); - decode_eatbits(encoder, 16); -} - -#ifdef RLE - -#ifdef RLE_STAT - -static INLINE void encode_ones(Encoder *encoder, unsigned int n) -{ - unsigned int count; - - for (count = n >> 5; count; count--) { - encode(encoder, ~0U, 32); - } - - if ((n &= 0x1f)) { - encode(encoder, (1U << n) - 1, n); - } -} - -#define MELCSTATES 32 /* number of melcode states */ - -static int zeroLUT[256]; /* table to find out number of leading zeros */ - -static int J[MELCSTATES] = { - 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, - 7, 8, 9, 10, 11, 12, 13, 14, 15 -}; - -/* creates the bit counting look-up table. */ -static void init_zeroLUT() -{ - int i, j, k, l; - - j = k = 1; - l = 8; - for (i = 0; i < 256; ++i) { - zeroLUT[i] = l; - --k; - if (k == 0) { - k = j; - --l; - j *= 2; - } - } -} - -static void encoder_init_rle(CommonState *state) -{ - state->melcstate = 0; - state->melclen = J[0]; - state->melcorder = 1 << state->melclen; -} - -#ifdef QUIC_RGB - -static void encode_run(Encoder *encoder, unsigned int runlen) //todo: try use end of line -{ - int hits = 0; - - while (runlen >= encoder->rgb_state.melcorder) { - hits++; - runlen -= encoder->rgb_state.melcorder; - if (encoder->rgb_state.melcstate < MELCSTATES) { - encoder->rgb_state.melclen = J[++encoder->rgb_state.melcstate]; - encoder->rgb_state.melcorder = (1L << encoder->rgb_state.melclen); - } - } - - /* send the required number of "hit" bits (one per occurrence - of a run of length melcorder). This number is never too big: - after 31 such "hit" bits, each "hit" would represent a run of 32K - pixels. - */ - encode_ones(encoder, hits); - - encode(encoder, runlen, encoder->rgb_state.melclen + 1); - - /* adjust melcoder parameters */ - if (encoder->rgb_state.melcstate) { - encoder->rgb_state.melclen = J[--encoder->rgb_state.melcstate]; - encoder->rgb_state.melcorder = (1L << encoder->rgb_state.melclen); - } -} - -#endif - -static void encode_channel_run(Encoder *encoder, Channel *channel, unsigned int runlen) -{ - //todo: try use end of line - int hits = 0; - - while (runlen >= channel->state.melcorder) { - hits++; - runlen -= channel->state.melcorder; - if (channel->state.melcstate < MELCSTATES) { - channel->state.melclen = J[++channel->state.melcstate]; - channel->state.melcorder = (1L << channel->state.melclen); - } - } - - /* send the required number of "hit" bits (one per occurrence - of a run of length melcorder). This number is never too big: - after 31 such "hit" bits, each "hit" would represent a run of 32K - pixels. - */ - encode_ones(encoder, hits); - - encode(encoder, runlen, channel->state.melclen + 1); - - /* adjust melcoder parameters */ - if (channel->state.melcstate) { - channel->state.melclen = J[--channel->state.melcstate]; - channel->state.melcorder = (1L << channel->state.melclen); - } -} - -/* decoding routine: reads bits from the input and returns a run length. */ -/* argument is the number of pixels left to end-of-line (bound on run length) */ - -#ifdef QUIC_RGB -static int decode_run(Encoder *encoder) -{ - int runlen = 0; - - do { - register int temp, hits; - temp = zeroLUT[(BYTE)(~(encoder->io_word >> 24))];/* number of leading ones in the - input stream, up to 8 */ - for (hits = 1; hits <= temp; hits++) { - runlen += encoder->rgb_state.melcorder; - - if (encoder->rgb_state.melcstate < MELCSTATES) { - encoder->rgb_state.melclen = J[++encoder->rgb_state.melcstate]; - encoder->rgb_state.melcorder = (1U << encoder->rgb_state.melclen); - } - } - if (temp != 8) { - decode_eatbits(encoder, temp + 1); /* consume the leading - 0 of the remainder encoding */ - break; - } - decode_eatbits(encoder, 8); - } while (1); - - /* read the length of the remainder */ - if (encoder->rgb_state.melclen) { - runlen += encoder->io_word >> (32 - encoder->rgb_state.melclen); - decode_eatbits(encoder, encoder->rgb_state.melclen); - } - - /* adjust melcoder parameters */ - if (encoder->rgb_state.melcstate) { - encoder->rgb_state.melclen = J[--encoder->rgb_state.melcstate]; - encoder->rgb_state.melcorder = (1U << encoder->rgb_state.melclen); - } - - return runlen; -} - -#endif - -static int decode_channel_run(Encoder *encoder, Channel *channel) -{ - int runlen = 0; - - do { - register int temp, hits; - temp = zeroLUT[(BYTE)(~(encoder->io_word >> 24))];/* number of leading ones in the - input stream, up to 8 */ - for (hits = 1; hits <= temp; hits++) { - runlen += channel->state.melcorder; - - if (channel->state.melcstate < MELCSTATES) { - channel->state.melclen = J[++channel->state.melcstate]; - channel->state.melcorder = (1U << channel->state.melclen); - } - } - if (temp != 8) { - decode_eatbits(encoder, temp + 1); /* consume the leading - 0 of the remainder encoding */ - break; - } - decode_eatbits(encoder, 8); - } while (1); - - /* read the length of the remainder */ - if (channel->state.melclen) { - runlen += encoder->io_word >> (32 - channel->state.melclen); - decode_eatbits(encoder, channel->state.melclen); - } - - /* adjust melcoder parameters */ - if (channel->state.melcstate) { - channel->state.melclen = J[--channel->state.melcstate]; - channel->state.melcorder = (1U << channel->state.melclen); - } - - return runlen; -} - -#else - -static INLINE int find_msb(int x) -{ - int r; - - __asm__("bsrl %1,%0\n\t" - "jnz 1f\n\t" - "movl $-1,%0\n" - "1:" : "=r" (r) : "rm" (x)); - return r + 1; -} - -static INLINE void encode_run(Encoder *encoder, unsigned int len) -{ - int odd = len & 1U; - int msb; - - len &= ~1U; - - while ((msb = find_msb(len))) { - len &= ~(1 << (msb - 1)); - ASSERT(encoder->usr, msb < 32); - encode(encoder, (1 << (msb)) - 1, msb); - encode(encoder, 0, 1); - } - - if (odd) { - encode(encoder, 2, 2); - } else { - encode(encoder, 0, 1); - } -} - -static INLINE unsigned int decode_run(Encoder *encoder) -{ - unsigned int len = 0; - int count; - - do { - count = 0; - while (encoder->io_word & (1U << 31)) { - decode_eatbits(encoder, 1); - count++; - ASSERT(encoder->usr, count < 32); - } - decode_eatbits(encoder, 1); - len += (1U << count) >> 1; - } while (count > 1); - - return len; -} - -#endif -#endif - -static INLINE void init_decode_io(Encoder *encoder) -{ - encoder->io_next_word = encoder->io_word = *(encoder->io_now++); - encoder->io_available_bits = 0; -} - -#ifdef __GNUC__ -#define ATTR_PACKED __attribute__ ((__packed__)) -#else -#define ATTR_PACKED -#pragma pack(push) -#pragma pack(1) -#endif - -typedef struct ATTR_PACKED one_byte_pixel_t { - BYTE a; -} one_byte_t; - -typedef struct ATTR_PACKED three_bytes_pixel_t { - BYTE a; - BYTE b; - BYTE c; -} three_bytes_t; - -typedef struct ATTR_PACKED four_bytes_pixel_t { - BYTE a; - BYTE b; - BYTE c; - BYTE d; -} four_bytes_t; - -typedef struct ATTR_PACKED rgb32_pixel_t { - BYTE b; - BYTE g; - BYTE r; - BYTE pad; -} rgb32_pixel_t; - -typedef struct ATTR_PACKED rgb24_pixel_t { - BYTE b; - BYTE g; - BYTE r; -} rgb24_pixel_t; - -typedef uint16_t rgb16_pixel_t; - -#ifndef __GNUC__ -#pragma pack(pop) -#endif - -#undef ATTR_PACKED - -#define ONE_BYTE -#include "quic_tmpl.c" - -#define FOUR_BYTE -#include "quic_tmpl.c" - -#ifdef QUIC_RGB - -#define QUIC_RGB32 -#include "quic_rgb_tmpl.c" - -#define QUIC_RGB24 -#include "quic_rgb_tmpl.c" - -#define QUIC_RGB16 -#include "quic_rgb_tmpl.c" - -#define QUIC_RGB16_TO_32 -#include "quic_rgb_tmpl.c" - -#else - -#define THREE_BYTE -#include "quic_tmpl.c" - -#endif - -static void fill_model_structures(Encoder *encoder, FamilyStat *family_stat, - unsigned int rep_first, unsigned int first_size, - unsigned int rep_next, unsigned int mul_size, - unsigned int levels, unsigned int ncounters, - unsigned int nbuckets, unsigned int n_buckets_ptrs) -{ - unsigned int - bsize, - bstart, - bend = 0, - repcntr, - bnumber; - - COUNTER * free_counter = family_stat->counters;/* first free location in the array of - counters */ - - bnumber = 0; - - repcntr = rep_first + 1; /* first bucket */ - bsize = first_size; - - do { /* others */ - if (bnumber) { - bstart = bend + 1; - } else { - bstart = 0; - } - - if (!--repcntr) { - repcntr = rep_next; - bsize *= mul_size; - } - - bend = bstart + bsize - 1; - if (bend + bsize >= levels) { - bend = levels - 1; - } - - family_stat->buckets_buf[bnumber].pcounters = free_counter; - free_counter += ncounters; - - ASSERT(encoder->usr, bstart < n_buckets_ptrs); - { - unsigned int i; - ASSERT(encoder->usr, bend < n_buckets_ptrs); - for (i = bstart; i <= bend; i++) { - family_stat->buckets_ptrs[i] = family_stat->buckets_buf + bnumber; - } - } - - bnumber++; - } while (bend < levels - 1); - - ASSERT(encoder->usr, free_counter - family_stat->counters == nbuckets * ncounters); -} - -static void find_model_params(Encoder *encoder, - const int bpc, - unsigned int *ncounters, - unsigned int *levels, - unsigned int *n_buckets_ptrs, - unsigned int *repfirst, - unsigned int *firstsize, - unsigned int *repnext, - unsigned int *mulsize, - unsigned int *nbuckets) -{ - unsigned int bsize; /* bucket size */ - unsigned int bstart, bend = 0; /* bucket start and end, range : 0 to levels-1*/ - unsigned int repcntr; /* helper */ - - ASSERT(encoder->usr, bpc <= 8 && bpc > 0); - - - *ncounters = 8; - - *levels = 0x1 << bpc; - - *n_buckets_ptrs = 0; /* ==0 means: not set yet */ - - switch (evol) { /* set repfirst firstsize repnext mulsize */ - case 1: /* buckets contain following numbers of contexts: 1 1 1 2 2 4 4 8 8 ... */ - *repfirst = 3; - *firstsize = 1; - *repnext = 2; - *mulsize = 2; - break; - case 3: /* 1 2 4 8 16 32 64 ... */ - *repfirst = 1; - *firstsize = 1; - *repnext = 1; - *mulsize = 2; - break; - case 5: /* 1 4 16 64 256 1024 4096 16384 65536 */ - *repfirst = 1; - *firstsize = 1; - *repnext = 1; - *mulsize = 4; - break; - case 0: /* obsolete */ - case 2: /* obsolete */ - case 4: /* obsolete */ - encoder->usr->error(encoder->usr, "findmodelparams(): evol value obsolete!!!\n"); - default: - encoder->usr->error(encoder->usr, "findmodelparams(): evol out of range!!!\n"); - } - - *nbuckets = 0; - repcntr = *repfirst + 1; /* first bucket */ - bsize = *firstsize; - - do { /* other buckets */ - if (nbuckets) { /* bucket start */ - bstart = bend + 1; - } else { - bstart = 0; - } - - if (!--repcntr) { /* bucket size */ - repcntr = *repnext; - bsize *= *mulsize; - } - - bend = bstart + bsize - 1; /* bucket end */ - if (bend + bsize >= *levels) { /* if following bucked was bigger than current one */ - bend = *levels - 1; /* concatenate them */ - } - - if (!*n_buckets_ptrs) { /* array size not set yet? */ - *n_buckets_ptrs = *levels; - #if 0 - if (bend == *levels - 1) { /* this bucket is last - all in the first array */ - *n_buckets_ptrs = *levels; - } else if (bsize >= 256) { /* this bucket is allowed to reside in the 2nd table */ - b_lo_ptrs = bstart; - assert(bstart); /* previous bucket exists */ - } - #endif - } - - (*nbuckets)++; - } while (bend < *levels - 1); -} - -static int init_model_structures(Encoder *encoder, FamilyStat *family_stat, - unsigned int rep_first, unsigned int first_size, - unsigned int rep_next, unsigned int mul_size, - unsigned int levels, unsigned int ncounters, - unsigned int n_buckets_ptrs, unsigned int n_buckets) -{ - family_stat->buckets_ptrs = (s_bucket **)encoder->usr->malloc(encoder->usr, - n_buckets_ptrs * - sizeof(s_bucket *)); - if (!family_stat->buckets_ptrs) { - return FALSE; - } - - family_stat->counters = (COUNTER *)encoder->usr->malloc(encoder->usr, - n_buckets * sizeof(COUNTER) * - MAXNUMCODES); - if (!family_stat->counters) { - goto error_1; - } - - family_stat->buckets_buf = (s_bucket *)encoder->usr->malloc(encoder->usr, - n_buckets * sizeof(s_bucket)); - if (!family_stat->buckets_buf) { - goto error_2; - } - - fill_model_structures(encoder, family_stat, rep_first, first_size, rep_next, mul_size, levels, - ncounters, n_buckets, n_buckets_ptrs); - - return TRUE; - -error_2: - encoder->usr->free(encoder->usr, family_stat->counters); - -error_1: - encoder->usr->free(encoder->usr, family_stat->buckets_ptrs); - - return FALSE; -} - -static void free_family_stat(QuicUsrContext *usr, FamilyStat *family_stat) -{ - usr->free(usr, family_stat->buckets_ptrs); - usr->free(usr, family_stat->counters); - usr->free(usr, family_stat->buckets_buf); -} - -static int init_channel(Encoder *encoder, Channel *channel) -{ - unsigned int ncounters; - unsigned int levels; - unsigned int rep_first; - unsigned int first_size; - unsigned int rep_next; - unsigned int mul_size; - unsigned int n_buckets; - unsigned int n_buckets_ptrs; - - channel->encoder = encoder; - channel->state.encoder = encoder; - channel->correlate_row_width = 0; - channel->correlate_row = NULL; - - find_model_params(encoder, 8, &ncounters, &levels, &n_buckets_ptrs, &rep_first, - &first_size, &rep_next, &mul_size, &n_buckets); - encoder->n_buckets_8bpc = n_buckets; - if (!init_model_structures(encoder, &channel->family_stat_8bpc, rep_first, first_size, - rep_next, mul_size, levels, ncounters, n_buckets_ptrs, - n_buckets)) { - return FALSE; - } - - find_model_params(encoder, 5, &ncounters, &levels, &n_buckets_ptrs, &rep_first, - &first_size, &rep_next, &mul_size, &n_buckets); - encoder->n_buckets_5bpc = n_buckets; - if (!init_model_structures(encoder, &channel->family_stat_5bpc, rep_first, first_size, - rep_next, mul_size, levels, ncounters, n_buckets_ptrs, - n_buckets)) { - free_family_stat(encoder->usr, &channel->family_stat_8bpc); - return FALSE; - } - - return TRUE; -} - -static void destroy_channel(Channel *channel) -{ - QuicUsrContext *usr = channel->encoder->usr; - if (channel->correlate_row) { - usr->free(usr, channel->correlate_row - 1); - } - free_family_stat(usr, &channel->family_stat_8bpc); - free_family_stat(usr, &channel->family_stat_5bpc); -} - -static int init_encoder(Encoder *encoder, QuicUsrContext *usr) -{ - int i; - - encoder->usr = usr; - encoder->rgb_state.encoder = encoder; - - for (i = 0; i < MAX_CHANNELS; i++) { - if (!init_channel(encoder, &encoder->channels[i])) { - for (--i; i >= 0; i--) { - destroy_channel(&encoder->channels[i]); - } - return FALSE; - } - } - return TRUE; -} - -static int encoder_reste(Encoder *encoder, uint32_t *io_ptr, uint32_t *io_ptr_end) -{ - ASSERT(encoder->usr, ((unsigned long)io_ptr % 4) == ((unsigned long)io_ptr_end % 4)); - ASSERT(encoder->usr, io_ptr <= io_ptr_end); - - encoder->rgb_state.waitcnt = 0; - encoder->rgb_state.tabrand_seed = stabrand(); - encoder->rgb_state.wmidx = DEFwmistart; - encoder->rgb_state.wmileft = wminext; - set_wm_trigger(&encoder->rgb_state); - -#if defined(RLE) && defined(RLE_STAT) - encoder_init_rle(&encoder->rgb_state); -#endif - - encoder->io_words_count = io_ptr_end - io_ptr; - encoder->io_now = io_ptr; - encoder->io_end = io_ptr_end; - encoder->rows_completed = 0; - - return TRUE; -} - -static int encoder_reste_channels(Encoder *encoder, int channels, int width, int bpc) -{ - int i; - - encoder->num_channels = channels; - - for (i = 0; i < channels; i++) { - s_bucket *bucket; - s_bucket *end_bucket; - - if (encoder->channels[i].correlate_row_width < width) { - encoder->channels[i].correlate_row_width = 0; - if (encoder->channels[i].correlate_row) { - encoder->usr->free(encoder->usr, encoder->channels[i].correlate_row - 1); - } - if (!(encoder->channels[i].correlate_row = (BYTE *)encoder->usr->malloc(encoder->usr, - width + 1))) { - return FALSE; - } - encoder->channels[i].correlate_row++; - encoder->channels[i].correlate_row_width = width; - } - - if (bpc == 8) { - MEMCLEAR(encoder->channels[i].family_stat_8bpc.counters, - encoder->n_buckets_8bpc * sizeof(COUNTER) * MAXNUMCODES); - bucket = encoder->channels[i].family_stat_8bpc.buckets_buf; - end_bucket = bucket + encoder->n_buckets_8bpc; - for (; bucket < end_bucket; bucket++) { - bucket->bestcode = /*BPC*/ 8 - 1; - } - encoder->channels[i]._buckets_ptrs = encoder->channels[i].family_stat_8bpc.buckets_ptrs; - } else if (bpc == 5) { - MEMCLEAR(encoder->channels[i].family_stat_5bpc.counters, - encoder->n_buckets_5bpc * sizeof(COUNTER) * MAXNUMCODES); - bucket = encoder->channels[i].family_stat_5bpc.buckets_buf; - end_bucket = bucket + encoder->n_buckets_5bpc; - for (; bucket < end_bucket; bucket++) { - bucket->bestcode = /*BPC*/ 5 - 1; - } - encoder->channels[i]._buckets_ptrs = encoder->channels[i].family_stat_5bpc.buckets_ptrs; - } else { - encoder->usr->warn(encoder->usr, "%s: bad bpc %d\n", __FUNCTION__, bpc); - return FALSE; - } - - encoder->channels[i].state.waitcnt = 0; - encoder->channels[i].state.tabrand_seed = stabrand(); - encoder->channels[i].state.wmidx = DEFwmistart; - encoder->channels[i].state.wmileft = wminext; - set_wm_trigger(&encoder->channels[i].state); - -#if defined(RLE) && defined(RLE_STAT) - encoder_init_rle(&encoder->channels[i].state); -#endif - } - return TRUE; -} - -static void quic_image_params(Encoder *encoder, QuicImageType type, int *channels, int *bpc) -{ - ASSERT(encoder->usr, channels && bpc); - switch (type) { - case QUIC_IMAGE_TYPE_GRAY: - *channels = 1; - *bpc = 8; - break; - case QUIC_IMAGE_TYPE_RGB16: - *channels = 3; - *bpc = 5; -#ifndef QUIC_RGB - encoder->usr->error(encoder->usr, "not implemented\n"); -#endif - break; - case QUIC_IMAGE_TYPE_RGB24: - *channels = 3; - *bpc = 8; - break; - case QUIC_IMAGE_TYPE_RGB32: - *channels = 3; - *bpc = 8; - break; - case QUIC_IMAGE_TYPE_RGBA: - *channels = 4; - *bpc = 8; - break; - case QUIC_IMAGE_TYPE_INVALID: - default: - *channels = 0; - *bpc = 0; - encoder->usr->error(encoder->usr, "bad image type\n"); - } -} - -#define FILL_LINES() { \ - if (line == lines_end) { \ - int n = encoder->usr->more_lines(encoder->usr, &line); \ - if (n <= 0) { \ - encoder->usr->error(encoder->usr, "more lines failed\n"); \ - } \ - lines_end = line + n * stride; \ - } \ -} - -#define NEXT_LINE() { \ - line += stride; \ - FILL_LINES(); \ -} - -#define QUIC_COMPRESS_RGB(bits) \ - encoder->channels[0].correlate_row[-1] = 0; \ - encoder->channels[1].correlate_row[-1] = 0; \ - encoder->channels[2].correlate_row[-1] = 0; \ - quic_rgb##bits##_compress_row0(encoder, (rgb##bits##_pixel_t *)(line), width); \ - encoder->rows_completed++; \ - for (row = 1; row < height; row++) { \ - prev = line; \ - NEXT_LINE(); \ - encoder->channels[0].correlate_row[-1] = encoder->channels[0].correlate_row[0]; \ - encoder->channels[1].correlate_row[-1] = encoder->channels[1].correlate_row[0]; \ - encoder->channels[2].correlate_row[-1] = encoder->channels[2].correlate_row[0]; \ - quic_rgb##bits##_compress_row(encoder, (rgb##bits##_pixel_t *)prev, \ - (rgb##bits##_pixel_t *)line, width); \ - encoder->rows_completed++; \ - } - -int quic_encode(QuicContext *quic, QuicImageType type, int width, int height, - uint8_t *line, unsigned int num_lines, int stride, - uint32_t *io_ptr, unsigned int num_io_words) -{ - Encoder *encoder = (Encoder *)quic; - uint32_t *io_ptr_end = io_ptr + num_io_words; - uint8_t *lines_end; - int row; - uint8_t *prev; - int channels; - int bpc; -#ifndef QUIC_RGB - int i; -#endif - - ASSERT(encoder->usr, line); - lines_end = line + num_lines * stride; - - quic_image_params(encoder, type, &channels, &bpc); - - if (!encoder_reste(encoder, io_ptr, io_ptr_end) || - !encoder_reste_channels(encoder, channels, width, bpc)) { - return QUIC_ERROR; - } - - encoder->io_word = 0; - encoder->io_available_bits = 32; - - encode_32(encoder, QUIC_MAGIC); - encode_32(encoder, QUIC_VERSION); - encode_32(encoder, type); - encode_32(encoder, width); - encode_32(encoder, height); - - FILL_LINES(); - - switch (type) { -#ifdef QUIC_RGB - case QUIC_IMAGE_TYPE_RGB32: - ASSERT(encoder->usr, ABS(stride) >= width * 4); - QUIC_COMPRESS_RGB(32); - break; - case QUIC_IMAGE_TYPE_RGB24: - ASSERT(encoder->usr, ABS(stride) >= width * 3); - QUIC_COMPRESS_RGB(24); - break; - case QUIC_IMAGE_TYPE_RGB16: - ASSERT(encoder->usr, ABS(stride) >= width * 2); - QUIC_COMPRESS_RGB(16); - break; - case QUIC_IMAGE_TYPE_RGBA: - ASSERT(encoder->usr, ABS(stride) >= width * 4); - - encoder->channels[0].correlate_row[-1] = 0; - encoder->channels[1].correlate_row[-1] = 0; - encoder->channels[2].correlate_row[-1] = 0; - quic_rgb32_compress_row0(encoder, (rgb32_pixel_t *)(line), width); - - encoder->channels[3].correlate_row[-1] = 0; - quic_four_compress_row0(encoder, &encoder->channels[3], (four_bytes_t *)(line + 3), width); - - encoder->rows_completed++; - - for (row = 1; row < height; row++) { - prev = line; - NEXT_LINE(); - encoder->channels[0].correlate_row[-1] = encoder->channels[0].correlate_row[0]; - encoder->channels[1].correlate_row[-1] = encoder->channels[1].correlate_row[0]; - encoder->channels[2].correlate_row[-1] = encoder->channels[2].correlate_row[0]; - quic_rgb32_compress_row(encoder, (rgb32_pixel_t *)prev, (rgb32_pixel_t *)line, width); - - encoder->channels[3].correlate_row[-1] = encoder->channels[3].correlate_row[0]; - quic_four_compress_row(encoder, &encoder->channels[3], (four_bytes_t *)(prev + 3), - (four_bytes_t *)(line + 3), width); - encoder->rows_completed++; - } - break; -#else - case QUIC_IMAGE_TYPE_RGB24: - ASSERT(encoder->usr, ABS(stride) >= width * 3); - for (i = 0; i < 3; i++) { - encoder->channels[i].correlate_row[-1] = 0; - quic_three_compress_row0(encoder, &encoder->channels[i], (three_bytes_t *)(line + i), - width); - } - encoder->rows_completed++; - for (row = 1; row < height; row++) { - prev = line; - NEXT_LINE(); - for (i = 0; i < 3; i++) { - encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0]; - quic_three_compress_row(encoder, &encoder->channels[i], (three_bytes_t *)(prev + i), - (three_bytes_t *)(line + i), width); - } - encoder->rows_completed++; - } - break; - case QUIC_IMAGE_TYPE_RGB32: - case QUIC_IMAGE_TYPE_RGBA: - ASSERT(encoder->usr, ABS(stride) >= width * 4); - for (i = 0; i < channels; i++) { - encoder->channels[i].correlate_row[-1] = 0; - quic_four_compress_row0(encoder, &encoder->channels[i], (four_bytes_t *)(line + i), - width); - } - encoder->rows_completed++; - for (row = 1; row < height; row++) { - prev = line; - NEXT_LINE(); - for (i = 0; i < channels; i++) { - encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0]; - quic_four_compress_row(encoder, &encoder->channels[i], (four_bytes_t *)(prev + i), - (four_bytes_t *)(line + i), width); - } - encoder->rows_completed++; - } - break; -#endif - case QUIC_IMAGE_TYPE_GRAY: - ASSERT(encoder->usr, ABS(stride) >= width); - encoder->channels[0].correlate_row[-1] = 0; - quic_one_compress_row0(encoder, &encoder->channels[0], (one_byte_t *)line, width); - encoder->rows_completed++; - for (row = 1; row < height; row++) { - prev = line; - NEXT_LINE(); - encoder->channels[0].correlate_row[-1] = encoder->channels[0].correlate_row[0]; - quic_one_compress_row(encoder, &encoder->channels[0], (one_byte_t *)prev, - (one_byte_t *)line, width); - encoder->rows_completed++; - } - break; - case QUIC_IMAGE_TYPE_INVALID: - default: - encoder->usr->error(encoder->usr, "bad image type\n"); - } - - flush(encoder); - encoder->io_words_count -= (encoder->io_end - encoder->io_now); - - return encoder->io_words_count; -} - -int quic_decode_begin(QuicContext *quic, uint32_t *io_ptr, unsigned int num_io_words, - QuicImageType *out_type, int *out_width, int *out_height) -{ - Encoder *encoder = (Encoder *)quic; - uint32_t *io_ptr_end = io_ptr + num_io_words; - QuicImageType type; - int width; - int height; - uint32_t magic; - uint32_t version; - int channels; - int bpc; - - if (!encoder_reste(encoder, io_ptr, io_ptr_end)) { - return QUIC_ERROR; - } - - init_decode_io(encoder); - - magic = encoder->io_word; - decode_eat32bits(encoder); - if (magic != QUIC_MAGIC) { - encoder->usr->warn(encoder->usr, "bad magic\n"); - return QUIC_ERROR; - } - - version = encoder->io_word; - decode_eat32bits(encoder); - if (version != QUIC_VERSION) { - encoder->usr->warn(encoder->usr, "bad version\n"); - return QUIC_ERROR; - } - - type = (QuicImageType)encoder->io_word; - decode_eat32bits(encoder); - - width = encoder->io_word; - decode_eat32bits(encoder); - - height = encoder->io_word; - decode_eat32bits(encoder); - - quic_image_params(encoder, type, &channels, &bpc); - - if (!encoder_reste_channels(encoder, channels, width, bpc)) { - return QUIC_ERROR; - } - - *out_width = encoder->width = width; - *out_height = encoder->height = height; - *out_type = encoder->type = type; - return QUIC_OK; -} - -#ifndef QUIC_RGB -static void clear_row(four_bytes_t *row, int width) -{ - four_bytes_t *end; - for (end = row + width; row < end; row++) { - row->a = 0; - } -} - -#endif - -#ifdef QUIC_RGB - -static void uncompress_rgba(Encoder *encoder, uint8_t *buf, int stride) -{ - unsigned int row; - uint8_t *prev; - - encoder->channels[0].correlate_row[-1] = 0; - encoder->channels[1].correlate_row[-1] = 0; - encoder->channels[2].correlate_row[-1] = 0; - quic_rgb32_uncompress_row0(encoder, (rgb32_pixel_t *)buf, encoder->width); - - encoder->channels[3].correlate_row[-1] = 0; - quic_four_uncompress_row0(encoder, &encoder->channels[3], (four_bytes_t *)(buf + 3), - encoder->width); - - encoder->rows_completed++; - for (row = 1; row < encoder->height; row++) { - prev = buf; - buf += stride; - - encoder->channels[0].correlate_row[-1] = encoder->channels[0].correlate_row[0]; - encoder->channels[1].correlate_row[-1] = encoder->channels[1].correlate_row[0]; - encoder->channels[2].correlate_row[-1] = encoder->channels[2].correlate_row[0]; - quic_rgb32_uncompress_row(encoder, (rgb32_pixel_t *)prev, (rgb32_pixel_t *)buf, - encoder->width); - - encoder->channels[3].correlate_row[-1] = encoder->channels[3].correlate_row[0]; - quic_four_uncompress_row(encoder, &encoder->channels[3], (four_bytes_t *)(prev + 3), - (four_bytes_t *)(buf + 3), encoder->width); - - encoder->rows_completed++; - } -} - -#endif - -static void uncompress_gray(Encoder *encoder, uint8_t *buf, int stride) -{ - unsigned int row; - uint8_t *prev; - - encoder->channels[0].correlate_row[-1] = 0; - quic_one_uncompress_row0(encoder, &encoder->channels[0], (one_byte_t *)buf, encoder->width); - encoder->rows_completed++; - for (row = 1; row < encoder->height; row++) { - prev = buf; - buf += stride; - encoder->channels[0].correlate_row[-1] = encoder->channels[0].correlate_row[0]; - quic_one_uncompress_row(encoder, &encoder->channels[0], (one_byte_t *)prev, - (one_byte_t *)buf, encoder->width); - encoder->rows_completed++; - } -} - -#define QUIC_UNCOMPRESS_RGB(prefix, type) \ - encoder->channels[0].correlate_row[-1] = 0; \ - encoder->channels[1].correlate_row[-1] = 0; \ - encoder->channels[2].correlate_row[-1] = 0; \ - quic_rgb##prefix##_uncompress_row0(encoder, (type *)buf, encoder->width); \ - encoder->rows_completed++; \ - for (row = 1; row < encoder->height; row++) { \ - prev = buf; \ - buf += stride; \ - encoder->channels[0].correlate_row[-1] = encoder->channels[0].correlate_row[0]; \ - encoder->channels[1].correlate_row[-1] = encoder->channels[1].correlate_row[0]; \ - encoder->channels[2].correlate_row[-1] = encoder->channels[2].correlate_row[0]; \ - quic_rgb##prefix##_uncompress_row(encoder, (type *)prev, (type *)buf, \ - encoder->width); \ - encoder->rows_completed++; \ - } - -int quic_decode(QuicContext *quic, QuicImageType type, uint8_t *buf, int stride) -{ - Encoder *encoder = (Encoder *)quic; - unsigned int row; - uint8_t *prev; -#ifndef QUIC_RGB - int i; -#endif - - ASSERT(encoder->usr, buf); - - switch (encoder->type) { -#ifdef QUIC_RGB - case QUIC_IMAGE_TYPE_RGB32: - case QUIC_IMAGE_TYPE_RGB24: - if (type == QUIC_IMAGE_TYPE_RGB32) { - ASSERT(encoder->usr, ABS(stride) >= (int)encoder->width * 4); - QUIC_UNCOMPRESS_RGB(32, rgb32_pixel_t); - break; - } else if (type == QUIC_IMAGE_TYPE_RGB24) { - ASSERT(encoder->usr, ABS(stride) >= (int)encoder->width * 3); - QUIC_UNCOMPRESS_RGB(24, rgb24_pixel_t); - break; - } - encoder->usr->warn(encoder->usr, "unsupported output format\n"); - return QUIC_ERROR; - case QUIC_IMAGE_TYPE_RGB16: - if (type == QUIC_IMAGE_TYPE_RGB16) { - ASSERT(encoder->usr, ABS(stride) >= (int)encoder->width * 2); - QUIC_UNCOMPRESS_RGB(16, rgb16_pixel_t); - } else if (type == QUIC_IMAGE_TYPE_RGB32) { - ASSERT(encoder->usr, ABS(stride) >= (int)encoder->width * 4); - QUIC_UNCOMPRESS_RGB(16_to_32, rgb32_pixel_t); - } else { - encoder->usr->warn(encoder->usr, "unsupported output format\n"); - return QUIC_ERROR; - } - - break; - case QUIC_IMAGE_TYPE_RGBA: - - if (type != QUIC_IMAGE_TYPE_RGBA) { - encoder->usr->warn(encoder->usr, "unsupported output format\n"); - return QUIC_ERROR; - } - ASSERT(encoder->usr, ABS(stride) >= (int)encoder->width * 4); - uncompress_rgba(encoder, buf, stride); - break; -#else - case QUIC_IMAGE_TYPE_RGB24: - ASSERT(encoder->usr, ABS(stride) >= (int)encoder->width * 3); - for (i = 0; i < 3; i++) { - encoder->channels[i].correlate_row[-1] = 0; - quic_three_uncompress_row0(encoder, &encoder->channels[i], (three_bytes_t *)(buf + i), - encoder->width); - } - encoder->rows_completed++; - for (row = 1; row < encoder->height; row++) { - prev = buf; - buf += stride; - for (i = 0; i < 3; i++) { - encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0]; - quic_three_uncompress_row(encoder, &encoder->channels[i], - (three_bytes_t *)(prev + i), - (three_bytes_t *)(buf + i), - encoder->width); - } - encoder->rows_completed++; - } - break; - case QUIC_IMAGE_TYPE_RGB32: - ASSERT(encoder->usr, ABS(stride) >= encoder->width * 4); - for (i = 0; i < 3; i++) { - encoder->channels[i].correlate_row[-1] = 0; - quic_four_uncompress_row0(encoder, &encoder->channels[i], (four_bytes_t *)(buf + i), - encoder->width); - } - clear_row((four_bytes_t *)(buf + 3), encoder->width); - encoder->rows_completed++; - for (row = 1; row < encoder->height; row++) { - prev = buf; - buf += stride; - for (i = 0; i < 3; i++) { - encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0]; - quic_four_uncompress_row(encoder, &encoder->channels[i], - (four_bytes_t *)(prev + i), - (four_bytes_t *)(buf + i), - encoder->width); - } - clear_row((four_bytes_t *)(buf + 3), encoder->width); - encoder->rows_completed++; - } - break; - case QUIC_IMAGE_TYPE_RGBA: - ASSERT(encoder->usr, ABS(stride) >= encoder->width * 4); - for (i = 0; i < 4; i++) { - encoder->channels[i].correlate_row[-1] = 0; - quic_four_uncompress_row0(encoder, &encoder->channels[i], (four_bytes_t *)(buf + i), - encoder->width); - } - encoder->rows_completed++; - for (row = 1; row < encoder->height; row++) { - prev = buf; - buf += stride; - for (i = 0; i < 4; i++) { - encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0]; - quic_four_uncompress_row(encoder, &encoder->channels[i], - (four_bytes_t *)(prev + i), - (four_bytes_t *)(buf + i), - encoder->width); - } - encoder->rows_completed++; - } - break; -#endif - case QUIC_IMAGE_TYPE_GRAY: - - if (type != QUIC_IMAGE_TYPE_GRAY) { - encoder->usr->warn(encoder->usr, "unsupported output format\n"); - return QUIC_ERROR; - } - ASSERT(encoder->usr, ABS(stride) >= (int)encoder->width); - uncompress_gray(encoder, buf, stride); - break; - case QUIC_IMAGE_TYPE_INVALID: - default: - encoder->usr->error(encoder->usr, "bad image type\n"); - } - return QUIC_OK; -} - -static int need_init = TRUE; - -QuicContext *quic_create(QuicUsrContext *usr) -{ - Encoder *encoder; - - if (!usr || need_init || !usr->error || !usr->warn || !usr->info || !usr->malloc || - !usr->free || !usr->more_space || !usr->more_lines) { - return NULL; - } - - if (!(encoder = (Encoder *)usr->malloc(usr, sizeof(Encoder)))) { - return NULL; - } - - if (!init_encoder(encoder, usr)) { - usr->free(usr, encoder); - return NULL; - } - return (QuicContext *)encoder; -} - -void quic_destroy(QuicContext *quic) -{ - Encoder *encoder = (Encoder *)quic; - int i; - - if (!quic) { - return; - } - - for (i = 0; i < MAX_CHANNELS; i++) { - destroy_channel(&encoder->channels[i]); - } - encoder->usr->free(encoder->usr, encoder); -} - -void quic_init() -{ - if (!need_init) { - return; - } - need_init = FALSE; - - family_init(&family_8bpc, 8, DEFmaxclen); - family_init(&family_5bpc, 5, DEFmaxclen); -#if defined(RLE) && defined(RLE_STAT) - init_zeroLUT(); -#endif -} - diff -Nru spice-gtk-0.9/common/quic_config.h spice-gtk-0.12/common/quic_config.h --- spice-gtk-0.9/common/quic_config.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/quic_config.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef __QUIC_CONFIG_H -#define __QUIC_CONFIG_H - -#include - -#ifdef __GNUC__ - -#include - -#define INLINE inline - -#define MEMCLEAR(ptr, size) memset(ptr, 0, size) - -#else - -#ifdef QXLDD -#include -#include "os_dep.h" -#define INLINE _inline -#define MEMCLEAR(ptr, size) RtlZeroMemory(ptr, size) -#else -#include -#include - -#define INLINE inline -#define MEMCLEAR(ptr, size) memset(ptr, 0, size) -#endif - - -#endif - -#endif - diff -Nru spice-gtk-0.9/common/quic_family_tmpl.c spice-gtk-0.12/common/quic_family_tmpl.c --- spice-gtk-0.9/common/quic_family_tmpl.c 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/quic_family_tmpl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,115 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifdef QUIC_FAMILY_8BPC -#undef QUIC_FAMILY_8BPC -#define FNAME(name) name##_8bpc -#define VNAME(name) name##_8bpc -#define BPC 8 -#endif - - -#ifdef QUIC_FAMILY_5BPC -#undef QUIC_FAMILY_5BPC -#define FNAME(name) name##_5bpc -#define VNAME(name) name##_5bpc -#define BPC 5 -#endif - - -static unsigned int FNAME(golomb_code_len)(const BYTE n, const unsigned int l) -{ - if (n < VNAME(family).nGRcodewords[l]) { - return (n >> l) + 1 + l; - } else { - return VNAME(family).notGRcwlen[l]; - } -} - -static void FNAME(golomb_coding)(const BYTE n, const unsigned int l, unsigned int * const codeword, - unsigned int * const codewordlen) -{ - if (n < VNAME(family).nGRcodewords[l]) { - (*codeword) = bitat[l] | (n & bppmask[l]); - (*codewordlen) = (n >> l) + l + 1; - } else { - (*codeword) = n - VNAME(family).nGRcodewords[l]; - (*codewordlen) = VNAME(family).notGRcwlen[l]; - } -} - -unsigned int FNAME(golomb_decoding)(const unsigned int l, const unsigned int bits, - unsigned int * const codewordlen) -{ - if (bits > VNAME(family).notGRprefixmask[l]) { /*GR*/ - const unsigned int zeroprefix = cnt_l_zeroes(bits); /* leading zeroes in codeword */ - const unsigned int cwlen = zeroprefix + 1 + l; /* codeword length */ - (*codewordlen) = cwlen; - return (zeroprefix << l) | ((bits >> (32 - cwlen)) & bppmask[l]); - } else { /* not-GR */ - const unsigned int cwlen = VNAME(family).notGRcwlen[l]; - (*codewordlen) = cwlen; - return VNAME(family).nGRcodewords[l] + ((bits) >> (32 - cwlen) & - bppmask[VNAME(family).notGRsuffixlen[l]]); - } -} - -/* update the bucket using just encoded curval */ -static void FNAME(update_model)(CommonState *state, s_bucket * const bucket, - const BYTE curval, unsigned int bpp) -{ - COUNTER * const pcounters = bucket->pcounters; - unsigned int i; - unsigned int bestcode; - unsigned int bestcodelen; - //unsigned int bpp = encoder->bpp; - - /* update counters, find minimum */ - - bestcode = bpp - 1; - bestcodelen = (pcounters[bestcode] += FNAME(golomb_code_len)(curval, bestcode)); - - for (i = bpp - 2; i < bpp; i--) { /* NOTE: expression i=0 */ - const unsigned int ithcodelen = (pcounters[i] += FNAME(golomb_code_len)(curval, i)); - - if (ithcodelen < bestcodelen) { - bestcode = i; - bestcodelen = ithcodelen; - } - } - - bucket->bestcode = bestcode; /* store the found minimum */ - - if (bestcodelen > state->wm_trigger) { /* halving counters? */ - for (i = 0; i < bpp; i++) { - pcounters[i] >>= 1; - } - } -} - -static s_bucket *FNAME(find_bucket)(Channel *channel, const unsigned int val) -{ - ASSERT(channel->encoder->usr, val < (0x1U << BPC)); - - return channel->_buckets_ptrs[val]; -} - -#undef FNAME -#undef VNAME -#undef BPC - diff -Nru spice-gtk-0.9/common/quic.h spice-gtk-0.12/common/quic.h --- spice-gtk-0.9/common/quic.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/quic.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef __QUIC_H -#define __QUIC_H - -#include "quic_config.h" - -typedef enum { - QUIC_IMAGE_TYPE_INVALID, - QUIC_IMAGE_TYPE_GRAY, - QUIC_IMAGE_TYPE_RGB16, - QUIC_IMAGE_TYPE_RGB24, - QUIC_IMAGE_TYPE_RGB32, - QUIC_IMAGE_TYPE_RGBA -} QuicImageType; - -#define QUIC_ERROR -1 -#define QUIC_OK 0 - -typedef void *QuicContext; - -typedef struct QuicUsrContext QuicUsrContext; -struct QuicUsrContext { - void (*error)(QuicUsrContext *usr, const char *fmt, ...); - void (*warn)(QuicUsrContext *usr, const char *fmt, ...); - void (*info)(QuicUsrContext *usr, const char *fmt, ...); - void *(*malloc)(QuicUsrContext *usr, int size); - void (*free)(QuicUsrContext *usr, void *ptr); - int (*more_space)(QuicUsrContext *usr, uint32_t **io_ptr, int rows_completed); - int (*more_lines)(QuicUsrContext *usr, uint8_t **lines); // on return the last line of previous - // lines bunch must still be valid -}; - -int quic_encode(QuicContext *quic, QuicImageType type, int width, int height, - uint8_t *lines, unsigned int num_lines, int stride, - uint32_t *io_ptr, unsigned int num_io_words); - -int quic_decode_begin(QuicContext *quic, uint32_t *io_ptr, unsigned int num_io_words, - QuicImageType *type, int *width, int *height); -int quic_decode(QuicContext *quic, QuicImageType type, uint8_t *buf, int stride); - - -QuicContext *quic_create(QuicUsrContext *usr); -void quic_destroy(QuicContext *quic); - -void quic_init(); - -#endif - diff -Nru spice-gtk-0.9/common/quic_rgb_tmpl.c spice-gtk-0.12/common/quic_rgb_tmpl.c --- spice-gtk-0.9/common/quic_rgb_tmpl.c 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/quic_rgb_tmpl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,763 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifdef QUIC_RGB32 -#undef QUIC_RGB32 -#define PIXEL rgb32_pixel_t -#define FNAME(name) quic_rgb32_##name -#define golomb_coding golomb_coding_8bpc -#define golomb_decoding golomb_decoding_8bpc -#define update_model update_model_8bpc -#define find_bucket find_bucket_8bpc -#define family family_8bpc -#define BPC 8 -#define BPC_MASK 0xffU -#define COMPRESS_IMP -#define SET_r(pix, val) ((pix)->r = val) -#define GET_r(pix) ((pix)->r) -#define SET_g(pix, val) ((pix)->g = val) -#define GET_g(pix) ((pix)->g) -#define SET_b(pix, val) ((pix)->b = val) -#define GET_b(pix) ((pix)->b) -#define UNCOMPRESS_PIX_START(pix) ((pix)->pad = 0) -#endif - -#ifdef QUIC_RGB24 -#undef QUIC_RGB24 -#define PIXEL rgb24_pixel_t -#define FNAME(name) quic_rgb24_##name -#define golomb_coding golomb_coding_8bpc -#define golomb_decoding golomb_decoding_8bpc -#define update_model update_model_8bpc -#define find_bucket find_bucket_8bpc -#define family family_8bpc -#define BPC 8 -#define BPC_MASK 0xffU -#define COMPRESS_IMP -#define SET_r(pix, val) ((pix)->r = val) -#define GET_r(pix) ((pix)->r) -#define SET_g(pix, val) ((pix)->g = val) -#define GET_g(pix) ((pix)->g) -#define SET_b(pix, val) ((pix)->b = val) -#define GET_b(pix) ((pix)->b) -#define UNCOMPRESS_PIX_START(pix) -#endif - -#ifdef QUIC_RGB16 -#undef QUIC_RGB16 -#define PIXEL rgb16_pixel_t -#define FNAME(name) quic_rgb16_##name -#define golomb_coding golomb_coding_5bpc -#define golomb_decoding golomb_decoding_5bpc -#define update_model update_model_5bpc -#define find_bucket find_bucket_5bpc -#define family family_5bpc -#define BPC 5 -#define BPC_MASK 0x1fU -#define COMPRESS_IMP -#define SET_r(pix, val) (*(pix) = (*(pix) & ~(0x1f << 10)) | ((val) << 10)) -#define GET_r(pix) ((*(pix) >> 10) & 0x1f) -#define SET_g(pix, val) (*(pix) = (*(pix) & ~(0x1f << 5)) | ((val) << 5)) -#define GET_g(pix) ((*(pix) >> 5) & 0x1f) -#define SET_b(pix, val) (*(pix) = (*(pix) & ~0x1f) | (val)) -#define GET_b(pix) (*(pix) & 0x1f) -#define UNCOMPRESS_PIX_START(pix) (*(pix) = 0) -#endif - -#ifdef QUIC_RGB16_TO_32 -#undef QUIC_RGB16_TO_32 -#define PIXEL rgb32_pixel_t -#define FNAME(name) quic_rgb16_to_32_##name -#define golomb_coding golomb_coding_5bpc -#define golomb_decoding golomb_decoding_5bpc -#define update_model update_model_5bpc -#define find_bucket find_bucket_5bpc -#define family family_5bpc -#define BPC 5 -#define BPC_MASK 0x1fU - -#define SET_r(pix, val) ((pix)->r = ((val) << 3) | (((val) & 0x1f) >> 2)) -#define GET_r(pix) ((pix)->r >> 3) -#define SET_g(pix, val) ((pix)->g = ((val) << 3) | (((val) & 0x1f) >> 2)) -#define GET_g(pix) ((pix)->g >> 3) -#define SET_b(pix, val) ((pix)->b = ((val) << 3) | (((val) & 0x1f) >> 2)) -#define GET_b(pix) ((pix)->b >> 3) -#define UNCOMPRESS_PIX_START(pix) ((pix)->pad = 0) -#endif - -#define SAME_PIXEL(p1, p2) \ - (GET_r(p1) == GET_r(p2) && GET_g(p1) == GET_g(p2) && \ - GET_b(p1) == GET_b(p2)) - - -#define _PIXEL_A(channel, curr) ((unsigned int)GET_##channel((curr) - 1)) -#define _PIXEL_B(channel, prev) ((unsigned int)GET_##channel(prev)) -#define _PIXEL_C(channel, prev) ((unsigned int)GET_##channel((prev) - 1)) - -/* a */ - -#define DECORELATE_0(channel, curr, bpc_mask)\ - family.xlatU2L[(unsigned)((int)GET_##channel(curr) - (int)_PIXEL_A(channel, curr)) & bpc_mask] - -#define CORELATE_0(channel, curr, correlate, bpc_mask)\ - ((family.xlatL2U[correlate] + _PIXEL_A(channel, curr)) & bpc_mask) - -#ifdef PRED_1 - -/* (a+b)/2 */ -#define DECORELATE(channel, prev, curr, bpc_mask, r) \ - r = family.xlatU2L[(unsigned)((int)GET_##channel(curr) - (int)((_PIXEL_A(channel, curr) + \ - _PIXEL_B(channel, prev)) >> 1)) & bpc_mask] - -#define CORELATE(channel, prev, curr, correlate, bpc_mask, r) \ - SET_##channel(r, ((family.xlatL2U[correlate] + \ - (int)((_PIXEL_A(channel, curr) + _PIXEL_B(channel, prev)) >> 1)) & bpc_mask)) -#endif - -#ifdef PRED_2 - -/* .75a+.75b-.5c */ -#define DECORELATE(channel, prev, curr, bpc_mask, r) { \ - int p = ((int)(3 * (_PIXEL_A(channel, curr) + _PIXEL_B(channel, prev))) - \ - (int)(_PIXEL_C(channel, prev) << 1)) >> 2; \ - if (p < 0) { \ - p = 0; \ - } else if ((unsigned)p > bpc_mask) { \ - p = bpc_mask; \ - } \ - r = family.xlatU2L[(unsigned)((int)GET_##channel(curr) - p) & bpc_mask]; \ -} - -#define CORELATE(channel, prev, curr, correlate, bpc_mask, r) { \ - const int p = ((int)(3 * (_PIXEL_A(channel, curr) + _PIXEL_B(channel, prev))) - \ - (int)(_PIXEL_C(channel, prev) << 1) ) >> 2; \ - const unsigned int s = family.xlatL2U[correlate]; \ - if (!(p & ~bpc_mask)) { \ - SET_##channel(r, (s + (unsigned)p) & bpc_mask); \ - } else if (p < 0) { \ - SET_##channel(r, s); \ - } else { \ - SET_##channel(r, (s + bpc_mask) & bpc_mask); \ - } \ -} - -#endif - - -#define COMPRESS_ONE_ROW0_0(channel) \ - correlate_row_##channel[0] = family.xlatU2L[GET_##channel(cur_row)]; \ - golomb_coding(correlate_row_##channel[0], find_bucket(channel_##channel, \ - correlate_row_##channel[-1])->bestcode, \ - &codeword, &codewordlen); \ - encode(encoder, codeword, codewordlen); - -#define COMPRESS_ONE_ROW0(channel, index) \ - correlate_row_##channel[index] = DECORELATE_0(channel, &cur_row[index], bpc_mask); \ - golomb_coding(correlate_row_##channel[index], find_bucket(channel_##channel, \ - correlate_row_##channel[index -1])->bestcode, \ - &codeword, &codewordlen); \ - encode(encoder, codeword, codewordlen); - -#define UPDATE_MODEL(index) \ - update_model(&encoder->rgb_state, find_bucket(channel_r, correlate_row_r[index - 1]), \ - correlate_row_r[index], bpc); \ - update_model(&encoder->rgb_state, find_bucket(channel_g, correlate_row_g[index - 1]), \ - correlate_row_g[index], bpc); \ - update_model(&encoder->rgb_state, find_bucket(channel_b, correlate_row_b[index - 1]), \ - correlate_row_b[index], bpc); - - -#ifdef RLE_PRED_1 -#define RLE_PRED_1_IMP \ -if (SAME_PIXEL(&cur_row[i - 1], &prev_row[i])) { \ - if (run_index != i && SAME_PIXEL(&prev_row[i - 1], &prev_row[i]) && \ - i + 1 < end && SAME_PIXEL(&prev_row[i], &prev_row[i + 1])) { \ - goto do_run; \ - } \ -} -#else -#define RLE_PRED_1_IMP -#endif - -#ifdef RLE_PRED_2 -#define RLE_PRED_2_IMP \ -if (SAME_PIXEL(&prev_row[i - 1], &prev_row[i])) { \ - if (run_index != i && i > 2 && SAME_PIXEL(&cur_row[i - 1], &cur_row[i - 2])) { \ - goto do_run; \ - } \ -} -#else -#define RLE_PRED_2_IMP -#endif - -#ifdef RLE_PRED_3 -#define RLE_PRED_3_IMP \ -if (i > 1 && SAME_PIXEL(&cur_row[i - 1], &cur_row[i - 2]) && i != run_index) { \ - goto do_run; \ -} -#else -#define RLE_PRED_3_IMP -#endif - -#ifdef COMPRESS_IMP - -static void FNAME(compress_row0_seg)(Encoder *encoder, int i, - const PIXEL * const cur_row, - const int end, - const unsigned int waitmask, - const unsigned int bpc, - const unsigned int bpc_mask) -{ - Channel * const channel_r = encoder->channels; - Channel * const channel_g = channel_r + 1; - Channel * const channel_b = channel_g + 1; - - BYTE * const correlate_row_r = channel_r->correlate_row; - BYTE * const correlate_row_g = channel_g->correlate_row; - BYTE * const correlate_row_b = channel_b->correlate_row; - int stopidx; - - ASSERT(encoder->usr, end - i > 0); - - if (!i) { - unsigned int codeword, codewordlen; - - COMPRESS_ONE_ROW0_0(r); - COMPRESS_ONE_ROW0_0(g); - COMPRESS_ONE_ROW0_0(b); - - if (encoder->rgb_state.waitcnt) { - encoder->rgb_state.waitcnt--; - } else { - encoder->rgb_state.waitcnt = (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); - UPDATE_MODEL(0); - } - stopidx = ++i + encoder->rgb_state.waitcnt; - } else { - stopidx = i + encoder->rgb_state.waitcnt; - } - - while (stopidx < end) { - for (; i <= stopidx; i++) { - unsigned int codeword, codewordlen; - COMPRESS_ONE_ROW0(r, i); - COMPRESS_ONE_ROW0(g, i); - COMPRESS_ONE_ROW0(b, i); - } - - UPDATE_MODEL(stopidx); - stopidx = i + (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); - } - - for (; i < end; i++) { - unsigned int codeword, codewordlen; - - COMPRESS_ONE_ROW0(r, i); - COMPRESS_ONE_ROW0(g, i); - COMPRESS_ONE_ROW0(b, i); - } - encoder->rgb_state.waitcnt = stopidx - end; -} - -static void FNAME(compress_row0)(Encoder *encoder, const PIXEL *cur_row, - unsigned int width) -{ - const unsigned int bpc = BPC; - const unsigned int bpc_mask = BPC_MASK; - int pos = 0; - - while ((wmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) { - if (encoder->rgb_state.wmileft) { - FNAME(compress_row0_seg)(encoder, pos, cur_row, pos + encoder->rgb_state.wmileft, - bppmask[encoder->rgb_state.wmidx], bpc, bpc_mask); - width -= encoder->rgb_state.wmileft; - pos += encoder->rgb_state.wmileft; - } - - encoder->rgb_state.wmidx++; - set_wm_trigger(&encoder->rgb_state); - encoder->rgb_state.wmileft = wminext; - } - - if (width) { - FNAME(compress_row0_seg)(encoder, pos, cur_row, pos + width, - bppmask[encoder->rgb_state.wmidx], bpc, bpc_mask); - if (wmimax > (int)encoder->rgb_state.wmidx) { - encoder->rgb_state.wmileft -= width; - } - } - - ASSERT(encoder->usr, (int)encoder->rgb_state.wmidx <= wmimax); - ASSERT(encoder->usr, encoder->rgb_state.wmidx <= 32); - ASSERT(encoder->usr, wminext > 0); -} - -#define COMPRESS_ONE_0(channel) \ - correlate_row_##channel[0] = family.xlatU2L[(unsigned)((int)GET_##channel(cur_row) - \ - (int)GET_##channel(prev_row) ) & bpc_mask]; \ - golomb_coding(correlate_row_##channel[0], \ - find_bucket(channel_##channel, correlate_row_##channel[-1])->bestcode, \ - &codeword, &codewordlen); \ - encode(encoder, codeword, codewordlen); - -#define COMPRESS_ONE(channel, index) \ - DECORELATE(channel, &prev_row[index], &cur_row[index],bpc_mask, \ - correlate_row_##channel[index]); \ - golomb_coding(correlate_row_##channel[index], \ - find_bucket(channel_##channel, correlate_row_##channel[index - 1])->bestcode, \ - &codeword, &codewordlen); \ - encode(encoder, codeword, codewordlen); - -static void FNAME(compress_row_seg)(Encoder *encoder, int i, - const PIXEL * const prev_row, - const PIXEL * const cur_row, - const int end, - const unsigned int waitmask, - const unsigned int bpc, - const unsigned int bpc_mask) -{ - Channel * const channel_r = encoder->channels; - Channel * const channel_g = channel_r + 1; - Channel * const channel_b = channel_g + 1; - - BYTE * const correlate_row_r = channel_r->correlate_row; - BYTE * const correlate_row_g = channel_g->correlate_row; - BYTE * const correlate_row_b = channel_b->correlate_row; - int stopidx; -#ifdef RLE - int run_index = 0; - int run_size; -#endif - - ASSERT(encoder->usr, end - i > 0); - - if (!i) { - unsigned int codeword, codewordlen; - - COMPRESS_ONE_0(r); - COMPRESS_ONE_0(g); - COMPRESS_ONE_0(b); - - if (encoder->rgb_state.waitcnt) { - encoder->rgb_state.waitcnt--; - } else { - encoder->rgb_state.waitcnt = (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); - UPDATE_MODEL(0); - } - stopidx = ++i + encoder->rgb_state.waitcnt; - } else { - stopidx = i + encoder->rgb_state.waitcnt; - } - for (;;) { - while (stopidx < end) { - for (; i <= stopidx; i++) { - unsigned int codeword, codewordlen; -#ifdef RLE - RLE_PRED_1_IMP; - RLE_PRED_2_IMP; - RLE_PRED_3_IMP; -#endif - COMPRESS_ONE(r, i); - COMPRESS_ONE(g, i); - COMPRESS_ONE(b, i); - } - - UPDATE_MODEL(stopidx); - stopidx = i + (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); - } - - for (; i < end; i++) { - unsigned int codeword, codewordlen; -#ifdef RLE - RLE_PRED_1_IMP; - RLE_PRED_2_IMP; - RLE_PRED_3_IMP; -#endif - COMPRESS_ONE(r, i); - COMPRESS_ONE(g, i); - COMPRESS_ONE(b, i); - } - encoder->rgb_state.waitcnt = stopidx - end; - - return; - -#ifdef RLE -do_run: - run_index = i; - encoder->rgb_state.waitcnt = stopidx - i; - run_size = 0; - - while (SAME_PIXEL(&cur_row[i], &cur_row[i - 1])) { - run_size++; - if (++i == end) { - encode_run(encoder, run_size); - return; - } - } - encode_run(encoder, run_size); - stopidx = i + encoder->rgb_state.waitcnt; -#endif - } -} - -static void FNAME(compress_row)(Encoder *encoder, - const PIXEL * const prev_row, - const PIXEL * const cur_row, - unsigned int width) - -{ - const unsigned int bpc = BPC; - const unsigned int bpc_mask = BPC_MASK; - unsigned int pos = 0; - - while ((wmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) { - if (encoder->rgb_state.wmileft) { - FNAME(compress_row_seg)(encoder, pos, prev_row, cur_row, - pos + encoder->rgb_state.wmileft, - bppmask[encoder->rgb_state.wmidx], - bpc, bpc_mask); - width -= encoder->rgb_state.wmileft; - pos += encoder->rgb_state.wmileft; - } - - encoder->rgb_state.wmidx++; - set_wm_trigger(&encoder->rgb_state); - encoder->rgb_state.wmileft = wminext; - } - - if (width) { - FNAME(compress_row_seg)(encoder, pos, prev_row, cur_row, pos + width, - bppmask[encoder->rgb_state.wmidx], bpc, bpc_mask); - if (wmimax > (int)encoder->rgb_state.wmidx) { - encoder->rgb_state.wmileft -= width; - } - } - - ASSERT(encoder->usr, (int)encoder->rgb_state.wmidx <= wmimax); - ASSERT(encoder->usr, encoder->rgb_state.wmidx <= 32); - ASSERT(encoder->usr, wminext > 0); -} - -#endif - -#define UNCOMPRESS_ONE_ROW0_0(channel) \ - correlate_row_##channel[0] = (BYTE)golomb_decoding(find_bucket(channel_##channel, \ - correlate_row_##channel[-1])->bestcode, \ - encoder->io_word, &codewordlen); \ - SET_##channel(&cur_row[0], (BYTE)family.xlatL2U[correlate_row_##channel[0]]); \ - decode_eatbits(encoder, codewordlen); - -#define UNCOMPRESS_ONE_ROW0(channel) \ - correlate_row_##channel[i] = (BYTE)golomb_decoding(find_bucket(channel_##channel, \ - correlate_row_##channel[i - 1])->bestcode, \ - encoder->io_word, \ - &codewordlen); \ - SET_##channel(&cur_row[i], CORELATE_0(channel, &cur_row[i], correlate_row_##channel[i], \ - bpc_mask)); \ - decode_eatbits(encoder, codewordlen); - -static void FNAME(uncompress_row0_seg)(Encoder *encoder, int i, - PIXEL * const cur_row, - const int end, - const unsigned int waitmask, - const unsigned int bpc, - const unsigned int bpc_mask) -{ - Channel * const channel_r = encoder->channels; - Channel * const channel_g = channel_r + 1; - Channel * const channel_b = channel_g + 1; - - BYTE * const correlate_row_r = channel_r->correlate_row; - BYTE * const correlate_row_g = channel_g->correlate_row; - BYTE * const correlate_row_b = channel_b->correlate_row; - int stopidx; - - ASSERT(encoder->usr, end - i > 0); - - if (!i) { - unsigned int codewordlen; - - UNCOMPRESS_PIX_START(&cur_row[i]); - UNCOMPRESS_ONE_ROW0_0(r); - UNCOMPRESS_ONE_ROW0_0(g); - UNCOMPRESS_ONE_ROW0_0(b); - - if (encoder->rgb_state.waitcnt) { - --encoder->rgb_state.waitcnt; - } else { - encoder->rgb_state.waitcnt = (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); - UPDATE_MODEL(0); - } - stopidx = ++i + encoder->rgb_state.waitcnt; - } else { - stopidx = i + encoder->rgb_state.waitcnt; - } - - while (stopidx < end) { - for (; i <= stopidx; i++) { - unsigned int codewordlen; - - UNCOMPRESS_PIX_START(&cur_row[i]); - UNCOMPRESS_ONE_ROW0(r); - UNCOMPRESS_ONE_ROW0(g); - UNCOMPRESS_ONE_ROW0(b); - } - UPDATE_MODEL(stopidx); - stopidx = i + (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); - } - - for (; i < end; i++) { - unsigned int codewordlen; - - UNCOMPRESS_PIX_START(&cur_row[i]); - UNCOMPRESS_ONE_ROW0(r); - UNCOMPRESS_ONE_ROW0(g); - UNCOMPRESS_ONE_ROW0(b); - } - encoder->rgb_state.waitcnt = stopidx - end; -} - -static void FNAME(uncompress_row0)(Encoder *encoder, - PIXEL * const cur_row, - unsigned int width) - -{ - const unsigned int bpc = BPC; - const unsigned int bpc_mask = BPC_MASK; - unsigned int pos = 0; - - while ((wmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) { - if (encoder->rgb_state.wmileft) { - FNAME(uncompress_row0_seg)(encoder, pos, cur_row, - pos + encoder->rgb_state.wmileft, - bppmask[encoder->rgb_state.wmidx], - bpc, bpc_mask); - pos += encoder->rgb_state.wmileft; - width -= encoder->rgb_state.wmileft; - } - - encoder->rgb_state.wmidx++; - set_wm_trigger(&encoder->rgb_state); - encoder->rgb_state.wmileft = wminext; - } - - if (width) { - FNAME(uncompress_row0_seg)(encoder, pos, cur_row, pos + width, - bppmask[encoder->rgb_state.wmidx], bpc, bpc_mask); - if (wmimax > (int)encoder->rgb_state.wmidx) { - encoder->rgb_state.wmileft -= width; - } - } - - ASSERT(encoder->usr, (int)encoder->rgb_state.wmidx <= wmimax); - ASSERT(encoder->usr, encoder->rgb_state.wmidx <= 32); - ASSERT(encoder->usr, wminext > 0); -} - -#define UNCOMPRESS_ONE_0(channel) \ - correlate_row_##channel[0] = (BYTE)golomb_decoding(find_bucket(channel_##channel, \ - correlate_row_##channel[-1])->bestcode, \ - encoder->io_word, &codewordlen); \ - SET_##channel(&cur_row[0], (family.xlatL2U[correlate_row_##channel[0]] + \ - GET_##channel(prev_row)) & bpc_mask); \ - decode_eatbits(encoder, codewordlen); - -#define UNCOMPRESS_ONE(channel) \ - correlate_row_##channel[i] = (BYTE)golomb_decoding(find_bucket(channel_##channel, \ - correlate_row_##channel[i - 1])->bestcode, \ - encoder->io_word, \ - &codewordlen); \ - CORELATE(channel, &prev_row[i], &cur_row[i], correlate_row_##channel[i], bpc_mask, \ - &cur_row[i]); \ - decode_eatbits(encoder, codewordlen); - -static void FNAME(uncompress_row_seg)(Encoder *encoder, - const PIXEL * const prev_row, - PIXEL * const cur_row, - int i, - const int end, - const unsigned int bpc, - const unsigned int bpc_mask) -{ - Channel * const channel_r = encoder->channels; - Channel * const channel_g = channel_r + 1; - Channel * const channel_b = channel_g + 1; - - BYTE * const correlate_row_r = channel_r->correlate_row; - BYTE * const correlate_row_g = channel_g->correlate_row; - BYTE * const correlate_row_b = channel_b->correlate_row; - const unsigned int waitmask = bppmask[encoder->rgb_state.wmidx]; - int stopidx; -#ifdef RLE - int run_index = 0; - int run_end; -#endif - - ASSERT(encoder->usr, end - i > 0); - - if (!i) { - unsigned int codewordlen; - - UNCOMPRESS_PIX_START(&cur_row[i]); - UNCOMPRESS_ONE_0(r); - UNCOMPRESS_ONE_0(g); - UNCOMPRESS_ONE_0(b); - - if (encoder->rgb_state.waitcnt) { - --encoder->rgb_state.waitcnt; - } else { - encoder->rgb_state.waitcnt = (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); - UPDATE_MODEL(0); - } - stopidx = ++i + encoder->rgb_state.waitcnt; - } else { - stopidx = i + encoder->rgb_state.waitcnt; - } - for (;;) { - while (stopidx < end) { - for (; i <= stopidx; i++) { - unsigned int codewordlen; -#ifdef RLE - RLE_PRED_1_IMP; - RLE_PRED_2_IMP; - RLE_PRED_3_IMP; -#endif - UNCOMPRESS_PIX_START(&cur_row[i]); - UNCOMPRESS_ONE(r); - UNCOMPRESS_ONE(g); - UNCOMPRESS_ONE(b); - } - - UPDATE_MODEL(stopidx); - - stopidx = i + (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); - } - - for (; i < end; i++) { - unsigned int codewordlen; -#ifdef RLE - RLE_PRED_1_IMP; - RLE_PRED_2_IMP; - RLE_PRED_3_IMP; -#endif - UNCOMPRESS_PIX_START(&cur_row[i]); - UNCOMPRESS_ONE(r); - UNCOMPRESS_ONE(g); - UNCOMPRESS_ONE(b); - } - - encoder->rgb_state.waitcnt = stopidx - end; - - return; - -#ifdef RLE -do_run: - encoder->rgb_state.waitcnt = stopidx - i; - run_index = i; - run_end = i + decode_run(encoder); - - for (; i < run_end; i++) { - UNCOMPRESS_PIX_START(&cur_row[i]); - SET_r(&cur_row[i], GET_r(&cur_row[i - 1])); - SET_g(&cur_row[i], GET_g(&cur_row[i - 1])); - SET_b(&cur_row[i], GET_b(&cur_row[i - 1])); - } - - if (i == end) { - return; - } - - stopidx = i + encoder->rgb_state.waitcnt; -#endif - } -} - -static void FNAME(uncompress_row)(Encoder *encoder, - const PIXEL * const prev_row, - PIXEL * const cur_row, - unsigned int width) - -{ - const unsigned int bpc = BPC; - const unsigned int bpc_mask = BPC_MASK; - unsigned int pos = 0; - - while ((wmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) { - if (encoder->rgb_state.wmileft) { - FNAME(uncompress_row_seg)(encoder, prev_row, cur_row, pos, - pos + encoder->rgb_state.wmileft, bpc, bpc_mask); - pos += encoder->rgb_state.wmileft; - width -= encoder->rgb_state.wmileft; - } - - encoder->rgb_state.wmidx++; - set_wm_trigger(&encoder->rgb_state); - encoder->rgb_state.wmileft = wminext; - } - - if (width) { - FNAME(uncompress_row_seg)(encoder, prev_row, cur_row, pos, - pos + width, bpc, bpc_mask); - if (wmimax > (int)encoder->rgb_state.wmidx) { - encoder->rgb_state.wmileft -= width; - } - } - - ASSERT(encoder->usr, (int)encoder->rgb_state.wmidx <= wmimax); - ASSERT(encoder->usr, encoder->rgb_state.wmidx <= 32); - ASSERT(encoder->usr, wminext > 0); -} - -#undef PIXEL -#undef FNAME -#undef _PIXEL_A -#undef _PIXEL_B -#undef _PIXEL_C -#undef SAME_PIXEL -#undef RLE_PRED_1_IMP -#undef RLE_PRED_2_IMP -#undef RLE_PRED_3_IMP -#undef UPDATE_MODEL -#undef DECORELATE_0 -#undef DECORELATE -#undef COMPRESS_ONE_ROW0_0 -#undef COMPRESS_ONE_ROW0 -#undef COMPRESS_ONE_0 -#undef COMPRESS_ONE -#undef CORELATE_0 -#undef CORELATE -#undef UNCOMPRESS_ONE_ROW0_0 -#undef UNCOMPRESS_ONE_ROW0 -#undef UNCOMPRESS_ONE_0 -#undef UNCOMPRESS_ONE -#undef golomb_coding -#undef golomb_decoding -#undef update_model -#undef find_bucket -#undef family -#undef BPC -#undef BPC_MASK -#undef COMPRESS_IMP -#undef SET_r -#undef GET_r -#undef SET_g -#undef GET_g -#undef SET_b -#undef GET_b -#undef UNCOMPRESS_PIX_START - diff -Nru spice-gtk-0.9/common/quic_tmpl.c spice-gtk-0.12/common/quic_tmpl.c --- spice-gtk-0.9/common/quic_tmpl.c 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/quic_tmpl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,633 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifdef ONE_BYTE -#undef ONE_BYTE -#define FNAME(name) quic_one_##name -#define PIXEL one_byte_t -#endif - -#ifdef THREE_BYTE -#undef THREE_BYTE -#define FNAME(name) quic_three_##name -#define PIXEL three_bytes_t -#endif - -#ifdef FOUR_BYTE -#undef FOUR_BYTE -#define FNAME(name) quic_four_##name -#define PIXEL four_bytes_t -#endif - -#define golomb_coding golomb_coding_8bpc -#define golomb_decoding golomb_decoding_8bpc -#define update_model update_model_8bpc -#define find_bucket find_bucket_8bpc -#define family family_8bpc - -#define BPC 8 -#define BPC_MASK 0xffU - -#define _PIXEL_A ((unsigned int)curr[-1].a) -#define _PIXEL_B ((unsigned int)prev[0].a) -#define _PIXEL_C ((unsigned int)prev[-1].a) - -#ifdef RLE_PRED_1 -#define RLE_PRED_1_IMP \ -if (cur_row[i - 1].a == prev_row[i].a) { \ - if (run_index != i && prev_row[i - 1].a == prev_row[i].a && \ - i + 1 < end && prev_row[i].a == prev_row[i + 1].a) { \ - goto do_run; \ - } \ -} -#else -#define RLE_PRED_1_IMP -#endif - -#ifdef RLE_PRED_2 -#define RLE_PRED_2_IMP \ -if (prev_row[i - 1].a == prev_row[i].a) { \ - if (run_index != i && i > 2 && cur_row[i - 1].a == cur_row[i - 2].a) { \ - goto do_run; \ - } \ -} -#else -#define RLE_PRED_2_IMP -#endif - -#ifdef RLE_PRED_3 -#define RLE_PRED_3_IMP \ -if (i > 1 && cur_row[i - 1].a == cur_row[i - 2].a && i != run_index) { \ - goto do_run; \ -} -#else -#define RLE_PRED_3_IMP -#endif - -/* a */ -static INLINE BYTE FNAME(decorelate_0)(const PIXEL * const curr, const unsigned int bpc_mask) -{ - return family.xlatU2L[(unsigned)((int)curr[0].a - (int)_PIXEL_A) & bpc_mask]; -} - -static INLINE void FNAME(corelate_0)(PIXEL *curr, const BYTE corelate, - const unsigned int bpc_mask) -{ - curr->a = (family.xlatL2U[corelate] + _PIXEL_A) & bpc_mask; -} - -#ifdef PRED_1 - -/* (a+b)/2 */ -static INLINE BYTE FNAME(decorelate)(const PIXEL *const prev, const PIXEL * const curr, - const unsigned int bpc_mask) -{ - return family.xlatU2L[(unsigned)((int)curr->a - (int)((_PIXEL_A + _PIXEL_B) >> 1)) & bpc_mask]; -} - - -static INLINE void FNAME(corelate)(const PIXEL *prev, PIXEL *curr, const BYTE corelate, - const unsigned int bpc_mask) -{ - curr->a = (family.xlatL2U[corelate] + (int)((_PIXEL_A + _PIXEL_B) >> 1)) & bpc_mask; -} - -#endif - -#ifdef PRED_2 - -/* .75a+.75b-.5c */ -static INLINE BYTE FNAME(decorelate)(const PIXEL *const prev, const PIXEL * const curr, - const unsigned int bpc_mask) -{ - int p = ((int)(3 * (_PIXEL_A + _PIXEL_B)) - (int)(_PIXEL_C << 1)) >> 2; - - if (p < 0) { - p = 0; - } else if ((unsigned)p > bpc_mask) { - p = bpc_mask; - } - - { - return family.xlatU2L[(unsigned)((int)curr->a - p) & bpc_mask]; - } -} - -static INLINE void FNAME(corelate)(const PIXEL *prev, PIXEL *curr, const BYTE corelate, - const unsigned int bpc_mask) -{ - const int p = ((int)(3 * (_PIXEL_A + _PIXEL_B)) - (int)(_PIXEL_C << 1)) >> 2; - const unsigned int s = family.xlatL2U[corelate]; - - if (!(p & ~bpc_mask)) { - curr->a = (s + (unsigned)p) & bpc_mask; - } else if (p < 0) { - curr->a = s; - } else { - curr->a = (s + bpc_mask) & bpc_mask; - } -} - -#endif - -static void FNAME(compress_row0_seg)(Encoder *encoder, Channel *channel, int i, - const PIXEL * const cur_row, - const int end, - const unsigned int waitmask, - const unsigned int bpc, - const unsigned int bpc_mask) -{ - BYTE * const decorelate_drow = channel->correlate_row; - int stopidx; - - ASSERT(encoder->usr, end - i > 0); - - if (i == 0) { - unsigned int codeword, codewordlen; - - decorelate_drow[0] = family.xlatU2L[cur_row->a]; - golomb_coding(decorelate_drow[0], find_bucket(channel, decorelate_drow[-1])->bestcode, - &codeword, &codewordlen); - encode(encoder, codeword, codewordlen); - - if (channel->state.waitcnt) { - channel->state.waitcnt--; - } else { - channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); - update_model(&channel->state, find_bucket(channel, decorelate_drow[-1]), - decorelate_drow[i], bpc); - } - stopidx = ++i + channel->state.waitcnt; - } else { - stopidx = i + channel->state.waitcnt; - } - - while (stopidx < end) { - for (; i <= stopidx; i++) { - unsigned int codeword, codewordlen; - decorelate_drow[i] = FNAME(decorelate_0)(&cur_row[i], bpc_mask); - golomb_coding(decorelate_drow[i], - find_bucket(channel, decorelate_drow[i - 1])->bestcode, &codeword, - &codewordlen); - encode(encoder, codeword, codewordlen); - } - - update_model(&channel->state, find_bucket(channel, decorelate_drow[stopidx - 1]), - decorelate_drow[stopidx], bpc); - stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); - } - - for (; i < end; i++) { - unsigned int codeword, codewordlen; - decorelate_drow[i] = FNAME(decorelate_0)(&cur_row[i], bpc_mask); - golomb_coding(decorelate_drow[i], find_bucket(channel, decorelate_drow[i - 1])->bestcode, - &codeword, &codewordlen); - encode(encoder, codeword, codewordlen); - } - channel->state.waitcnt = stopidx - end; -} - -static void FNAME(compress_row0)(Encoder *encoder, Channel *channel, const PIXEL *cur_row, - unsigned int width) -{ - const unsigned int bpc = BPC; - const unsigned int bpc_mask = BPC_MASK; - int pos = 0; - - while ((wmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) { - if (channel->state.wmileft) { - FNAME(compress_row0_seg)(encoder, channel, pos, cur_row, pos + channel->state.wmileft, - bppmask[channel->state.wmidx], bpc, bpc_mask); - width -= channel->state.wmileft; - pos += channel->state.wmileft; - } - - channel->state.wmidx++; - set_wm_trigger(&channel->state); - channel->state.wmileft = wminext; - } - - if (width) { - FNAME(compress_row0_seg)(encoder, channel, pos, cur_row, pos + width, - bppmask[channel->state.wmidx], bpc, bpc_mask); - if (wmimax > (int)channel->state.wmidx) { - channel->state.wmileft -= width; - } - } - - ASSERT(encoder->usr, (int)channel->state.wmidx <= wmimax); - ASSERT(encoder->usr, channel->state.wmidx <= 32); - ASSERT(encoder->usr, wminext > 0); -} - -static void FNAME(compress_row_seg)(Encoder *encoder, Channel *channel, int i, - const PIXEL * const prev_row, - const PIXEL * const cur_row, - const int end, - const unsigned int waitmask, - const unsigned int bpc, - const unsigned int bpc_mask) -{ - BYTE * const decorelate_drow = channel->correlate_row; - int stopidx; -#ifdef RLE - int run_index = 0; - int run_size; -#endif - - ASSERT(encoder->usr, end - i > 0); - - if (!i) { - unsigned int codeword, codewordlen; - - decorelate_drow[0] = family.xlatU2L[(unsigned)((int)cur_row->a - - (int)prev_row->a) & bpc_mask]; - - golomb_coding(decorelate_drow[0], - find_bucket(channel, decorelate_drow[-1])->bestcode, - &codeword, - &codewordlen); - encode(encoder, codeword, codewordlen); - - if (channel->state.waitcnt) { - channel->state.waitcnt--; - } else { - channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); - update_model(&channel->state, find_bucket(channel, decorelate_drow[-1]), - decorelate_drow[0], bpc); - } - stopidx = ++i + channel->state.waitcnt; - } else { - stopidx = i + channel->state.waitcnt; - } - for (;;) { - while (stopidx < end) { - for (; i <= stopidx; i++) { - unsigned int codeword, codewordlen; -#ifdef RLE - RLE_PRED_1_IMP; - RLE_PRED_2_IMP; - RLE_PRED_3_IMP; -#endif - decorelate_drow[i] = FNAME(decorelate)(&prev_row[i], &cur_row[i], bpc_mask); - golomb_coding(decorelate_drow[i], - find_bucket(channel, decorelate_drow[i - 1])->bestcode, &codeword, - &codewordlen); - encode(encoder, codeword, codewordlen); - } - - update_model(&channel->state, find_bucket(channel, decorelate_drow[stopidx - 1]), - decorelate_drow[stopidx], bpc); - stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); - } - - for (; i < end; i++) { - unsigned int codeword, codewordlen; -#ifdef RLE - RLE_PRED_1_IMP; - RLE_PRED_2_IMP; - RLE_PRED_3_IMP; -#endif - decorelate_drow[i] = FNAME(decorelate)(&prev_row[i], &cur_row[i], bpc_mask); - golomb_coding(decorelate_drow[i], find_bucket(channel, - decorelate_drow[i - 1])->bestcode, - &codeword, &codewordlen); - encode(encoder, codeword, codewordlen); - } - channel->state.waitcnt = stopidx - end; - - return; - -#ifdef RLE -do_run: - run_index = i; - channel->state.waitcnt = stopidx - i; - run_size = 0; - - while (cur_row[i].a == cur_row[i - 1].a) { - run_size++; - if (++i == end) { -#ifdef RLE_STAT - encode_channel_run(encoder, channel, run_size); -#else - encode_run(encoder, run_size); -#endif - return; - } - } -#ifdef RLE_STAT - encode_channel_run(encoder, channel, run_size); -#else - encode_run(encoder, run_size); -#endif - stopidx = i + channel->state.waitcnt; -#endif - } -} - -static void FNAME(compress_row)(Encoder *encoder, Channel *channel, - const PIXEL * const prev_row, - const PIXEL * const cur_row, - unsigned int width) - -{ - const unsigned int bpc = BPC; - const unsigned int bpc_mask = BPC_MASK; - unsigned int pos = 0; - - while ((wmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) { - if (channel->state.wmileft) { - FNAME(compress_row_seg)(encoder, channel, pos, prev_row, cur_row, - pos + channel->state.wmileft, bppmask[channel->state.wmidx], - bpc, bpc_mask); - width -= channel->state.wmileft; - pos += channel->state.wmileft; - } - - channel->state.wmidx++; - set_wm_trigger(&channel->state); - channel->state.wmileft = wminext; - } - - if (width) { - FNAME(compress_row_seg)(encoder, channel, pos, prev_row, cur_row, pos + width, - bppmask[channel->state.wmidx], bpc, bpc_mask); - if (wmimax > (int)channel->state.wmidx) { - channel->state.wmileft -= width; - } - } - - ASSERT(encoder->usr, (int)channel->state.wmidx <= wmimax); - ASSERT(encoder->usr, channel->state.wmidx <= 32); - ASSERT(encoder->usr, wminext > 0); -} - -static void FNAME(uncompress_row0_seg)(Encoder *encoder, Channel *channel, int i, - BYTE * const correlate_row, - PIXEL * const cur_row, - const int end, - const unsigned int waitmask, - const unsigned int bpc, - const unsigned int bpc_mask) -{ - int stopidx; - - ASSERT(encoder->usr, end - i > 0); - - if (i == 0) { - unsigned int codewordlen; - - correlate_row[0] = (BYTE)golomb_decoding(find_bucket(channel, - correlate_row[-1])->bestcode, - encoder->io_word, &codewordlen); - cur_row[0].a = (BYTE)family.xlatL2U[correlate_row[0]]; - decode_eatbits(encoder, codewordlen); - - if (channel->state.waitcnt) { - --channel->state.waitcnt; - } else { - channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); - update_model(&channel->state, find_bucket(channel, correlate_row[-1]), - correlate_row[0], bpc); - } - stopidx = ++i + channel->state.waitcnt; - } else { - stopidx = i + channel->state.waitcnt; - } - - while (stopidx < end) { - struct s_bucket * pbucket = NULL; - - for (; i <= stopidx; i++) { - unsigned int codewordlen; - - pbucket = find_bucket(channel, correlate_row[i - 1]); - correlate_row[i] = (BYTE)golomb_decoding(pbucket->bestcode, encoder->io_word, - &codewordlen); - FNAME(corelate_0)(&cur_row[i], correlate_row[i], bpc_mask); - decode_eatbits(encoder, codewordlen); - } - - update_model(&channel->state, pbucket, correlate_row[stopidx], bpc); - - stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); - } - - for (; i < end; i++) { - unsigned int codewordlen; - - correlate_row[i] = (BYTE)golomb_decoding(find_bucket(channel, - correlate_row[i - 1])->bestcode, - encoder->io_word, &codewordlen); - FNAME(corelate_0)(&cur_row[i], correlate_row[i], bpc_mask); - decode_eatbits(encoder, codewordlen); - } - channel->state.waitcnt = stopidx - end; -} - -static void FNAME(uncompress_row0)(Encoder *encoder, Channel *channel, - PIXEL * const cur_row, - unsigned int width) - -{ - const unsigned int bpc = BPC; - const unsigned int bpc_mask = BPC_MASK; - BYTE * const correlate_row = channel->correlate_row; - unsigned int pos = 0; - - while ((wmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) { - if (channel->state.wmileft) { - FNAME(uncompress_row0_seg)(encoder, channel, pos, correlate_row, cur_row, - pos + channel->state.wmileft, bppmask[channel->state.wmidx], - bpc, bpc_mask); - pos += channel->state.wmileft; - width -= channel->state.wmileft; - } - - channel->state.wmidx++; - set_wm_trigger(&channel->state); - channel->state.wmileft = wminext; - } - - if (width) { - FNAME(uncompress_row0_seg)(encoder, channel, pos, correlate_row, cur_row, pos + width, - bppmask[channel->state.wmidx], bpc, bpc_mask); - if (wmimax > (int)channel->state.wmidx) { - channel->state.wmileft -= width; - } - } - - ASSERT(encoder->usr, (int)channel->state.wmidx <= wmimax); - ASSERT(encoder->usr, channel->state.wmidx <= 32); - ASSERT(encoder->usr, wminext > 0); -} - -static void FNAME(uncompress_row_seg)(Encoder *encoder, Channel *channel, - BYTE *correlate_row, - const PIXEL * const prev_row, - PIXEL * const cur_row, - int i, - const int end, - const unsigned int bpc, - const unsigned int bpc_mask) -{ - const unsigned int waitmask = bppmask[channel->state.wmidx]; - int stopidx; -#ifdef RLE - int run_index = 0; - int run_end; -#endif - - ASSERT(encoder->usr, end - i > 0); - - if (i == 0) { - unsigned int codewordlen; - - correlate_row[0] = (BYTE)golomb_decoding(find_bucket(channel, correlate_row[-1])->bestcode, - encoder->io_word, &codewordlen); - cur_row[0].a = (family.xlatL2U[correlate_row[0]] + prev_row[0].a) & bpc_mask; - decode_eatbits(encoder, codewordlen); - - if (channel->state.waitcnt) { - --channel->state.waitcnt; - } else { - channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); - update_model(&channel->state, find_bucket(channel, correlate_row[-1]), - correlate_row[0], bpc); - } - stopidx = ++i + channel->state.waitcnt; - } else { - stopidx = i + channel->state.waitcnt; - } - for (;;) { - while (stopidx < end) { - struct s_bucket * pbucket = NULL; - - for (; i <= stopidx; i++) { - unsigned int codewordlen; -#ifdef RLE - RLE_PRED_1_IMP; - RLE_PRED_2_IMP; - RLE_PRED_3_IMP; -#endif - pbucket = find_bucket(channel, correlate_row[i - 1]); - correlate_row[i] = (BYTE)golomb_decoding(pbucket->bestcode, encoder->io_word, - &codewordlen); - FNAME(corelate)(&prev_row[i], &cur_row[i], correlate_row[i], bpc_mask); - decode_eatbits(encoder, codewordlen); - } - - update_model(&channel->state, pbucket, correlate_row[stopidx], bpc); - - stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); - } - - for (; i < end; i++) { - unsigned int codewordlen; -#ifdef RLE - RLE_PRED_1_IMP; - RLE_PRED_2_IMP; - RLE_PRED_3_IMP; -#endif - correlate_row[i] = (BYTE)golomb_decoding(find_bucket(channel, - correlate_row[i - 1])->bestcode, - encoder->io_word, &codewordlen); - FNAME(corelate)(&prev_row[i], &cur_row[i], correlate_row[i], bpc_mask); - decode_eatbits(encoder, codewordlen); - } - - channel->state.waitcnt = stopidx - end; - - return; - -#ifdef RLE -do_run: - channel->state.waitcnt = stopidx - i; - run_index = i; -#ifdef RLE_STAT - run_end = i + decode_channel_run(encoder, channel); -#else - run_end = i + decode_run(encoder); -#endif - - for (; i < run_end; i++) { - cur_row[i].a = cur_row[i - 1].a; - } - - if (i == end) { - return; - } - - stopidx = i + channel->state.waitcnt; -#endif - } -} - -static void FNAME(uncompress_row)(Encoder *encoder, Channel *channel, - const PIXEL * const prev_row, - PIXEL * const cur_row, - unsigned int width) - -{ - const unsigned int bpc = BPC; - const unsigned int bpc_mask = BPC_MASK; - BYTE * const correlate_row = channel->correlate_row; - unsigned int pos = 0; - - while ((wmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) { - if (channel->state.wmileft) { - FNAME(uncompress_row_seg)(encoder, channel, correlate_row, prev_row, cur_row, pos, - pos + channel->state.wmileft, bpc, bpc_mask); - pos += channel->state.wmileft; - width -= channel->state.wmileft; - } - - channel->state.wmidx++; - set_wm_trigger(&channel->state); - channel->state.wmileft = wminext; - } - - if (width) { - FNAME(uncompress_row_seg)(encoder, channel, correlate_row, prev_row, cur_row, pos, - pos + width, bpc, bpc_mask); - if (wmimax > (int)channel->state.wmidx) { - channel->state.wmileft -= width; - } - } - - ASSERT(encoder->usr, (int)channel->state.wmidx <= wmimax); - ASSERT(encoder->usr, channel->state.wmidx <= 32); - ASSERT(encoder->usr, wminext > 0); -} - -#undef PIXEL -#undef FNAME -#undef _PIXEL_A -#undef _PIXEL_B -#undef _PIXEL_C -#undef RLE_PRED_1_IMP -#undef RLE_PRED_2_IMP -#undef RLE_PRED_3_IMP -#undef golomb_coding -#undef golomb_deoding -#undef update_model -#undef find_bucket -#undef family -#undef BPC -#undef BPC_MASK - diff -Nru spice-gtk-0.9/common/rect.h spice-gtk-0.12/common/rect.h --- spice-gtk-0.9/common/rect.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/rect.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,115 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H_RECT -#define _H_RECT - -#include "draw.h" -#include - -static inline void rect_sect(SpiceRect* r, const SpiceRect* bounds) -{ - r->left = MAX(r->left, bounds->left); - r->right = MIN(r->right, bounds->right); - r->right = MAX(r->left, r->right); - - r->top = MAX(r->top, bounds->top); - r->bottom = MIN(r->bottom, bounds->bottom); - r->bottom = MAX(r->top, r->bottom); -} - -static inline void rect_offset(SpiceRect* r, int dx, int dy) -{ - r->left += dx; - r->right += dx; - r->top += dy; - r->bottom += dy; -} - -static inline int rect_is_empty(const SpiceRect* r) -{ - return r->top == r->bottom || r->left == r->right; -} - -static inline int rect_intersects(const SpiceRect* r1, const SpiceRect* r2) -{ - return r1->left < r2->right && r1->right > r2->left && - r1->top < r2->bottom && r1->bottom > r2->top; -} - -static inline int rect_is_equal(const SpiceRect *r1, const SpiceRect *r2) -{ - return r1->top == r2->top && r1->left == r2->left && - r1->bottom == r2->bottom && r1->right == r2->right; -} - -static inline void rect_union(SpiceRect *dest, const SpiceRect *r) -{ - dest->top = MIN(dest->top, r->top); - dest->left = MIN(dest->left, r->left); - dest->bottom = MAX(dest->bottom, r->bottom); - dest->right = MAX(dest->right, r->right); -} - -static inline int rect_is_same_size(const SpiceRect *r1, const SpiceRect *r2) -{ - return r1->right - r1->left == r2->right - r2->left && - r1->bottom - r1->top == r2->bottom - r2->top; -} - -#ifdef __cplusplus - -static inline void rect_sect(SpiceRect& r, const SpiceRect& bounds) -{ - rect_sect(&r, &bounds); -} - -static inline void rect_offset(SpiceRect& r, int dx, int dy) -{ - rect_offset(&r, dx, dy); -} - -static inline int rect_is_empty(const SpiceRect& r) -{ - return rect_is_empty(&r); -} - -static inline int rect_intersects(const SpiceRect& r1, const SpiceRect& r2) -{ - return rect_intersects(&r1, &r2); -} - -static inline int rect_is_equal(const SpiceRect& r1, const SpiceRect& r2) -{ - return rect_is_equal(&r1, &r2); -} - -static inline void rect_union(SpiceRect& dest, const SpiceRect& r) -{ - rect_union(&dest, &r); -} - -static inline int rect_is_same_size(const SpiceRect& r1, const SpiceRect& r2) -{ - return rect_is_same_size(&r1, &r2); -} - -#endif - -#endif - diff -Nru spice-gtk-0.9/common/region.c spice-gtk-0.12/common/region.c --- spice-gtk-0.9/common/region.c 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/region.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,893 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#include -#include -#include -#include - -#include "region.h" -#include "rect.h" -#include "mem.h" - -#define ASSERT(x) if (!(x)) { \ - printf("%s: ASSERT %s failed\n", __FUNCTION__, #x); \ - abort(); \ -} - -/* true iff two Boxes overlap */ -#define EXTENTCHECK(r1, r2) \ - (!( ((r1)->x2 <= (r2)->x1) || \ - ((r1)->x1 >= (r2)->x2) || \ - ((r1)->y2 <= (r2)->y1) || \ - ((r1)->y1 >= (r2)->y2) ) ) - -/* true iff Box r1 contains Box r2 */ -#define SUBSUMES(r1, r2) \ - ( ((r1)->x1 <= (r2)->x1) && \ - ((r1)->x2 >= (r2)->x2) && \ - ((r1)->y1 <= (r2)->y1) && \ - ((r1)->y2 >= (r2)->y2) ) - - -void region_init(QRegion *rgn) -{ - pixman_region32_init(rgn); -} - -void region_clear(QRegion *rgn) -{ - pixman_region32_fini(rgn); - pixman_region32_init(rgn); -} - -void region_destroy(QRegion *rgn) -{ - pixman_region32_fini(rgn); -} - -void region_clone(QRegion *dest, const QRegion *src) -{ - pixman_region32_init(dest); - pixman_region32_copy(dest, (pixman_region32_t *)src); -} - -#define FIND_BAND(r, r_band_end, r_end, ry1) \ - do { \ - ry1 = r->y1; \ - r_band_end = r + 1; \ - while ((r_band_end != r_end) && (r_band_end->y1 == ry1)) { \ - r_band_end++; \ - } \ - } while (0) - -static int test_band(int query, - int res, - pixman_box32_t *r1, - pixman_box32_t *r1_end, - pixman_box32_t *r2, - pixman_box32_t *r2_end) -{ - int x1; - int x2; - - do { - x1 = MAX(r1->x1, r2->x1); - x2 = MIN(r1->x2, r2->x2); - - /* - * Is there any overlap between the two rectangles? - */ - if (x1 < x2) { - res |= REGION_TEST_SHARED; - - if (r1->x1 < r2->x1 || r1->x2 > r2->x2) { - res |= REGION_TEST_LEFT_EXCLUSIVE; - } - - if (r2->x1 < r1->x1 || r2->x2 > r1->x2) { - res |= REGION_TEST_RIGHT_EXCLUSIVE; - } - } else { - /* No overlap at all, the leftmost is exclusive */ - if (r1->x1 < r2->x1) { - res |= REGION_TEST_LEFT_EXCLUSIVE; - } else { - res |= REGION_TEST_RIGHT_EXCLUSIVE; - } - } - - if ((res & query) == query) { - return res; - } - - /* - * Advance the pointer(s) with the leftmost right side, since the next - * rectangle on that list may still overlap the other region's - * current rectangle. - */ - if (r1->x2 == x2) { - r1++; - } - if (r2->x2 == x2) { - r2++; - } - } while ((r1 != r1_end) && (r2 != r2_end)); - - /* - * Deal with whichever band (if any) still has rectangles left. - */ - if (r1 != r1_end) { - res |= REGION_TEST_LEFT_EXCLUSIVE; - } else if (r2 != r2_end) { - res |= REGION_TEST_RIGHT_EXCLUSIVE; - } - - return res; -} - -static int test_generic (pixman_region32_t *reg1, - pixman_region32_t *reg2, - int query) -{ - pixman_box32_t *r1; /* Pointer into first region */ - pixman_box32_t *r2; /* Pointer into 2d region */ - pixman_box32_t *r1_end; /* End of 1st region */ - pixman_box32_t *r2_end; /* End of 2d region */ - int ybot; /* Bottom of intersection */ - int ytop; /* Top of intersection */ - pixman_box32_t * r1_band_end; /* End of current band in r1 */ - pixman_box32_t * r2_band_end; /* End of current band in r2 */ - int top; /* Top of non-overlapping band */ - int bot; /* Bottom of non-overlapping band*/ - int r1y1; /* Temps for r1->y1 and r2->y1 */ - int r2y1; - int r1_num_rects; - int r2_num_rects; - int res; - - r1 = pixman_region32_rectangles(reg1, &r1_num_rects); - r1_end = r1 + r1_num_rects; - - r2 = pixman_region32_rectangles(reg2, &r2_num_rects); - r2_end = r2 + r2_num_rects; - - res = 0; - - /* - * Initialize ybot. - * In the upcoming loop, ybot and ytop serve different functions depending - * on whether the band being handled is an overlapping or non-overlapping - * band. - * In the case of a non-overlapping band (only one of the regions - * has points in the band), ybot is the bottom of the most recent - * intersection and thus clips the top of the rectangles in that band. - * ytop is the top of the next intersection between the two regions and - * serves to clip the bottom of the rectangles in the current band. - * For an overlapping band (where the two regions intersect), ytop clips - * the top of the rectangles of both regions and ybot clips the bottoms. - */ - - ybot = MIN(r1->y1, r2->y1); - - do { - /* - * This algorithm proceeds one source-band (as opposed to a - * destination band, which is determined by where the two regions - * intersect) at a time. r1_band_end and r2_band_end serve to mark the - * rectangle after the last one in the current band for their - * respective regions. - */ - FIND_BAND(r1, r1_band_end, r1_end, r1y1); - FIND_BAND(r2, r2_band_end, r2_end, r2y1); - - /* - * First handle the band that doesn't intersect, if any. - * - * Note that attention is restricted to one band in the - * non-intersecting region at once, so if a region has n - * bands between the current position and the next place it overlaps - * the other, this entire loop will be passed through n times. - */ - if (r1y1 < r2y1) { - top = MAX (r1y1, ybot); - bot = MIN (r1->y2, r2y1); - if (top != bot) { - res |= REGION_TEST_LEFT_EXCLUSIVE; - - if ((res & query) == query) { - return res & query; - } - } - - ytop = r2y1; - } else if (r2y1 < r1y1) { - top = MAX (r2y1, ybot); - bot = MIN (r2->y2, r1y1); - - if (top != bot) { - res |= REGION_TEST_RIGHT_EXCLUSIVE; - - if ((res & query) == query) { - return res & query; - } - } - ytop = r1y1; - } else { - ytop = r1y1; - } - - /* - * Now see if we've hit an intersecting band. The two bands only - * intersect if ybot > ytop - */ - ybot = MIN (r1->y2, r2->y2); - if (ybot > ytop) { - res = test_band(query, res, - r1, r1_band_end, - r2, r2_band_end); - if ((res & query) == query) { - return res & query; - } - } - - /* - * If we've finished with a band (y2 == ybot) we skip forward - * in the region to the next band. - */ - if (r1->y2 == ybot) { - r1 = r1_band_end; - } - - if (r2->y2 == ybot) { - r2 = r2_band_end; - } - - } - while (r1 != r1_end && r2 != r2_end); - - /* - * Deal with whichever region (if any) still has rectangles left. - */ - - if (r1 != r1_end) { - res |= REGION_TEST_LEFT_EXCLUSIVE; - } else if (r2 != r2_end) { - res |= REGION_TEST_RIGHT_EXCLUSIVE; - } - - return res & query; -} - -int region_test(const QRegion *_reg1, const QRegion *_reg2, int query) -{ - int res; - pixman_region32_t *reg1 = (pixman_region32_t *)_reg1; - pixman_region32_t *reg2 = (pixman_region32_t *)_reg2; - - query = (query) ? query & REGION_TEST_ALL : REGION_TEST_ALL; - - res = 0; - - if (!pixman_region32_not_empty(reg1) || !pixman_region32_not_empty(reg2) || - !EXTENTCHECK (®1->extents, ®2->extents)) { - /* One or more regions are empty or they are disjoint */ - - if (pixman_region32_not_empty(reg1)) { - res |= REGION_TEST_LEFT_EXCLUSIVE; - } - - if (pixman_region32_not_empty(reg2)) { - res |= REGION_TEST_RIGHT_EXCLUSIVE; - } - - return res & query; - } else if (!reg1->data && !reg2->data) { - /* Just two rectangles that intersect */ - res |= REGION_TEST_SHARED; - - if (!SUBSUMES(®1->extents, ®2->extents)) { - res |= REGION_TEST_RIGHT_EXCLUSIVE; - } - - if (!SUBSUMES(®2->extents, ®1->extents)) { - res |= REGION_TEST_LEFT_EXCLUSIVE; - } - - return res & query; - } else if (!reg2->data && SUBSUMES (®2->extents, ®1->extents)) { - /* reg2 is just a rect that contains all of reg1 */ - - res |= REGION_TEST_SHARED; /* some piece must be shared, because reg is not empty */ - res |= REGION_TEST_RIGHT_EXCLUSIVE; /* reg2 contains all of reg1 and then some */ - - return res & query; - } else if (!reg1->data && SUBSUMES (®1->extents, ®2->extents)) { - /* reg1 is just a rect that contains all of reg2 */ - - res |= REGION_TEST_SHARED; /* some piece must be shared, because reg is not empty */ - res |= REGION_TEST_LEFT_EXCLUSIVE; /* reg1 contains all of reg2 and then some */ - - return res & query; - } else if (reg1 == reg2) { - res |= REGION_TEST_SHARED; - return res & query; - } else { - /* General purpose intersection */ - return test_generic (reg1, reg2, query); - } -} - -int region_is_valid(const QRegion *rgn) -{ - return pixman_region32_selfcheck((pixman_region32_t *)rgn); -} - -int region_is_empty(const QRegion *rgn) -{ - return !pixman_region32_not_empty((pixman_region32_t *)rgn); -} - -SpiceRect *region_dup_rects(const QRegion *rgn, uint32_t *num_rects) -{ - pixman_box32_t *boxes; - SpiceRect *rects; - int n, i; - - boxes = pixman_region32_rectangles((pixman_region32_t *)rgn, &n); - if (num_rects) { - *num_rects = n; - } - rects = spice_new(SpiceRect, n); - for (i = 0; i < n; i++) { - rects[i].left = boxes[i].x1; - rects[i].top = boxes[i].y1; - rects[i].right = boxes[i].x2; - rects[i].bottom = boxes[i].y2; - } - return rects; -} - -void region_ret_rects(const QRegion *rgn, SpiceRect *rects, uint32_t num_rects) -{ - pixman_box32_t *boxes; - unsigned int n, i; - - boxes = pixman_region32_rectangles((pixman_region32_t *)rgn, (int *)&n); - for (i = 0; i < n && i < num_rects; i++) { - rects[i].left = boxes[i].x1; - rects[i].top = boxes[i].y1; - rects[i].right = boxes[i].x2; - rects[i].bottom = boxes[i].y2; - } - - if (i && i != n) { - unsigned int x; - - for (x = 0; x < (n - num_rects); ++x) { - rects[i - 1].left = MIN(rects[i - 1].left, boxes[i + x].x1); - rects[i - 1].top = MIN(rects[i - 1].top, boxes[i + x].y1); - rects[i - 1].right = MAX(rects[i - 1].right, boxes[i + x].x2); - rects[i - 1].bottom = MAX(rects[i - 1].bottom, boxes[i + x].y2); - } - } -} - - -int region_is_equal(const QRegion *rgn1, const QRegion *rgn2) -{ - return pixman_region32_equal((pixman_region32_t *)rgn1, (pixman_region32_t *)rgn2); -} - -int region_intersects(const QRegion *rgn1, const QRegion *rgn2) -{ - int test_res; - - if (!region_bounds_intersects(rgn1, rgn2)) { - return FALSE; - } - - test_res = region_test(rgn1, rgn2, REGION_TEST_SHARED); - return !!test_res; -} - -int region_bounds_intersects(const QRegion *rgn1, const QRegion *rgn2) -{ - pixman_box32_t *extents1, *extents2; - - extents1 = pixman_region32_extents((pixman_region32_t *)rgn1); - extents2 = pixman_region32_extents((pixman_region32_t *)rgn1); - - return EXTENTCHECK(extents1, extents2); -} - -int region_contains(const QRegion *rgn, const QRegion *other) -{ - int test_res; - - test_res = region_test(rgn, other, REGION_TEST_RIGHT_EXCLUSIVE); - return !test_res; -} - -int region_contains_point(const QRegion *rgn, int32_t x, int32_t y) -{ - return pixman_region32_contains_point((pixman_region32_t *)rgn, x, y, NULL); -} - -void region_or(QRegion *rgn, const QRegion *other_rgn) -{ - pixman_region32_union(rgn, rgn, (pixman_region32_t *)other_rgn); -} - -void region_and(QRegion *rgn, const QRegion *other_rgn) -{ - pixman_region32_intersect(rgn, rgn, (pixman_region32_t *)other_rgn); -} - -void region_xor(QRegion *rgn, const QRegion *other_rgn) -{ - pixman_region32_t intersection; - - pixman_region32_copy(&intersection, rgn); - pixman_region32_intersect(&intersection, - &intersection, - (pixman_region32_t *)other_rgn); - pixman_region32_union(rgn, rgn, (pixman_region32_t *)other_rgn); - pixman_region32_subtract(rgn, rgn, &intersection); - pixman_region32_fini(&intersection); -} - -void region_exclude(QRegion *rgn, const QRegion *other_rgn) -{ - pixman_region32_subtract(rgn, rgn, (pixman_region32_t *)other_rgn); -} - -void region_add(QRegion *rgn, const SpiceRect *r) -{ - pixman_region32_union_rect(rgn, rgn, r->left, r->top, - r->right - r->left, - r->bottom - r->top); -} - -void region_remove(QRegion *rgn, const SpiceRect *r) -{ - pixman_region32_t rg; - - pixman_region32_init_rect(&rg, r->left, r->top, - r->right - r->left, - r->bottom - r->top); - pixman_region32_subtract(rgn, rgn, &rg); - pixman_region32_fini(&rg); -} - - -void region_offset(QRegion *rgn, int32_t dx, int32_t dy) -{ - pixman_region32_translate(rgn, dx, dy); -} - -void region_dump(const QRegion *rgn, const char *prefix) -{ - pixman_box32_t *rects, *extents; - int n_rects, i; - - printf("%sREGION: %p, ", prefix, rgn); - - if (!pixman_region32_not_empty((pixman_region32_t *)rgn)) { - printf("EMPTY\n"); - return; - } - - extents = pixman_region32_extents((pixman_region32_t *)rgn); - rects = pixman_region32_rectangles((pixman_region32_t *)rgn, &n_rects); - printf("num %u bounds (%d, %d, %d, %d)\n", - n_rects, - extents->x1, - extents->y1, - extents->x2, - extents->y2); - - - for (i = 0; i < n_rects; i++) { - printf("%*s %12d %12d %12d %12d\n", - (int)strlen(prefix), "", - rects[i].x1, - rects[i].y1, - rects[i].x2, - rects[i].y2); - } -} - -#ifdef REGION_TEST - -static int slow_region_test(const QRegion *rgn, const QRegion *other_rgn, int query) -{ - pixman_region32_t intersection; - int res; - - pixman_region32_init(&intersection); - pixman_region32_intersect(&intersection, - (pixman_region32_t *)rgn, - (pixman_region32_t *)other_rgn); - - res = 0; - - if (query & REGION_TEST_SHARED && - pixman_region32_not_empty(&intersection)) { - res |= REGION_TEST_SHARED; - } - - if (query & REGION_TEST_LEFT_EXCLUSIVE && - !pixman_region32_equal(&intersection, (pixman_region32_t *)rgn)) { - res |= REGION_TEST_LEFT_EXCLUSIVE; - } - - if (query & REGION_TEST_RIGHT_EXCLUSIVE && - !pixman_region32_equal(&intersection, (pixman_region32_t *)other_rgn)) { - res |= REGION_TEST_RIGHT_EXCLUSIVE; - } - - pixman_region32_fini(&intersection); - - return res; -} - - -static int rect_is_valid(const SpiceRect *r) -{ - if (r->top > r->bottom || r->left > r->right) { - printf("%s: invalid rect\n", __FUNCTION__); - return FALSE; - } - return TRUE; -} - -static void rect_set(SpiceRect *r, int32_t top, int32_t left, int32_t bottom, int32_t right) -{ - r->top = top; - r->left = left; - r->bottom = bottom; - r->right = right; - ASSERT(rect_is_valid(r)); -} - -static void random_region(QRegion *reg) -{ - int i; - int num_rects; - int x, y, w, h; - SpiceRect _r; - SpiceRect *r = &_r; - - region_clear(reg); - - num_rects = rand() % 20; - for (i = 0; i < num_rects; i++) { - x = rand()%100; - y = rand()%100; - w = rand()%100; - h = rand()%100; - rect_set(r, - x, y, - x+w, y+h); - region_add(reg, r); - } -} - -static void test(const QRegion *r1, const QRegion *r2, int *expected) -{ - printf("r1 is_empty %s [%s]\n", - region_is_empty(r1) ? "TRUE" : "FALSE", - (region_is_empty(r1) == *(expected++)) ? "OK" : "ERR"); - printf("r2 is_empty %s [%s]\n", - region_is_empty(r2) ? "TRUE" : "FALSE", - (region_is_empty(r2) == *(expected++)) ? "OK" : "ERR"); - printf("is_equal %s [%s]\n", - region_is_equal(r1, r2) ? "TRUE" : "FALSE", - (region_is_equal(r1, r2) == *(expected++)) ? "OK" : "ERR"); - printf("intersects %s [%s]\n", - region_intersects(r1, r2) ? "TRUE" : "FALSE", - (region_intersects(r1, r2) == *(expected++)) ? "OK" : "ERR"); - printf("contains %s [%s]\n", - region_contains(r1, r2) ? "TRUE" : "FALSE", - (region_contains(r1, r2) == *(expected++)) ? "OK" : "ERR"); -} - -enum { - EXPECT_R1_EMPTY, - EXPECT_R2_EMPTY, - EXPECT_EQUAL, - EXPECT_SECT, - EXPECT_CONT, -}; - -int main(void) -{ - QRegion _r1, _r2, _r3; - QRegion *r1 = &_r1; - QRegion *r2 = &_r2; - QRegion *r3 = &_r3; - SpiceRect _r; - SpiceRect *r = &_r; - int expected[5]; - int i, j; - - region_init(r1); - region_init(r2); - - printf("dump r1 empty rgn [%s]\n", region_is_valid(r1) ? "VALID" : "INVALID"); - region_dump(r1, ""); - expected[EXPECT_R1_EMPTY] = TRUE; - expected[EXPECT_R2_EMPTY] = TRUE; - expected[EXPECT_EQUAL] = TRUE; - expected[EXPECT_SECT] = FALSE; - expected[EXPECT_CONT] = TRUE; - test(r1, r2, expected); - printf("\n"); - - region_clone(r3, r1); - printf("dump r3 clone rgn [%s]\n", region_is_valid(r3) ? "VALID" : "INVALID"); - region_dump(r3, ""); - expected[EXPECT_R1_EMPTY] = TRUE; - expected[EXPECT_R2_EMPTY] = TRUE; - expected[EXPECT_EQUAL] = TRUE; - expected[EXPECT_SECT] = FALSE; - expected[EXPECT_CONT] = TRUE; - test(r1, r3, expected); - region_destroy(r3); - printf("\n"); - - rect_set(r, 0, 0, 100, 100); - region_add(r1, r); - printf("dump r1 [%s]\n", region_is_valid(r1) ? "VALID" : "INVALID"); - region_dump(r1, ""); - expected[EXPECT_R1_EMPTY] = FALSE; - expected[EXPECT_R2_EMPTY] = TRUE; - expected[EXPECT_EQUAL] = FALSE; - expected[EXPECT_SECT] = FALSE; - expected[EXPECT_CONT] = TRUE; - test(r1, r2, expected); - printf("\n"); - - region_clear(r1); - rect_set(r, 0, 0, 0, 0); - region_add(r1, r); - printf("dump r1 [%s]\n", region_is_valid(r1) ? "VALID" : "INVALID"); - region_dump(r1, ""); - expected[EXPECT_R1_EMPTY] = TRUE; - expected[EXPECT_R2_EMPTY] = TRUE; - expected[EXPECT_EQUAL] = TRUE; - expected[EXPECT_SECT] = FALSE; - expected[EXPECT_CONT] = TRUE; - test(r1, r2, expected); - printf("\n"); - - rect_set(r, -100, -100, 0, 0); - region_add(r1, r); - printf("dump r1 [%s]\n", region_is_valid(r1) ? "VALID" : "INVALID"); - region_dump(r1, ""); - expected[EXPECT_R1_EMPTY] = FALSE; - expected[EXPECT_R2_EMPTY] = TRUE; - expected[EXPECT_EQUAL] = FALSE; - expected[EXPECT_SECT] = FALSE; - expected[EXPECT_CONT] = TRUE; - test(r1, r2, expected); - printf("\n"); - - region_clear(r1); - rect_set(r, -100, -100, 100, 100); - region_add(r1, r); - printf("dump r1 [%s]\n", region_is_valid(r1) ? "VALID" : "INVALID"); - region_dump(r1, ""); - expected[EXPECT_R1_EMPTY] = FALSE; - expected[EXPECT_R2_EMPTY] = TRUE; - expected[EXPECT_EQUAL] = FALSE; - expected[EXPECT_SECT] = FALSE; - expected[EXPECT_CONT] = TRUE; - test(r1, r2, expected); - printf("\n"); - - - region_clear(r1); - region_clear(r2); - - rect_set(r, 100, 100, 200, 200); - region_add(r1, r); - printf("dump r1 [%s]\n", region_is_valid(r1) ? "VALID" : "INVALID"); - region_dump(r1, ""); - expected[EXPECT_R1_EMPTY] = FALSE; - expected[EXPECT_R2_EMPTY] = TRUE; - expected[EXPECT_EQUAL] = FALSE; - expected[EXPECT_SECT] = FALSE; - expected[EXPECT_CONT] = TRUE; - test(r1, r2, expected); - printf("\n"); - - rect_set(r, 300, 300, 400, 400); - region_add(r1, r); - printf("dump r1 [%s]\n", region_is_valid(r1) ? "VALID" : "INVALID"); - region_dump(r1, ""); - expected[EXPECT_R1_EMPTY] = FALSE; - expected[EXPECT_R2_EMPTY] = TRUE; - expected[EXPECT_EQUAL] = FALSE; - expected[EXPECT_SECT] = FALSE; - expected[EXPECT_CONT] = TRUE; - test(r1, r2, expected); - printf("\n"); - - rect_set(r, 500, 500, 600, 600); - region_add(r2, r); - printf("dump r2 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); - region_dump(r2, ""); - expected[EXPECT_R1_EMPTY] = FALSE; - expected[EXPECT_R2_EMPTY] = FALSE; - expected[EXPECT_EQUAL] = FALSE; - expected[EXPECT_SECT] = FALSE; - expected[EXPECT_CONT] = FALSE; - test(r1, r2, expected); - printf("\n"); - - region_clear(r2); - - rect_set(r, 100, 100, 200, 200); - region_add(r2, r); - rect_set(r, 300, 300, 400, 400); - region_add(r2, r); - printf("dump r2 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); - region_dump(r2, ""); - expected[EXPECT_R1_EMPTY] = FALSE; - expected[EXPECT_R2_EMPTY] = FALSE; - expected[EXPECT_EQUAL] = TRUE; - expected[EXPECT_SECT] = TRUE; - expected[EXPECT_CONT] = TRUE; - test(r1, r2, expected); - printf("\n"); - - region_clear(r2); - - rect_set(r, 100, 100, 200, 200); - region_add(r2, r); - printf("dump r2 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); - region_dump(r2, ""); - expected[EXPECT_R1_EMPTY] = FALSE; - expected[EXPECT_R2_EMPTY] = FALSE; - expected[EXPECT_EQUAL] = FALSE; - expected[EXPECT_SECT] = TRUE; - expected[EXPECT_CONT] = TRUE; - test(r1, r2, expected); - printf("\n"); - - region_clear(r2); - - rect_set(r, -2000, -2000, -1000, -1000); - region_add(r2, r); - printf("dump r2 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); - region_dump(r2, ""); - expected[EXPECT_R1_EMPTY] = FALSE; - expected[EXPECT_R2_EMPTY] = FALSE; - expected[EXPECT_EQUAL] = FALSE; - expected[EXPECT_SECT] = FALSE; - expected[EXPECT_CONT] = FALSE; - test(r1, r2, expected); - printf("\n"); - - region_clear(r2); - - rect_set(r, -2000, -2000, 1000, 1000); - region_add(r2, r); - printf("dump r2 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); - region_dump(r2, ""); - expected[EXPECT_R1_EMPTY] = FALSE; - expected[EXPECT_R2_EMPTY] = FALSE; - expected[EXPECT_EQUAL] = FALSE; - expected[EXPECT_SECT] = TRUE; - expected[EXPECT_CONT] = FALSE; - test(r1, r2, expected); - printf("\n"); - - region_clear(r2); - - rect_set(r, 150, 150, 175, 175); - region_add(r2, r); - printf("dump r2 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); - region_dump(r2, ""); - expected[EXPECT_R1_EMPTY] = FALSE; - expected[EXPECT_R2_EMPTY] = FALSE; - expected[EXPECT_EQUAL] = FALSE; - expected[EXPECT_SECT] = TRUE; - expected[EXPECT_CONT] = TRUE; - test(r1, r2, expected); - printf("\n"); - - region_clear(r2); - - rect_set(r, 150, 150, 350, 350); - region_add(r2, r); - printf("dump r2 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); - region_dump(r2, ""); - expected[EXPECT_R1_EMPTY] = FALSE; - expected[EXPECT_R2_EMPTY] = FALSE; - expected[EXPECT_EQUAL] = FALSE; - expected[EXPECT_SECT] = TRUE; - expected[EXPECT_CONT] = FALSE; - test(r1, r2, expected); - printf("\n"); - - region_and(r2, r1); - printf("dump r2 and r1 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); - region_dump(r2, ""); - expected[EXPECT_R1_EMPTY] = FALSE; - expected[EXPECT_R2_EMPTY] = FALSE; - expected[EXPECT_EQUAL] = FALSE; - expected[EXPECT_SECT] = TRUE; - expected[EXPECT_CONT] = FALSE; - test(r2, r1, expected); - printf("\n"); - - - region_clone(r3, r1); - printf("dump r3 clone rgn [%s]\n", region_is_valid(r3) ? "VALID" : "INVALID"); - region_dump(r3, ""); - expected[EXPECT_R1_EMPTY] = FALSE; - expected[EXPECT_R2_EMPTY] = FALSE; - expected[EXPECT_EQUAL] = TRUE; - expected[EXPECT_SECT] = TRUE; - expected[EXPECT_CONT] = TRUE; - test(r1, r3, expected); - printf("\n"); - - j = 0; - for (i = 0; i < 1000000; i++) { - int res1, res2, test; - int tests[] = { - REGION_TEST_LEFT_EXCLUSIVE, - REGION_TEST_RIGHT_EXCLUSIVE, - REGION_TEST_SHARED, - REGION_TEST_LEFT_EXCLUSIVE | REGION_TEST_RIGHT_EXCLUSIVE, - REGION_TEST_LEFT_EXCLUSIVE | REGION_TEST_SHARED, - REGION_TEST_RIGHT_EXCLUSIVE | REGION_TEST_SHARED, - REGION_TEST_LEFT_EXCLUSIVE | REGION_TEST_RIGHT_EXCLUSIVE | REGION_TEST_SHARED - }; - - random_region(r1); - random_region(r2); - - for (test = 0; test < 7; test++) { - res1 = region_test(r1, r2, tests[test]); - res2 = slow_region_test(r1, r2, tests[test]); - if (res1 != res2) { - printf ("Error in region_test %d, got %d, expected %d, query=%d\n", - j, res1, res2, tests[test]); - printf ("r1:\n"); - region_dump(r1, ""); - printf ("r2:\n"); - region_dump(r2, ""); - } - j++; - } - } - - region_destroy(r3); - region_destroy(r1); - region_destroy(r2); - - return 0; -} - -#endif - diff -Nru spice-gtk-0.9/common/region.h spice-gtk-0.12/common/region.h --- spice-gtk-0.9/common/region.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/region.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H_REGION -#define _H_REGION - -#include -#include "draw.h" -#include - -typedef pixman_region32_t QRegion; - -#define REGION_TEST_LEFT_EXCLUSIVE (1 << 0) -#define REGION_TEST_RIGHT_EXCLUSIVE (1 << 1) -#define REGION_TEST_SHARED (1 << 2) -#define REGION_TEST_ALL \ - (REGION_TEST_LEFT_EXCLUSIVE | REGION_TEST_RIGHT_EXCLUSIVE | REGION_TEST_SHARED) - -void region_init(QRegion *rgn); -void region_clear(QRegion *rgn); -void region_destroy(QRegion *rgn); -void region_clone(QRegion *dest, const QRegion *src); -SpiceRect *region_dup_rects(const QRegion *rgn, uint32_t *num_rects); -void region_ret_rects(const QRegion *rgn, SpiceRect *rects, uint32_t num_rects); - -int region_test(const QRegion *rgn, const QRegion *other_rgn, int query); -int region_is_valid(const QRegion *rgn); -int region_is_empty(const QRegion *rgn); -int region_is_equal(const QRegion *rgn1, const QRegion *rgn2); -int region_intersects(const QRegion *rgn1, const QRegion *rgn2); -int region_bounds_intersects(const QRegion *rgn1, const QRegion *rgn2); -int region_contains(const QRegion *rgn, const QRegion *other); -int region_contains_point(const QRegion *rgn, int32_t x, int32_t y); - -void region_or(QRegion *rgn, const QRegion *other_rgn); -void region_and(QRegion *rgn, const QRegion *other_rgn); -void region_xor(QRegion *rgn, const QRegion *other_rgn); -void region_exclude(QRegion *rgn, const QRegion *other_rgn); - -void region_add(QRegion *rgn, const SpiceRect *r); -void region_remove(QRegion *rgn, const SpiceRect *r); - -void region_offset(QRegion *rgn, int32_t dx, int32_t dy); - -void region_dump(const QRegion *rgn, const char *prefix); - -#endif - diff -Nru spice-gtk-0.9/common/ring.h spice-gtk-0.12/common/ring.h --- spice-gtk-0.9/common/ring.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/ring.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,153 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H_RING2 -#define _H_RING2 - -#include - -#ifndef ASSERT -# include -# define ASSERT(X) assert(X) -#endif - -typedef struct Ring RingItem; -typedef struct Ring { - RingItem *prev; - RingItem *next; -} Ring; - -static inline void ring_init(Ring *ring) -{ - ring->next = ring->prev = ring; -} - -static inline void ring_item_init(RingItem *item) -{ - item->next = item->prev = NULL; -} - -static inline int ring_item_is_linked(RingItem *item) -{ - return !!item->next; -} - -static inline int ring_is_empty(Ring *ring) -{ - ASSERT(ring->next != NULL && ring->prev != NULL); - return ring == ring->next; -} - -static inline void ring_add(Ring *ring, RingItem *item) -{ - ASSERT(ring->next != NULL && ring->prev != NULL); - ASSERT(item->next == NULL && item->prev == NULL); - - item->next = ring->next; - item->prev = ring; - ring->next = item->next->prev = item; -} - -static inline void ring_add_after(RingItem *item, RingItem *pos) -{ - ring_add(pos, item); -} - -static inline void ring_add_before(RingItem *item, RingItem *pos) -{ - ring_add(pos->prev, item); -} - -static inline void __ring_remove(RingItem *item) -{ - item->next->prev = item->prev; - item->prev->next = item->next; - item->prev = item->next = 0; -} - -static inline void ring_remove(RingItem *item) -{ - ASSERT(item->next != NULL && item->prev != NULL); - ASSERT(item->next != item); - - __ring_remove(item); -} - -static inline RingItem *ring_get_head(Ring *ring) -{ - RingItem *ret; - - ASSERT(ring->next != NULL && ring->prev != NULL); - - if (ring_is_empty(ring)) { - return NULL; - } - ret = ring->next; - return ret; -} - -static inline RingItem *ring_get_tail(Ring *ring) -{ - RingItem *ret; - - ASSERT(ring->next != NULL && ring->prev != NULL); - - if (ring_is_empty(ring)) { - return NULL; - } - ret = ring->prev; - return ret; -} - -static inline RingItem *ring_next(Ring *ring, RingItem *pos) -{ - RingItem *ret; - - ASSERT(ring->next != NULL && ring->prev != NULL); - ASSERT(pos); - ASSERT(pos->next != NULL && pos->prev != NULL); - ret = pos->next; - return (ret == ring) ? NULL : ret; -} - -static inline RingItem *ring_prev(Ring *ring, RingItem *pos) -{ - RingItem *ret; - - ASSERT(ring->next != NULL && ring->prev != NULL); - ASSERT(pos); - ASSERT(pos->next != NULL && pos->prev != NULL); - ret = pos->prev; - return (ret == ring) ? NULL : ret; -} - -static inline unsigned int ring_get_length(Ring *ring) -{ - RingItem *i; - unsigned int ret = 0; - - for (i = ring_get_head(ring); - i != NULL; - i = ring_next(ring, i)) - ret++; - - return ret; -} - -#endif - diff -Nru spice-gtk-0.9/common/rop3.c spice-gtk-0.12/common/rop3.c --- spice-gtk-0.9/common/rop3.c 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/rop3.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,657 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#include - -#include "rop3.h" - -#ifndef ASSERT -#define ASSERT(x) if (!(x)) { \ - printf("%s: ASSERT %s failed\n", __FUNCTION__, #x); \ - abort(); \ -} -#endif - -#ifndef WARN -#define WARN(x) printf("warning: %s\n", x) -#endif - -typedef void (*rop3_with_pattern_handler_t)(pixman_image_t *d, pixman_image_t *s, - SpicePoint *src_pos, pixman_image_t *p, - SpicePoint *pat_pos); - -typedef void (*rop3_with_color_handler_t)(pixman_image_t *d, pixman_image_t *s, - SpicePoint *src_pos, uint32_t rgb); - -typedef void (*rop3_test_handler_t)(); - -#define ROP3_NUM_OPS 256 - -static rop3_with_pattern_handler_t rop3_with_pattern_handlers_32[ROP3_NUM_OPS]; -static rop3_with_pattern_handler_t rop3_with_pattern_handlers_16[ROP3_NUM_OPS]; -static rop3_with_color_handler_t rop3_with_color_handlers_32[ROP3_NUM_OPS]; -static rop3_with_color_handler_t rop3_with_color_handlers_16[ROP3_NUM_OPS]; -static rop3_test_handler_t rop3_test_handlers_32[ROP3_NUM_OPS]; -static rop3_test_handler_t rop3_test_handlers_16[ROP3_NUM_OPS]; - - -static void default_rop3_with_pattern_handler(pixman_image_t *d, pixman_image_t *s, - SpicePoint *src_pos, pixman_image_t *p, - SpicePoint *pat_pos) -{ - WARN("not implemented 0x%x"); -} - -static void default_rop3_withe_color_handler(pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos, - uint32_t rgb) -{ - WARN("not implemented 0x%x"); -} - -static void default_rop3_test_handler() -{ -} - -#define ROP3_HANDLERS_DEPTH(name, formula, index, depth) \ -static void rop3_handle_p##depth##_##name(pixman_image_t *d, pixman_image_t *s, \ - SpicePoint *src_pos, \ - pixman_image_t *p, SpicePoint *pat_pos) \ -{ \ - int width = pixman_image_get_width(d); \ - int height = pixman_image_get_height(d); \ - uint8_t *dest_line = (uint8_t *)pixman_image_get_data(d); \ - int dest_stride = pixman_image_get_stride(d); \ - uint8_t *end_line = dest_line + height * dest_stride; \ - \ - int pat_width = pixman_image_get_width(p); \ - int pat_height = pixman_image_get_height(p); \ - uint8_t *pat_base = (uint8_t *)pixman_image_get_data(p); \ - int pat_stride = pixman_image_get_stride(p); \ - int pat_v_offset = pat_pos->y; \ - \ - int src_stride = pixman_image_get_stride(s); \ - uint8_t *src_line; \ - src_line = (uint8_t *)pixman_image_get_data(s) + src_pos->y * src_stride + (src_pos->x * depth / 8); \ - \ - for (; dest_line < end_line; dest_line += dest_stride, src_line += src_stride) { \ - uint##depth##_t *dest = (uint##depth##_t *)dest_line; \ - uint##depth##_t *end = dest + width; \ - uint##depth##_t *src = (uint##depth##_t *)src_line; \ - \ - int pat_h_offset = pat_pos->x; \ - \ - for (; dest < end; dest++, src++) { \ - uint##depth##_t *pat; \ - pat = (uint##depth##_t *) \ - (pat_base + pat_v_offset * pat_stride + (pat_h_offset * depth / 8)); \ - *dest = formula; \ - pat_h_offset = (pat_h_offset + 1) % pat_width; \ - } \ - \ - pat_v_offset = (pat_v_offset + 1) % pat_height; \ - } \ -} \ - \ -static void rop3_handle_c##depth##_##name(pixman_image_t *d, pixman_image_t *s, \ - SpicePoint *src_pos, \ - uint32_t rgb) \ -{ \ - int width = pixman_image_get_width(d); \ - int height = pixman_image_get_height(d); \ - uint8_t *dest_line = (uint8_t *)pixman_image_get_data(d); \ - int dest_stride = pixman_image_get_stride(d); \ - uint8_t *end_line = dest_line + height * dest_stride; \ - uint##depth##_t _pat = rgb; \ - uint##depth##_t *pat = &_pat; \ - \ - int src_stride = pixman_image_get_stride(s); \ - uint8_t *src_line; \ - src_line = (uint8_t *) \ - pixman_image_get_data(s) + src_pos->y * src_stride + (src_pos->x * depth / 8); \ - \ - for (; dest_line < end_line; dest_line += dest_stride, src_line += src_stride) { \ - uint##depth##_t *dest = (uint##depth##_t *)dest_line; \ - uint##depth##_t *end = dest + width; \ - uint##depth##_t *src = (uint##depth##_t *)src_line; \ - for (; dest < end; dest++, src++) { \ - *dest = formula; \ - } \ - } \ -} \ - \ -static void rop3_test##depth##_##name() \ -{ \ - uint8_t d = 0xaa; \ - uint8_t s = 0xcc; \ - uint8_t p = 0xf0; \ - uint8_t *pat = &p; \ - uint8_t *src = &s; \ - uint8_t *dest = &d; \ - \ - d = formula; \ - if (d != index) { \ - printf("%s: failed, result is 0x%x expect 0x%x\n", __FUNCTION__, d, index); \ - } \ -} - -#define ROP3_HANDLERS(name, formula, index) \ - ROP3_HANDLERS_DEPTH(name, formula, index, 32) \ - ROP3_HANDLERS_DEPTH(name, formula, index, 16) - -ROP3_HANDLERS(DPSoon, ~(*pat | *src | *dest), 0x01); -ROP3_HANDLERS(DPSona, ~(*pat | *src) & *dest, 0x02); -ROP3_HANDLERS(SDPona, ~(*pat | *dest) & *src, 0x04); -ROP3_HANDLERS(PDSxnon, ~(~(*src ^ *dest) | *pat), 0x06); -ROP3_HANDLERS(PDSaon, ~((*src & *dest) | *pat), 0x07); -ROP3_HANDLERS(SDPnaa, ~*pat & *dest & *src, 0x08); -ROP3_HANDLERS(PDSxon, ~((*src ^ *dest) | *pat), 0x09); -ROP3_HANDLERS(PSDnaon, ~((~*dest & *src) | *pat), 0x0b); -ROP3_HANDLERS(PDSnaon, ~((~*src & *dest) | *pat), 0x0d); -ROP3_HANDLERS(PDSonon, ~(~(*src | *dest) | *pat), 0x0e); -ROP3_HANDLERS(PDSona, ~(*src | *dest) & *pat, 0x10); -ROP3_HANDLERS(SDPxnon, ~(~(*pat ^ *dest) | *src), 0x12); -ROP3_HANDLERS(SDPaon, ~((*pat & *dest) | *src), 0x13); -ROP3_HANDLERS(DPSxnon, ~(~(*pat ^ *src) | *dest), 0x14); -ROP3_HANDLERS(DPSaon, ~((*pat & *src) | *dest), 0x15); -ROP3_HANDLERS(PSDPSanaxx, (~(*pat & *src) & *dest) ^ *src ^ *pat, 0x16); -ROP3_HANDLERS(SSPxDSxaxn, ~(((*src ^ *dest) & (*src ^ *pat)) ^ *src), 0x17); -ROP3_HANDLERS(SPxPDxa, (*src ^ *pat) & (*pat ^ *dest), 0x18); -ROP3_HANDLERS(SDPSanaxn, ~((~(*pat & *src) & *dest) ^ *src), 0x19); -ROP3_HANDLERS(PDSPaox, ((*pat & *src) | *dest) ^ *pat, 0x1a); -ROP3_HANDLERS(SDPSxaxn, ~(((*pat ^ *src) & *dest) ^ *src), 0x1b); -ROP3_HANDLERS(PSDPaox, ((*pat & *dest) | *src) ^ *pat, 0x1c); -ROP3_HANDLERS(DSPDxaxn, ~(((*pat ^ *dest) & *src) ^ *dest), 0x1d); -ROP3_HANDLERS(PDSox, (*dest | *src) ^ *pat, 0x1e); -ROP3_HANDLERS(PDSoan, ~((*src | *dest) & *pat), 0x1f); -ROP3_HANDLERS(DPSnaa, ~*src & *pat & *dest, 0x20); -ROP3_HANDLERS(SDPxon, ~((*pat ^ *dest) | *src), 0x21); -ROP3_HANDLERS(SPDnaon, ~((~*dest & *pat) | *src), 0x23); -ROP3_HANDLERS(SPxDSxa, (*src ^ *pat) & (*dest ^ *src), 0x24); -ROP3_HANDLERS(PDSPanaxn, ~((~(*src & *pat) & *dest) ^ *pat), 0x25); -ROP3_HANDLERS(SDPSaox, ((*src & *pat) | *dest) ^ *src, 0x26); -ROP3_HANDLERS(SDPSxnox, (~(*src ^ *pat) | *dest) ^ *src, 0x27); -ROP3_HANDLERS(DPSxa, (*pat ^ *src) & *dest, 0x28); -ROP3_HANDLERS(PSDPSaoxxn, ~(((*src & *pat) | *dest) ^ *src ^ *pat), 0x29); -ROP3_HANDLERS(DPSana, ~(*src & *pat) & *dest, 0x2a); -ROP3_HANDLERS(SSPxPDxaxn, ~(((*pat ^ *dest) & (*src ^ *pat)) ^ *src), 0x2b); -ROP3_HANDLERS(SPDSoax, ((*src | *dest) & *pat) ^ *src, 0x2c); -ROP3_HANDLERS(PSDnox, (~*dest | *src) ^ *pat, 0x2d); -ROP3_HANDLERS(PSDPxox, ((*pat ^ *dest) | *src) ^ *pat, 0x2e); -ROP3_HANDLERS(PSDnoan, ~((~*dest | *src) & *pat), 0x2f); -ROP3_HANDLERS(SDPnaon, ~((~*pat & *dest) | *src), 0x31); -ROP3_HANDLERS(SDPSoox, (*src | *pat | *dest) ^ *src, 0x32); -ROP3_HANDLERS(SPDSaox, ((*src & *dest) | *pat) ^ *src, 0x34); -ROP3_HANDLERS(SPDSxnox, (~(*src ^ *dest) | *pat) ^ *src, 0x35); -ROP3_HANDLERS(SDPox, (*pat | *dest) ^ *src, 0x36); -ROP3_HANDLERS(SDPoan, ~((*pat | *dest) & *src), 0x37); -ROP3_HANDLERS(PSDPoax, ((*pat | *dest) & *src) ^ *pat, 0x38); -ROP3_HANDLERS(SPDnox, (~*dest | *pat) ^ *src, 0x39); -ROP3_HANDLERS(SPDSxox, ((*src ^ *dest) | *pat) ^ *src, 0x3a); -ROP3_HANDLERS(SPDnoan, ~((~*dest | *pat) & *src), 0x3b); -ROP3_HANDLERS(SPDSonox, (~(*src | *dest) | *pat) ^ *src, 0x3d); -ROP3_HANDLERS(SPDSnaox, ((~*src & *dest) | *pat) ^ *src, 0x3e); -ROP3_HANDLERS(PSDnaa, ~*dest & *src & *pat, 0x40); -ROP3_HANDLERS(DPSxon, ~((*src ^ *pat) | *dest), 0x41); -ROP3_HANDLERS(SDxPDxa, (*src ^ *dest) & (*pat ^ *dest), 0x42); -ROP3_HANDLERS(SPDSanaxn, ~((~(*src & *dest) & *pat) ^ *src), 0x43); -ROP3_HANDLERS(DPSnaon, ~((~*src & *pat) | *dest), 0x45); -ROP3_HANDLERS(DSPDaox, ((*dest & *pat) | *src) ^ *dest, 0x46); -ROP3_HANDLERS(PSDPxaxn, ~(((*pat ^ *dest) & *src) ^ *pat), 0x47); -ROP3_HANDLERS(SDPxa, (*pat ^ *dest) & *src, 0x48); -ROP3_HANDLERS(PDSPDaoxxn, ~(((*dest & *pat) | *src) ^ *dest ^ *pat), 0x49); -ROP3_HANDLERS(DPSDoax, ((*dest | *src) & *pat) ^ *dest, 0x4a); -ROP3_HANDLERS(PDSnox, (~*src | *dest) ^ *pat, 0x4b); -ROP3_HANDLERS(SDPana, ~(*pat & *dest) & *src, 0x4c); -ROP3_HANDLERS(SSPxDSxoxn, ~(((*src ^ *dest) | (*src ^ *pat)) ^ *src), 0x4d); -ROP3_HANDLERS(PDSPxox, ((*pat ^ *src) | *dest) ^ *pat, 0x4e); -ROP3_HANDLERS(PDSnoan, ~((~*src | *dest) & *pat), 0x4f); -ROP3_HANDLERS(DSPnaon, ~((~*pat & *src) | *dest), 0x51); -ROP3_HANDLERS(DPSDaox, ((*dest & *src) | *pat) ^ *dest, 0x52); -ROP3_HANDLERS(SPDSxaxn, ~(((*src ^ *dest) & *pat) ^ *src), 0x53); -ROP3_HANDLERS(DPSonon, ~(~(*src | *pat) | *dest), 0x54); -ROP3_HANDLERS(DPSox, (*src | *pat) ^ *dest, 0x56); -ROP3_HANDLERS(DPSoan, ~((*src | *pat) & *dest), 0x57); -ROP3_HANDLERS(PDSPoax, ((*pat | *src) & *dest) ^ *pat, 0x58); -ROP3_HANDLERS(DPSnox, (~*src | *pat) ^ *dest, 0x59); -ROP3_HANDLERS(DPSDonox, (~(*dest | *src) | *pat) ^ *dest, 0x5b); -ROP3_HANDLERS(DPSDxox, ((*dest ^ *src) | *pat) ^ *dest, 0x5c); -ROP3_HANDLERS(DPSnoan, ~((~*src | *pat) & *dest), 0x5d); -ROP3_HANDLERS(DPSDnaox, ((~*dest & *src) | *pat) ^ *dest, 0x5e); -ROP3_HANDLERS(PDSxa, (*src ^ *dest) & *pat, 0x60); -ROP3_HANDLERS(DSPDSaoxxn, ~(((*src & *dest) | *pat) ^ *src ^ *dest), 0x61); -ROP3_HANDLERS(DSPDoax, ((*dest | *pat) & *src) ^ *dest, 0x62); -ROP3_HANDLERS(SDPnox, (~*pat | *dest) ^ *src, 0x63); -ROP3_HANDLERS(SDPSoax, ((*src | *pat) & *dest) ^ *src, 0x64); -ROP3_HANDLERS(DSPnox, (~*pat | *src) ^ *dest, 0x65); -ROP3_HANDLERS(SDPSonox, (~(*src | *pat) | *dest) ^ *src, 0x67); -ROP3_HANDLERS(DSPDSonoxxn, ~((~(*src | *dest) | *pat) ^ *src ^ *dest), 0x68); -ROP3_HANDLERS(PDSxxn, ~(*src ^ *dest ^ *pat), 0x69); -ROP3_HANDLERS(DPSax, (*src & *pat) ^ *dest, 0x6a); -ROP3_HANDLERS(PSDPSoaxxn, ~(((*src | *pat) & *dest) ^ *src ^ *pat), 0x6b); -ROP3_HANDLERS(SDPax, (*pat & *dest) ^ *src, 0x6c); -ROP3_HANDLERS(PDSPDoaxxn, ~(((*dest | *pat) & *src) ^ *dest ^ *pat), 0x6d); -ROP3_HANDLERS(SDPSnoax, ((~*src | *pat) & *dest) ^ *src, 0x6e); -ROP3_HANDLERS(PDSxnan, ~(~(*src ^ *dest) & *pat), 0x6f); -ROP3_HANDLERS(PDSana, ~(*src & *dest) & *pat, 0x70); -ROP3_HANDLERS(SSDxPDxaxn, ~(((*dest ^ *pat) & (*src ^ *dest)) ^ *src), 0x71); -ROP3_HANDLERS(SDPSxox, ((*src ^ *pat) | *dest) ^ *src, 0x72); -ROP3_HANDLERS(SDPnoan, ~((~*pat | *dest) & *src), 0x73); -ROP3_HANDLERS(DSPDxox, ((*dest ^ *pat) | *src) ^ *dest, 0x74); -ROP3_HANDLERS(DSPnoan, ~((~*pat | *src) & *dest), 0x75); -ROP3_HANDLERS(SDPSnaox, ((~*src & *pat) | *dest) ^ *src, 0x76); -ROP3_HANDLERS(PDSax, (*src & *dest) ^ *pat, 0x78); -ROP3_HANDLERS(DSPDSoaxxn, ~(((*src | *dest) & *pat) ^ *src ^ *dest), 0x79); -ROP3_HANDLERS(DPSDnoax, ((~*dest | *src) & *pat) ^ *dest, 0x7a); -ROP3_HANDLERS(SDPxnan, ~(~(*pat ^ *dest) & *src), 0x7b); -ROP3_HANDLERS(SPDSnoax, ((~*src | *dest) & *pat) ^ *src, 0x7c); -ROP3_HANDLERS(DPSxnan, ~(~(*src ^ *pat) & *dest), 0x7d); -ROP3_HANDLERS(SPxDSxo, (*src ^ *dest) | (*pat ^ *src), 0x7e); -ROP3_HANDLERS(DPSaan, ~(*src & *pat & *dest), 0x7f); -ROP3_HANDLERS(DPSaa, *src & *pat & *dest, 0x80); -ROP3_HANDLERS(SPxDSxon, ~((*src ^ *dest) | (*pat ^ *src)), 0x81); -ROP3_HANDLERS(DPSxna, ~(*src ^ *pat) & *dest, 0x82); -ROP3_HANDLERS(SPDSnoaxn, ~(((~*src | *dest) & *pat) ^ *src), 0x83); -ROP3_HANDLERS(SDPxna, ~(*pat ^ *dest) & *src, 0x84); -ROP3_HANDLERS(PDSPnoaxn, ~(((~*pat | *src) & *dest) ^ *pat), 0x85); -ROP3_HANDLERS(DSPDSoaxx, ((*src | *dest) & *pat) ^ *src ^ *dest, 0x86); -ROP3_HANDLERS(PDSaxn, ~((*src & *dest) ^ *pat), 0x87); -ROP3_HANDLERS(SDPSnaoxn, ~(((~*src & *pat) | *dest) ^ *src), 0x89); -ROP3_HANDLERS(DSPnoa, (~*pat | *src) & *dest, 0x8a); -ROP3_HANDLERS(DSPDxoxn, ~(((*dest ^ *pat) | *src) ^ *dest), 0x8b); -ROP3_HANDLERS(SDPnoa, (~*pat | *dest) & *src, 0x8c); -ROP3_HANDLERS(SDPSxoxn, ~(((*src ^ *pat) | *dest) ^ *src), 0x8d); -ROP3_HANDLERS(SSDxPDxax, ((*dest ^ *pat) & (*dest ^ *src)) ^ *src, 0x8e); -ROP3_HANDLERS(PDSanan, ~(~(*src & *dest) & *pat), 0x8f); -ROP3_HANDLERS(PDSxna, ~(*src ^ *dest) & *pat, 0x90); -ROP3_HANDLERS(SDPSnoaxn, ~(((~*src | *pat) & *dest) ^ *src), 0x91); -ROP3_HANDLERS(DPSDPoaxx, ((*pat | *dest) & *src) ^ *pat ^ *dest, 0x92); -ROP3_HANDLERS(SPDaxn, ~((*dest & *pat) ^ *src), 0x93); -ROP3_HANDLERS(PSDPSoaxx, ((*src | *pat) & *dest) ^ *src ^ *pat, 0x94); -ROP3_HANDLERS(DPSaxn, ~((*src & *pat) ^ *dest), 0x95); -ROP3_HANDLERS(DPSxx, *src ^ *pat ^ *dest, 0x96); -ROP3_HANDLERS(PSDPSonoxx, (~(*src | *pat) | *dest) ^ *src ^ *pat, 0x97); -ROP3_HANDLERS(SDPSonoxn, ~((~(*src | *pat) | *dest) ^ *src), 0x98); -ROP3_HANDLERS(DPSnax, (~*src & *pat) ^ *dest, 0x9a); -ROP3_HANDLERS(SDPSoaxn, ~(((*src | *pat) & *dest) ^ *src), 0x9b); -ROP3_HANDLERS(SPDnax, (~*dest & *pat) ^ *src, 0x9c); -ROP3_HANDLERS(DSPDoaxn, ~(((*dest | *pat) & *src) ^ *dest), 0x9d); -ROP3_HANDLERS(DSPDSaoxx, ((*src & *dest) | *pat) ^ *src ^ *dest, 0x9e); -ROP3_HANDLERS(PDSxan, ~((*src ^ *dest) & *pat), 0x9f); -ROP3_HANDLERS(PDSPnaoxn, ~(((~*pat & *src) | *dest) ^ *pat), 0xa1); -ROP3_HANDLERS(DPSnoa, (~*src | *pat) & *dest, 0xa2); -ROP3_HANDLERS(DPSDxoxn, ~(((*dest ^ *src) | *pat) ^ *dest), 0xa3); -ROP3_HANDLERS(PDSPonoxn, ~((~(*pat | *src) | *dest) ^ *pat), 0xa4); -ROP3_HANDLERS(DSPnax, (~*pat & *src) ^ *dest, 0xa6); -ROP3_HANDLERS(PDSPoaxn, ~(((*pat | *src) & *dest) ^ *pat), 0xa7); -ROP3_HANDLERS(DPSoa, (*src | *pat) & *dest, 0xa8); -ROP3_HANDLERS(DPSoxn, ~((*src | *pat) ^ *dest), 0xa9); -ROP3_HANDLERS(DPSono, ~(*src | *pat) | *dest, 0xab); -ROP3_HANDLERS(SPDSxax, ((*src ^ *dest) & *pat) ^ *src, 0xac); -ROP3_HANDLERS(DPSDaoxn, ~(((*dest & *src) | *pat) ^ *dest), 0xad); -ROP3_HANDLERS(DSPnao, (~*pat & *src) | *dest, 0xae); -ROP3_HANDLERS(PDSnoa, (~*src | *dest) & *pat, 0xb0); -ROP3_HANDLERS(PDSPxoxn, ~(((*pat ^ *src) | *dest) ^ *pat), 0xb1); -ROP3_HANDLERS(SSPxDSxox, ((*src ^ *dest) | (*pat ^ *src)) ^ *src, 0xb2); -ROP3_HANDLERS(SDPanan, ~(~(*pat & *dest) & *src), 0xb3); -ROP3_HANDLERS(PSDnax, (~*dest & *src) ^ *pat, 0xb4); -ROP3_HANDLERS(DPSDoaxn, ~(((*dest | *src) & *pat) ^ *dest), 0xb5); -ROP3_HANDLERS(DPSDPaoxx, ((*pat & *dest) | *src) ^ *pat ^ *dest, 0xb6); -ROP3_HANDLERS(SDPxan, ~((*pat ^ *dest) & *src), 0xb7); -ROP3_HANDLERS(PSDPxax, ((*dest ^ *pat) & *src) ^ *pat, 0xb8); -ROP3_HANDLERS(DSPDaoxn, ~(((*dest & *pat) | *src) ^ *dest), 0xb9); -ROP3_HANDLERS(DPSnao, (~*src & *pat) | *dest, 0xba); -ROP3_HANDLERS(SPDSanax, (~(*src & *dest) & *pat) ^ *src, 0xbc); -ROP3_HANDLERS(SDxPDxan, ~((*dest ^ *pat) & (*dest ^ *src)), 0xbd); -ROP3_HANDLERS(DPSxo, (*src ^ *pat) | *dest, 0xbe); -ROP3_HANDLERS(DPSano, ~(*src & *pat) | *dest, 0xbf); -ROP3_HANDLERS(SPDSnaoxn, ~(((~*src & *dest) | *pat) ^ *src), 0xc1); -ROP3_HANDLERS(SPDSonoxn, ~((~(*src | *dest) | *pat) ^ *src), 0xc2); -ROP3_HANDLERS(SPDnoa, (~*dest | *pat) & *src, 0xc4); -ROP3_HANDLERS(SPDSxoxn, ~(((*src ^ *dest) | *pat) ^ *src), 0xc5); -ROP3_HANDLERS(SDPnax, (~*pat & *dest) ^ *src, 0xc6); -ROP3_HANDLERS(PSDPoaxn, ~(((*pat | *dest) & *src) ^ *pat), 0xc7); -ROP3_HANDLERS(SDPoa, (*pat | *dest) & *src, 0xc8); -ROP3_HANDLERS(SPDoxn, ~((*dest | *pat) ^ *src), 0xc9); -ROP3_HANDLERS(DPSDxax, ((*dest ^ *src) & *pat) ^ *dest, 0xca); -ROP3_HANDLERS(SPDSaoxn, ~(((*src & *dest) | *pat) ^ *src), 0xcb); -ROP3_HANDLERS(SDPono, ~(*pat | *dest) | *src, 0xcd); -ROP3_HANDLERS(SDPnao, (~*pat & *dest) | *src, 0xce); -ROP3_HANDLERS(PSDnoa, (~*dest | *src) & *pat, 0xd0); -ROP3_HANDLERS(PSDPxoxn, ~(((*pat ^ *dest) | *src) ^ *pat), 0xd1); -ROP3_HANDLERS(PDSnax, (~*src & *dest) ^ *pat, 0xd2); -ROP3_HANDLERS(SPDSoaxn, ~(((*src | *dest) & *pat) ^ *src), 0xd3); -ROP3_HANDLERS(SSPxPDxax, ((*dest ^ *pat) & (*pat ^ *src)) ^ *src, 0xd4); -ROP3_HANDLERS(DPSanan, ~(~(*src & *pat) & *dest), 0xd5); -ROP3_HANDLERS(PSDPSaoxx, ((*src & *pat) | *dest) ^ *src ^ *pat, 0xd6); -ROP3_HANDLERS(DPSxan, ~((*src ^ *pat) & *dest), 0xd7); -ROP3_HANDLERS(PDSPxax, ((*pat ^ *src) & *dest) ^ *pat, 0xd8); -ROP3_HANDLERS(SDPSaoxn, ~(((*src & *pat) | *dest) ^ *src), 0xd9); -ROP3_HANDLERS(DPSDanax, (~(*dest & *src) & *pat) ^ *dest, 0xda); -ROP3_HANDLERS(SPxDSxan, ~((*src ^ *dest) & (*pat ^ *src)), 0xdb); -ROP3_HANDLERS(SPDnao, (~*dest & *pat) | *src, 0xdc); -ROP3_HANDLERS(SDPxo, (*pat ^ *dest) | *src, 0xde); -ROP3_HANDLERS(SDPano, ~(*pat & *dest) | *src, 0xdf); -ROP3_HANDLERS(PDSoa, (*src | *dest) & *pat, 0xe0); -ROP3_HANDLERS(PDSoxn, ~((*src | *dest) ^ *pat), 0xe1); -ROP3_HANDLERS(DSPDxax, ((*dest ^ *pat) & *src) ^ *dest, 0xe2); -ROP3_HANDLERS(PSDPaoxn, ~(((*pat & *dest) | *src) ^ *pat), 0xe3); -ROP3_HANDLERS(SDPSxax, ((*src ^ *pat) & *dest) ^ *src, 0xe4); -ROP3_HANDLERS(PDSPaoxn, ~(((*pat & *src) | *dest) ^ *pat), 0xe5); -ROP3_HANDLERS(SDPSanax, (~(*src & *pat) & *dest) ^ *src, 0xe6); -ROP3_HANDLERS(SPxPDxan, ~((*dest ^ *pat) & (*pat ^ *src)), 0xe7); -ROP3_HANDLERS(SSPxDSxax, ((*src ^ *dest) & (*pat ^ *src)) ^ *src, 0xe8); -ROP3_HANDLERS(DSPDSanaxxn, ~((~(*src & *dest) & *pat) ^ *src ^ *dest), 0xe9); -ROP3_HANDLERS(DPSao, (*src & *pat) | *dest, 0xea); -ROP3_HANDLERS(DPSxno, ~(*src ^ *pat) | *dest, 0xeb); -ROP3_HANDLERS(SDPao, (*pat & *dest) | *src, 0xec); -ROP3_HANDLERS(SDPxno, ~(*pat ^ *dest) | *src, 0xed); -ROP3_HANDLERS(SDPnoo, ~*pat | *dest | *src, 0xef); -ROP3_HANDLERS(PDSono, ~(*src | *dest) | *pat, 0xf1); -ROP3_HANDLERS(PDSnao, (~*src & *dest) | *pat, 0xf2); -ROP3_HANDLERS(PSDnao, (~*dest & *src) | *pat, 0xf4); -ROP3_HANDLERS(PDSxo, (*src ^ *dest) | *pat, 0xf6); -ROP3_HANDLERS(PDSano, ~(*src & *dest) | *pat, 0xf7); -ROP3_HANDLERS(PDSao, (*src & *dest) | *pat, 0xf8); -ROP3_HANDLERS(PDSxno, ~(*src ^ *dest) | *pat, 0xf9); -ROP3_HANDLERS(DPSnoo, ~*src | *pat | *dest, 0xfb); -ROP3_HANDLERS(PSDnoo, ~*dest | *src | *pat, 0xfd); -ROP3_HANDLERS(DPSoo, *src | *pat | *dest, 0xfe); - - -#define ROP3_FILL_HANDLERS(op, index) \ - rop3_with_pattern_handlers_32[index] = rop3_handle_p32_##op; \ - rop3_with_pattern_handlers_16[index] = rop3_handle_p16_##op; \ - rop3_with_color_handlers_32[index] = rop3_handle_c32_##op; \ - rop3_with_color_handlers_16[index] = rop3_handle_c16_##op; \ - rop3_test_handlers_32[index] = rop3_test32_##op; \ - rop3_test_handlers_16[index] = rop3_test16_##op; - -void rop3_init() -{ - static int need_init = 1; - int i; - - if (!need_init) { - return; - } - need_init = 0; - - for (i = 0; i < ROP3_NUM_OPS; i++) { - rop3_with_pattern_handlers_32[i] = default_rop3_with_pattern_handler; - rop3_with_pattern_handlers_16[i] = default_rop3_with_pattern_handler; - rop3_with_color_handlers_32[i] = default_rop3_withe_color_handler; - rop3_with_color_handlers_16[i] = default_rop3_withe_color_handler; - rop3_test_handlers_32[i] = default_rop3_test_handler; - rop3_test_handlers_16[i] = default_rop3_test_handler; - } - - ROP3_FILL_HANDLERS(DPSoon, 0x01); - ROP3_FILL_HANDLERS(DPSona, 0x02); - ROP3_FILL_HANDLERS(SDPona, 0x04); - ROP3_FILL_HANDLERS(PDSxnon, 0x06); - ROP3_FILL_HANDLERS(PDSaon, 0x07); - ROP3_FILL_HANDLERS(SDPnaa, 0x08); - ROP3_FILL_HANDLERS(PDSxon, 0x09); - ROP3_FILL_HANDLERS(PSDnaon, 0x0b); - ROP3_FILL_HANDLERS(PDSnaon, 0x0d); - ROP3_FILL_HANDLERS(PDSonon, 0x0e); - ROP3_FILL_HANDLERS(PDSona, 0x10); - ROP3_FILL_HANDLERS(SDPxnon, 0x12); - ROP3_FILL_HANDLERS(SDPaon, 0x13); - ROP3_FILL_HANDLERS(DPSxnon, 0x14); - ROP3_FILL_HANDLERS(DPSaon, 0x15); - ROP3_FILL_HANDLERS(PSDPSanaxx, 0x16); - ROP3_FILL_HANDLERS(SSPxDSxaxn, 0x17); - ROP3_FILL_HANDLERS(SPxPDxa, 0x18); - ROP3_FILL_HANDLERS(SDPSanaxn, 0x19); - ROP3_FILL_HANDLERS(PDSPaox, 0x1a); - ROP3_FILL_HANDLERS(SDPSxaxn, 0x1b); - ROP3_FILL_HANDLERS(PSDPaox, 0x1c); - ROP3_FILL_HANDLERS(DSPDxaxn, 0x1d); - ROP3_FILL_HANDLERS(PDSox, 0x1e); - ROP3_FILL_HANDLERS(PDSoan, 0x1f); - ROP3_FILL_HANDLERS(DPSnaa, 0x20); - ROP3_FILL_HANDLERS(SDPxon, 0x21); - ROP3_FILL_HANDLERS(SPDnaon, 0x23); - ROP3_FILL_HANDLERS(SPxDSxa, 0x24); - ROP3_FILL_HANDLERS(PDSPanaxn, 0x25); - ROP3_FILL_HANDLERS(SDPSaox, 0x26); - ROP3_FILL_HANDLERS(SDPSxnox, 0x27); - ROP3_FILL_HANDLERS(DPSxa, 0x28); - ROP3_FILL_HANDLERS(PSDPSaoxxn, 0x29); - ROP3_FILL_HANDLERS(DPSana, 0x2a); - ROP3_FILL_HANDLERS(SSPxPDxaxn, 0x2b); - ROP3_FILL_HANDLERS(SPDSoax, 0x2c); - ROP3_FILL_HANDLERS(PSDnox, 0x2d); - ROP3_FILL_HANDLERS(PSDPxox, 0x2e); - ROP3_FILL_HANDLERS(PSDnoan, 0x2f); - ROP3_FILL_HANDLERS(SDPnaon, 0x31); - ROP3_FILL_HANDLERS(SDPSoox, 0x32); - ROP3_FILL_HANDLERS(SPDSaox, 0x34); - ROP3_FILL_HANDLERS(SPDSxnox, 0x35); - ROP3_FILL_HANDLERS(SDPox, 0x36); - ROP3_FILL_HANDLERS(SDPoan, 0x37); - ROP3_FILL_HANDLERS(PSDPoax, 0x38); - ROP3_FILL_HANDLERS(SPDnox, 0x39); - ROP3_FILL_HANDLERS(SPDSxox, 0x3a); - ROP3_FILL_HANDLERS(SPDnoan, 0x3b); - ROP3_FILL_HANDLERS(SPDSonox, 0x3d); - ROP3_FILL_HANDLERS(SPDSnaox, 0x3e); - ROP3_FILL_HANDLERS(PSDnaa, 0x40); - ROP3_FILL_HANDLERS(DPSxon, 0x41); - ROP3_FILL_HANDLERS(SDxPDxa, 0x42); - ROP3_FILL_HANDLERS(SPDSanaxn, 0x43); - ROP3_FILL_HANDLERS(DPSnaon, 0x45); - ROP3_FILL_HANDLERS(DSPDaox, 0x46); - ROP3_FILL_HANDLERS(PSDPxaxn, 0x47); - ROP3_FILL_HANDLERS(SDPxa, 0x48); - ROP3_FILL_HANDLERS(PDSPDaoxxn, 0x49); - ROP3_FILL_HANDLERS(DPSDoax, 0x4a); - ROP3_FILL_HANDLERS(PDSnox, 0x4b); - ROP3_FILL_HANDLERS(SDPana, 0x4c); - ROP3_FILL_HANDLERS(SSPxDSxoxn, 0x4d); - ROP3_FILL_HANDLERS(PDSPxox, 0x4e); - ROP3_FILL_HANDLERS(PDSnoan, 0x4f); - ROP3_FILL_HANDLERS(DSPnaon, 0x51); - ROP3_FILL_HANDLERS(DPSDaox, 0x52); - ROP3_FILL_HANDLERS(SPDSxaxn, 0x53); - ROP3_FILL_HANDLERS(DPSonon, 0x54); - ROP3_FILL_HANDLERS(DPSox, 0x56); - ROP3_FILL_HANDLERS(DPSoan, 0x57); - ROP3_FILL_HANDLERS(PDSPoax, 0x58); - ROP3_FILL_HANDLERS(DPSnox, 0x59); - ROP3_FILL_HANDLERS(DPSDonox, 0x5b); - ROP3_FILL_HANDLERS(DPSDxox, 0x5c); - ROP3_FILL_HANDLERS(DPSnoan, 0x5d); - ROP3_FILL_HANDLERS(DPSDnaox, 0x5e); - ROP3_FILL_HANDLERS(PDSxa, 0x60); - ROP3_FILL_HANDLERS(DSPDSaoxxn, 0x61); - ROP3_FILL_HANDLERS(DSPDoax, 0x62); - ROP3_FILL_HANDLERS(SDPnox, 0x63); - ROP3_FILL_HANDLERS(SDPSoax, 0x64); - ROP3_FILL_HANDLERS(DSPnox, 0x65); - ROP3_FILL_HANDLERS(SDPSonox, 0x67); - ROP3_FILL_HANDLERS(DSPDSonoxxn, 0x68); - ROP3_FILL_HANDLERS(PDSxxn, 0x69); - ROP3_FILL_HANDLERS(DPSax, 0x6a); - ROP3_FILL_HANDLERS(PSDPSoaxxn, 0x6b); - ROP3_FILL_HANDLERS(SDPax, 0x6c); - ROP3_FILL_HANDLERS(PDSPDoaxxn, 0x6d); - ROP3_FILL_HANDLERS(SDPSnoax, 0x6e); - ROP3_FILL_HANDLERS(PDSxnan, 0x6f); - ROP3_FILL_HANDLERS(PDSana, 0x70); - ROP3_FILL_HANDLERS(SSDxPDxaxn, 0x71); - ROP3_FILL_HANDLERS(SDPSxox, 0x72); - ROP3_FILL_HANDLERS(SDPnoan, 0x73); - ROP3_FILL_HANDLERS(DSPDxox, 0x74); - ROP3_FILL_HANDLERS(DSPnoan, 0x75); - ROP3_FILL_HANDLERS(SDPSnaox, 0x76); - ROP3_FILL_HANDLERS(PDSax, 0x78); - ROP3_FILL_HANDLERS(DSPDSoaxxn, 0x79); - ROP3_FILL_HANDLERS(DPSDnoax, 0x7a); - ROP3_FILL_HANDLERS(SDPxnan, 0x7b); - ROP3_FILL_HANDLERS(SPDSnoax, 0x7c); - ROP3_FILL_HANDLERS(DPSxnan, 0x7d); - ROP3_FILL_HANDLERS(SPxDSxo, 0x7e); - ROP3_FILL_HANDLERS(DPSaan, 0x7f); - ROP3_FILL_HANDLERS(DPSaa, 0x80); - ROP3_FILL_HANDLERS(SPxDSxon, 0x81); - ROP3_FILL_HANDLERS(DPSxna, 0x82); - ROP3_FILL_HANDLERS(SPDSnoaxn, 0x83); - ROP3_FILL_HANDLERS(SDPxna, 0x84); - ROP3_FILL_HANDLERS(PDSPnoaxn, 0x85); - ROP3_FILL_HANDLERS(DSPDSoaxx, 0x86); - ROP3_FILL_HANDLERS(PDSaxn, 0x87); - ROP3_FILL_HANDLERS(SDPSnaoxn, 0x89); - ROP3_FILL_HANDLERS(DSPnoa, 0x8a); - ROP3_FILL_HANDLERS(DSPDxoxn, 0x8b); - ROP3_FILL_HANDLERS(SDPnoa, 0x8c); - ROP3_FILL_HANDLERS(SDPSxoxn, 0x8d); - ROP3_FILL_HANDLERS(SSDxPDxax, 0x8e); - ROP3_FILL_HANDLERS(PDSanan, 0x8f); - ROP3_FILL_HANDLERS(PDSxna, 0x90); - ROP3_FILL_HANDLERS(SDPSnoaxn, 0x91); - ROP3_FILL_HANDLERS(DPSDPoaxx, 0x92); - ROP3_FILL_HANDLERS(SPDaxn, 0x93); - ROP3_FILL_HANDLERS(PSDPSoaxx, 0x94); - ROP3_FILL_HANDLERS(DPSaxn, 0x95); - ROP3_FILL_HANDLERS(DPSxx, 0x96); - ROP3_FILL_HANDLERS(PSDPSonoxx, 0x97); - ROP3_FILL_HANDLERS(SDPSonoxn, 0x98); - ROP3_FILL_HANDLERS(DPSnax, 0x9a); - ROP3_FILL_HANDLERS(SDPSoaxn, 0x9b); - ROP3_FILL_HANDLERS(SPDnax, 0x9c); - ROP3_FILL_HANDLERS(DSPDoaxn, 0x9d); - ROP3_FILL_HANDLERS(DSPDSaoxx, 0x9e); - ROP3_FILL_HANDLERS(PDSxan, 0x9f); - ROP3_FILL_HANDLERS(PDSPnaoxn, 0xa1); - ROP3_FILL_HANDLERS(DPSnoa, 0xa2); - ROP3_FILL_HANDLERS(DPSDxoxn, 0xa3); - ROP3_FILL_HANDLERS(PDSPonoxn, 0xa4); - ROP3_FILL_HANDLERS(DSPnax, 0xa6); - ROP3_FILL_HANDLERS(PDSPoaxn, 0xa7); - ROP3_FILL_HANDLERS(DPSoa, 0xa8); - ROP3_FILL_HANDLERS(DPSoxn, 0xa9); - ROP3_FILL_HANDLERS(DPSono, 0xab); - ROP3_FILL_HANDLERS(SPDSxax, 0xac); - ROP3_FILL_HANDLERS(DPSDaoxn, 0xad); - ROP3_FILL_HANDLERS(DSPnao, 0xae); - ROP3_FILL_HANDLERS(PDSnoa, 0xb0); - ROP3_FILL_HANDLERS(PDSPxoxn, 0xb1); - ROP3_FILL_HANDLERS(SSPxDSxox, 0xb2); - ROP3_FILL_HANDLERS(SDPanan, 0xb3); - ROP3_FILL_HANDLERS(PSDnax, 0xb4); - ROP3_FILL_HANDLERS(DPSDoaxn, 0xb5); - ROP3_FILL_HANDLERS(DPSDPaoxx, 0xb6); - ROP3_FILL_HANDLERS(SDPxan, 0xb7); - ROP3_FILL_HANDLERS(PSDPxax, 0xb8); - ROP3_FILL_HANDLERS(DSPDaoxn, 0xb9); - ROP3_FILL_HANDLERS(DPSnao, 0xba); - ROP3_FILL_HANDLERS(SPDSanax, 0xbc); - ROP3_FILL_HANDLERS(SDxPDxan, 0xbd); - ROP3_FILL_HANDLERS(DPSxo, 0xbe); - ROP3_FILL_HANDLERS(DPSano, 0xbf); - ROP3_FILL_HANDLERS(SPDSnaoxn, 0xc1); - ROP3_FILL_HANDLERS(SPDSonoxn, 0xc2); - ROP3_FILL_HANDLERS(SPDnoa, 0xc4); - ROP3_FILL_HANDLERS(SPDSxoxn, 0xc5); - ROP3_FILL_HANDLERS(SDPnax, 0xc6); - ROP3_FILL_HANDLERS(PSDPoaxn, 0xc7); - ROP3_FILL_HANDLERS(SDPoa, 0xc8); - ROP3_FILL_HANDLERS(SPDoxn, 0xc9); - ROP3_FILL_HANDLERS(DPSDxax, 0xca); - ROP3_FILL_HANDLERS(SPDSaoxn, 0xcb); - ROP3_FILL_HANDLERS(SDPono, 0xcd); - ROP3_FILL_HANDLERS(SDPnao, 0xce); - ROP3_FILL_HANDLERS(PSDnoa, 0xd0); - ROP3_FILL_HANDLERS(PSDPxoxn, 0xd1); - ROP3_FILL_HANDLERS(PDSnax, 0xd2); - ROP3_FILL_HANDLERS(SPDSoaxn, 0xd3); - ROP3_FILL_HANDLERS(SSPxPDxax, 0xd4); - ROP3_FILL_HANDLERS(DPSanan, 0xd5); - ROP3_FILL_HANDLERS(PSDPSaoxx, 0xd6); - ROP3_FILL_HANDLERS(DPSxan, 0xd7); - ROP3_FILL_HANDLERS(PDSPxax, 0xd8); - ROP3_FILL_HANDLERS(SDPSaoxn, 0xd9); - ROP3_FILL_HANDLERS(DPSDanax, 0xda); - ROP3_FILL_HANDLERS(SPxDSxan, 0xdb); - ROP3_FILL_HANDLERS(SPDnao, 0xdc); - ROP3_FILL_HANDLERS(SDPxo, 0xde); - ROP3_FILL_HANDLERS(SDPano, 0xdf); - ROP3_FILL_HANDLERS(PDSoa, 0xe0); - ROP3_FILL_HANDLERS(PDSoxn, 0xe1); - ROP3_FILL_HANDLERS(DSPDxax, 0xe2); - ROP3_FILL_HANDLERS(PSDPaoxn, 0xe3); - ROP3_FILL_HANDLERS(SDPSxax, 0xe4); - ROP3_FILL_HANDLERS(PDSPaoxn, 0xe5); - ROP3_FILL_HANDLERS(SDPSanax, 0xe6); - ROP3_FILL_HANDLERS(SPxPDxan, 0xe7); - ROP3_FILL_HANDLERS(SSPxDSxax, 0xe8); - ROP3_FILL_HANDLERS(DSPDSanaxxn, 0xe9); - ROP3_FILL_HANDLERS(DPSao, 0xea); - ROP3_FILL_HANDLERS(DPSxno, 0xeb); - ROP3_FILL_HANDLERS(SDPao, 0xec); - ROP3_FILL_HANDLERS(SDPxno, 0xed); - ROP3_FILL_HANDLERS(SDPnoo, 0xef); - ROP3_FILL_HANDLERS(PDSono, 0xf1); - ROP3_FILL_HANDLERS(PDSnao, 0xf2); - ROP3_FILL_HANDLERS(PSDnao, 0xf4); - ROP3_FILL_HANDLERS(PDSxo, 0xf6); - ROP3_FILL_HANDLERS(PDSano, 0xf7); - ROP3_FILL_HANDLERS(PDSao, 0xf8); - ROP3_FILL_HANDLERS(PDSxno, 0xf9); - ROP3_FILL_HANDLERS(DPSnoo, 0xfb); - ROP3_FILL_HANDLERS(PSDnoo, 0xfd); - ROP3_FILL_HANDLERS(DPSoo, 0xfe); - - for (i = 0; i < ROP3_NUM_OPS; i++) { - rop3_test_handlers_32[i](); - rop3_test_handlers_16[i](); - } -} - -void do_rop3_with_pattern(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos, - pixman_image_t *p, SpicePoint *pat_pos) -{ - int bpp; - - bpp = spice_pixman_image_get_bpp(d); - ASSERT (bpp == spice_pixman_image_get_bpp(s)); - ASSERT (bpp == spice_pixman_image_get_bpp(p)); - - if (bpp == 32) { - rop3_with_pattern_handlers_32[rop3](d, s, src_pos, p, pat_pos); - } else { - rop3_with_pattern_handlers_16[rop3](d, s, src_pos, p, pat_pos); - } -} - -void do_rop3_with_color(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos, - uint32_t rgb) -{ - int bpp; - - bpp = spice_pixman_image_get_bpp(d); - ASSERT (bpp == spice_pixman_image_get_bpp(s)); - - if (bpp == 32) { - rop3_with_color_handlers_32[rop3](d, s, src_pos, rgb); - } else { - rop3_with_color_handlers_16[rop3](d, s, src_pos, rgb); - } -} diff -Nru spice-gtk-0.9/common/rop3.h spice-gtk-0.12/common/rop3.h --- spice-gtk-0.9/common/rop3.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/rop3.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H_ROP3 -#define _H_ROP3 - -#include - -#include "draw.h" -#include "pixman_utils.h" - -void do_rop3_with_pattern(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos, - pixman_image_t *p, SpicePoint *pat_pos); -void do_rop3_with_color(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos, - uint32_t rgb); - -void rop3_init(); -#endif - diff -Nru spice-gtk-0.9/common/ssl_verify.c spice-gtk-0.12/common/ssl_verify.c --- spice-gtk-0.9/common/ssl_verify.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/ssl_verify.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,474 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2011 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#include "mem.h" -#include "ssl_verify.h" - -#ifndef WIN32 -#include -#include -#include -#endif -#include -#include - -#ifndef SPICE_DEBUG -# define SPICE_DEBUG(format, ...) -#endif - -#ifdef WIN32 -static int inet_aton(const char* ip, struct in_addr* in_addr) -{ - unsigned long addr = inet_addr(ip); - - if (addr == INADDR_NONE) { - return 0; - } - in_addr->S_un.S_addr = addr; - return 1; -} -#endif - -static int verify_pubkey(X509* cert, const char *key, size_t key_size) -{ - EVP_PKEY* cert_pubkey = NULL; - EVP_PKEY* orig_pubkey = NULL; - BIO* bio = NULL; - int ret = 0; - - if (!key || key_size == 0) - return 0; - - if (!cert) { - SPICE_DEBUG("warning: no cert!"); - return 0; - } - - cert_pubkey = X509_get_pubkey(cert); - if (!cert_pubkey) { - SPICE_DEBUG("warning: reading public key from certificate failed"); - goto finish; - } - - bio = BIO_new_mem_buf((void*)key, key_size); - if (!bio) { - SPICE_DEBUG("creating BIO failed"); - goto finish; - } - - orig_pubkey = d2i_PUBKEY_bio(bio, NULL); - if (!orig_pubkey) { - SPICE_DEBUG("reading pubkey from bio failed"); - goto finish; - } - - ret = EVP_PKEY_cmp(orig_pubkey, cert_pubkey); - - if (ret == 1) - SPICE_DEBUG("public keys match"); - else if (ret == 0) - SPICE_DEBUG("public keys mismatch"); - else - SPICE_DEBUG("public keys types mismatch"); - -finish: - if (bio) - BIO_free(bio); - - if (orig_pubkey) - EVP_PKEY_free(orig_pubkey); - - if (cert_pubkey) - EVP_PKEY_free(cert_pubkey); - - return ret; -} - -/* from gnutls - * compare hostname against certificate, taking account of wildcards - * return 1 on success or 0 on error - * - * note: certnamesize is required as X509 certs can contain embedded NULs in - * the strings such as CN or subjectAltName - */ -static int _gnutls_hostname_compare(const char *certname, - size_t certnamesize, const char *hostname) -{ - /* find the first different character */ - for (; *certname && *hostname && toupper (*certname) == toupper (*hostname); - certname++, hostname++, certnamesize--) - ; - - /* the strings are the same */ - if (certnamesize == 0 && *hostname == '\0') - return 1; - - if (*certname == '*') - { - /* a wildcard certificate */ - - certname++; - certnamesize--; - - while (1) - { - /* Use a recursive call to allow multiple wildcards */ - if (_gnutls_hostname_compare (certname, certnamesize, hostname)) - return 1; - - /* wildcards are only allowed to match a single domain - component or component fragment */ - if (*hostname == '\0' || *hostname == '.') - break; - hostname++; - } - - return 0; - } - - return 0; -} - -/** - * From gnutls and spice red_peer.c - * TODO: switch to gnutls and get rid of this - * - * This function will check if the given certificate's subject matches - * the given hostname. This is a basic implementation of the matching - * described in RFC2818 (HTTPS), which takes into account wildcards, - * and the DNSName/IPAddress subject alternative name PKIX extension. - * - * Returns: 1 for a successful match, and 0 on failure. - **/ -static int verify_hostname(X509* cert, const char *hostname) -{ - GENERAL_NAMES* subject_alt_names; - int found_dns_name = 0; - struct in_addr addr; - int addr_len = 0; - int cn_match = 0; - - if (!cert) { - SPICE_DEBUG("warning: no cert!"); - return 0; - } - - // only IpV4 supported - if (inet_aton(hostname, &addr)) { - addr_len = sizeof(struct in_addr); - } - - /* try matching against: - * 1) a DNS name as an alternative name (subjectAltName) extension - * in the certificate - * 2) the common name (CN) in the certificate - * - * either of these may be of the form: *.domain.tld - * - * only try (2) if there is no subjectAltName extension of - * type dNSName - */ - - /* Check through all included subjectAltName extensions, comparing - * against all those of type dNSName. - */ - subject_alt_names = (GENERAL_NAMES*)X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL); - - if (subject_alt_names) { - int num_alts = sk_GENERAL_NAME_num(subject_alt_names); - int i; - for (i = 0; i < num_alts; i++) { - const GENERAL_NAME* name = sk_GENERAL_NAME_value(subject_alt_names, i); - if (name->type == GEN_DNS) { - found_dns_name = 1; - if (_gnutls_hostname_compare((char *)ASN1_STRING_data(name->d.dNSName), - ASN1_STRING_length(name->d.dNSName), - hostname)) { - SPICE_DEBUG("alt name match=%s", ASN1_STRING_data(name->d.dNSName)); - GENERAL_NAMES_free(subject_alt_names); - return 1; - } - } else if (name->type == GEN_IPADD) { - int alt_ip_len = ASN1_STRING_length(name->d.iPAddress); - found_dns_name = 1; - if ((addr_len == alt_ip_len)&& - !memcmp(ASN1_STRING_data(name->d.iPAddress), &addr, addr_len)) { - SPICE_DEBUG("alt name IP match=%s", - inet_ntoa(*((struct in_addr*)ASN1_STRING_data(name->d.dNSName)))); - GENERAL_NAMES_free(subject_alt_names); - return 1; - } - } - } - GENERAL_NAMES_free(subject_alt_names); - } - - if (found_dns_name) { - SPICE_DEBUG("warning: SubjectAltName mismatch"); - return 0; - } - - /* extracting commonNames */ - X509_NAME* subject = X509_get_subject_name(cert); - if (subject) { - int pos = -1; - X509_NAME_ENTRY* cn_entry; - ASN1_STRING* cn_asn1; - - while ((pos = X509_NAME_get_index_by_NID(subject, NID_commonName, pos)) != -1) { - cn_entry = X509_NAME_get_entry(subject, pos); - if (!cn_entry) { - continue; - } - cn_asn1 = X509_NAME_ENTRY_get_data(cn_entry); - if (!cn_asn1) { - continue; - } - - if (_gnutls_hostname_compare((char*)ASN1_STRING_data(cn_asn1), - ASN1_STRING_length(cn_asn1), - hostname)) { - SPICE_DEBUG("common name match=%s", (char*)ASN1_STRING_data(cn_asn1)); - cn_match = 1; - break; - } - } - } - - if (!cn_match) - SPICE_DEBUG("warning: common name mismatch"); - - return cn_match; -} - -X509_NAME* subject_to_x509_name(const char *subject, int *nentries) -{ - X509_NAME* in_subject; - const char *p; - char *key, *val, *k, *v = NULL; - int escape; - enum { - KEY, - VALUE - } state; - - key = (char*)alloca(strlen(subject)); - val = (char*)alloca(strlen(subject)); - in_subject = X509_NAME_new(); - - if (!in_subject || !key || !val) { - SPICE_DEBUG("failed to allocate"); - return NULL; - } - - *nentries = 0; - - k = key; - state = KEY; - for (p = subject;; ++p) { - escape = 0; - if (*p == '\\') { - ++p; - if (*p != '\\' && *p != ',') { - SPICE_DEBUG("Invalid character after \\"); - goto fail; - } - escape = 1; - } - - switch (state) { - case KEY: - if (*p == 0) { - if (k == key) /* empty key */ - goto success; - goto fail; - } else if (*p == '=' && !escape) { - state = VALUE; - *k = 0; - v = val; - } else - *k++ = *p; - break; - case VALUE: - if (*p == 0 || (*p == ',' && !escape)) { - if (v == val) /* empty value */ - goto fail; - - *v = 0; - - if (!X509_NAME_add_entry_by_txt(in_subject, key, - MBSTRING_UTF8, - (const unsigned char*)val, - strlen(val), -1, 0)) { - SPICE_DEBUG("warning: failed to add entry %s=%s to X509_NAME", - key, val); - goto fail; - } - *nentries += 1; - - if (*p == 0) - goto success; - - state = KEY; - k = key; - } else - *v++ = *p; - } - } - -success: - return in_subject; - -fail: - if (in_subject) - X509_NAME_free(in_subject); - - return NULL; -} - -int verify_subject(X509* cert, SpiceOpenSSLVerify* verify) -{ - X509_NAME *cert_subject = NULL; - int ret; - int in_entries; - - if (!cert) { - SPICE_DEBUG("warning: no cert!"); - return 0; - } - - cert_subject = X509_get_subject_name(cert); - if (!cert_subject) { - SPICE_DEBUG("warning: reading certificate subject failed"); - return 0; - } - - if (!verify->in_subject) { - verify->in_subject = subject_to_x509_name(verify->subject, &in_entries); - if (!verify->in_subject) { - SPICE_DEBUG("warning: no in_subject!"); - return 0; - } - } - - /* Note: this check is redundant with the pre-condition in X509_NAME_cmp */ - if (X509_NAME_entry_count(cert_subject) != in_entries) { - SPICE_DEBUG("subject mismatch: #entries cert=%d, input=%d", - X509_NAME_entry_count(cert_subject), in_entries); - return 0; - } - - ret = X509_NAME_cmp(cert_subject, verify->in_subject); - - if (ret == 0) - SPICE_DEBUG("subjects match"); - else - SPICE_DEBUG("subjects mismatch"); - - return !ret; -} - -static int openssl_verify(int preverify_ok, X509_STORE_CTX *ctx) -{ - int depth; - SpiceOpenSSLVerify *v; - SSL *ssl; - X509* cert; - - ssl = (SSL*)X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); - v = (SpiceOpenSSLVerify*)SSL_get_app_data(ssl); - - depth = X509_STORE_CTX_get_error_depth(ctx); - if (depth > 0) { - if (!preverify_ok) { - SPICE_DEBUG("openssl verify failed at depth=%d", depth); - v->all_preverify_ok = 0; - return 0; - } else - return 1; - } - - /* depth == 0 */ - cert = X509_STORE_CTX_get_current_cert(ctx); - if (!cert) { - SPICE_DEBUG("failed to get server certificate"); - return 0; - } - - if (v->verifyop & SPICE_SSL_VERIFY_OP_PUBKEY && - verify_pubkey(cert, v->pubkey, v->pubkey_size)) - return 1; - - if (!v->all_preverify_ok || !preverify_ok) - return 0; - - if (v->verifyop & SPICE_SSL_VERIFY_OP_HOSTNAME && - verify_hostname(cert, v->hostname)) - return 1; - - if (v->verifyop & SPICE_SSL_VERIFY_OP_SUBJECT && - verify_subject(cert, v)) - return 1; - - return 0; -} - -SpiceOpenSSLVerify* spice_openssl_verify_new(SSL *ssl, SPICE_SSL_VERIFY_OP verifyop, - const char *hostname, - const char *pubkey, size_t pubkey_size, - const char *subject) -{ - SpiceOpenSSLVerify *v; - - if (!verifyop) - return NULL; - - v = spice_new0(SpiceOpenSSLVerify, 1); - - v->ssl = ssl; - v->verifyop = verifyop; - v->hostname = spice_strdup(hostname); - v->pubkey = (char*)spice_memdup(pubkey, pubkey_size); - v->pubkey_size = pubkey_size; - v->subject = spice_strdup(subject); - - v->all_preverify_ok = 1; - - SSL_set_app_data(ssl, v); - SSL_set_verify(ssl, - SSL_VERIFY_PEER, openssl_verify); - - return v; -} - -void spice_openssl_verify_free(SpiceOpenSSLVerify* verify) -{ - if (!verify) - return; - - free(verify->pubkey); - free(verify->subject); - free(verify->hostname); - - if (verify->in_subject) - X509_NAME_free(verify->in_subject); - - if (verify->ssl) - SSL_set_app_data(verify->ssl, NULL); - free(verify); -} diff -Nru spice-gtk-0.9/common/ssl_verify.h spice-gtk-0.12/common/ssl_verify.h --- spice-gtk-0.9/common/ssl_verify.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/ssl_verify.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2011 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef __SSL_VERIFY_H -#define __SSL_VERIFY_H - -#include "ring.h" - -#include -#include -#include -#include -#include -#ifdef X509_NAME -/* wincrypt.h has already a different define... */ -#undef X509_NAME -#endif -#include - -typedef enum { - SPICE_SSL_VERIFY_OP_NONE = 0, - SPICE_SSL_VERIFY_OP_PUBKEY = (1 << 0), - SPICE_SSL_VERIFY_OP_HOSTNAME = (1 << 1), - SPICE_SSL_VERIFY_OP_SUBJECT = (1 << 2), -} SPICE_SSL_VERIFY_OP; - -typedef struct { - SSL *ssl; - SPICE_SSL_VERIFY_OP verifyop; - int all_preverify_ok; - char *hostname; - char *pubkey; - size_t pubkey_size; - char *subject; - X509_NAME *in_subject; -} SpiceOpenSSLVerify; - -SpiceOpenSSLVerify* spice_openssl_verify_new(SSL *ssl, SPICE_SSL_VERIFY_OP verifyop, - const char *hostname, - const char *pubkey, size_t pubkey_size, - const char *subject); -void spice_openssl_verify_free(SpiceOpenSSLVerify* verify); - -#endif diff -Nru spice-gtk-0.9/common/sw_canvas.c spice-gtk-0.12/common/sw_canvas.c --- spice-gtk-0.9/common/sw_canvas.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/common/sw_canvas.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1321 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#include -#include "sw_canvas.h" -#define CANVAS_USE_PIXMAN -#define CANVAS_SINGLE_INSTANCE -#include "canvas_base.c" -#include "rect.h" -#include "region.h" -#include "pixman_utils.h" - -typedef struct SwCanvas SwCanvas; - -struct SwCanvas { - CanvasBase base; - uint32_t *private_data; - int private_data_size; - pixman_image_t *image; -}; - -static pixman_image_t *canvas_get_pixman_brush(SwCanvas *canvas, - SpiceBrush *brush) -{ - switch (brush->type) { - case SPICE_BRUSH_TYPE_SOLID: { - uint32_t color = brush->u.color; - pixman_color_t c; - - c.blue = ((color & canvas->base.color_mask) * 0xffff) / canvas->base.color_mask; - color >>= canvas->base.color_shift; - c.green = ((color & canvas->base.color_mask) * 0xffff) / canvas->base.color_mask; - color >>= canvas->base.color_shift; - c.red = ((color & canvas->base.color_mask) * 0xffff) / canvas->base.color_mask; - c.alpha = 0xffff; - - return pixman_image_create_solid_fill(&c); - } - case SPICE_BRUSH_TYPE_PATTERN: { - SwCanvas *surface_canvas; - pixman_image_t* surface; - pixman_transform_t t; - - surface_canvas = (SwCanvas *)canvas_get_surface(&canvas->base, brush->u.pattern.pat); - if (surface_canvas) { - surface = surface_canvas->image; - surface = pixman_image_ref(surface); - } else { - surface = canvas_get_image(&canvas->base, brush->u.pattern.pat, FALSE); - } - pixman_transform_init_translate(&t, - pixman_int_to_fixed(-brush->u.pattern.pos.x), - pixman_int_to_fixed(-brush->u.pattern.pos.y)); - pixman_image_set_transform(surface, &t); - pixman_image_set_repeat(surface, PIXMAN_REPEAT_NORMAL); - return surface; - } - case SPICE_BRUSH_TYPE_NONE: - return NULL; - default: - spice_warn_if_reached(); - return NULL; - } - return NULL; -} - -static pixman_image_t *get_image(SpiceCanvas *canvas) -{ - SwCanvas *sw_canvas = (SwCanvas *)canvas; - - pixman_image_ref(sw_canvas->image); - - return sw_canvas->image; -} - -static void copy_region(SpiceCanvas *spice_canvas, - pixman_region32_t *dest_region, - int dx, int dy) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - pixman_box32_t *dest_rects; - int n_rects; - int i, j, end_line; - - dest_rects = pixman_region32_rectangles(dest_region, &n_rects); - - if (dy > 0) { - if (dx >= 0) { - /* south-east: copy x and y in reverse order */ - for (i = n_rects - 1; i >= 0; i--) { - spice_pixman_copy_rect(canvas->image, - dest_rects[i].x1 - dx, dest_rects[i].y1 - dy, - dest_rects[i].x2 - dest_rects[i].x1, - dest_rects[i].y2 - dest_rects[i].y1, - dest_rects[i].x1, dest_rects[i].y1); - } - } else { - /* south-west: Copy y in reverse order, but x in forward order */ - i = n_rects - 1; - - while (i >= 0) { - /* Copy all rects with same y in forward order */ - for (end_line = i - 1; - end_line >= 0 && dest_rects[end_line].y1 == dest_rects[i].y1; - end_line--) { - } - for (j = end_line + 1; j <= i; j++) { - spice_pixman_copy_rect(canvas->image, - dest_rects[j].x1 - dx, dest_rects[j].y1 - dy, - dest_rects[j].x2 - dest_rects[j].x1, - dest_rects[j].y2 - dest_rects[j].y1, - dest_rects[j].x1, dest_rects[j].y1); - } - i = end_line; - } - } - } else { - if (dx > 0) { - /* north-east: copy y in forward order, but x in reverse order */ - i = 0; - - while (i < n_rects) { - /* Copy all rects with same y in reverse order */ - for (end_line = i; - end_line < n_rects && dest_rects[end_line].y1 == dest_rects[i].y1; - end_line++) { - } - for (j = end_line - 1; j >= i; j--) { - spice_pixman_copy_rect(canvas->image, - dest_rects[j].x1 - dx, dest_rects[j].y1 - dy, - dest_rects[j].x2 - dest_rects[j].x1, - dest_rects[j].y2 - dest_rects[j].y1, - dest_rects[j].x1, dest_rects[j].y1); - } - i = end_line; - } - } else { - /* north-west: Copy x and y in forward order */ - for (i = 0; i < n_rects; i++) { - spice_pixman_copy_rect(canvas->image, - dest_rects[i].x1 - dx, dest_rects[i].y1 - dy, - dest_rects[i].x2 - dest_rects[i].x1, - dest_rects[i].y2 - dest_rects[i].y1, - dest_rects[i].x1, dest_rects[i].y1); - } - } - } -} - -static void fill_solid_spans(SpiceCanvas *spice_canvas, - SpicePoint *points, - int *widths, - int n_spans, - uint32_t color) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - int i; - - for (i = 0; i < n_spans; i++) { - spice_pixman_fill_rect(canvas->image, - points[i].x, points[i].y, - widths[i], - 1, - color); - } -} - -static void fill_solid_rects(SpiceCanvas *spice_canvas, - pixman_box32_t *rects, - int n_rects, - uint32_t color) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - int i; - - for (i = 0; i < n_rects; i++) { - spice_pixman_fill_rect(canvas->image, - rects[i].x1, rects[i].y1, - rects[i].x2 - rects[i].x1, - rects[i].y2 - rects[i].y1, - color); - } -} - -static void fill_solid_rects_rop(SpiceCanvas *spice_canvas, - pixman_box32_t *rects, - int n_rects, - uint32_t color, - SpiceROP rop) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - int i; - - for (i = 0; i < n_rects; i++) { - spice_pixman_fill_rect_rop(canvas->image, - rects[i].x1, rects[i].y1, - rects[i].x2 - rects[i].x1, - rects[i].y2 - rects[i].y1, - color, rop); - } -} - -static void __fill_tiled_rects(SpiceCanvas *spice_canvas, - pixman_box32_t *rects, - int n_rects, - pixman_image_t *tile, - int offset_x, int offset_y) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - int i; - - for (i = 0; i < n_rects; i++) { - spice_pixman_tile_rect(canvas->image, - rects[i].x1, rects[i].y1, - rects[i].x2 - rects[i].x1, - rects[i].y2 - rects[i].y1, - tile, offset_x, offset_y); - } -} - -static void fill_tiled_rects(SpiceCanvas *spice_canvas, - pixman_box32_t *rects, - int n_rects, - pixman_image_t *tile, - int offset_x, int offset_y) -{ - __fill_tiled_rects(spice_canvas, rects, n_rects, tile, offset_x, offset_y); -} - -static void fill_tiled_rects_from_surface(SpiceCanvas *spice_canvas, - pixman_box32_t *rects, - int n_rects, - SpiceCanvas *surface_canvas, - int offset_x, int offset_y) -{ - SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; - __fill_tiled_rects(spice_canvas, rects, n_rects, sw_surface_canvas->image, offset_x, - offset_y); -} - -static void __fill_tiled_rects_rop(SpiceCanvas *spice_canvas, - pixman_box32_t *rects, - int n_rects, - pixman_image_t *tile, - int offset_x, int offset_y, - SpiceROP rop) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - int i; - - for (i = 0; i < n_rects; i++) { - spice_pixman_tile_rect_rop(canvas->image, - rects[i].x1, rects[i].y1, - rects[i].x2 - rects[i].x1, - rects[i].y2 - rects[i].y1, - tile, offset_x, offset_y, - rop); - } -} -static void fill_tiled_rects_rop(SpiceCanvas *spice_canvas, - pixman_box32_t *rects, - int n_rects, - pixman_image_t *tile, - int offset_x, int offset_y, - SpiceROP rop) -{ - __fill_tiled_rects_rop(spice_canvas, rects, n_rects, tile, offset_x, offset_y, rop); -} - -static void fill_tiled_rects_rop_from_surface(SpiceCanvas *spice_canvas, - pixman_box32_t *rects, - int n_rects, - SpiceCanvas *surface_canvas, - int offset_x, int offset_y, - SpiceROP rop) -{ - SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; - __fill_tiled_rects_rop(spice_canvas, rects, n_rects, sw_surface_canvas->image, offset_x, - offset_y, rop); -} - -/* Some pixman implementations of OP_OVER on xRGB32 sets - the high bit to 0xff (which is the right value if the - destination was ARGB32, and it should be ignored for - xRGB32. However, this fills our alpha bits with - data that is not wanted or expected by windows, and its - causing us to send rgba images rather than rgb images to - the client. So, we manually clear these bytes. */ -static void clear_dest_alpha(pixman_image_t *dest, - int x, int y, - int width, int height) -{ - uint32_t *data; - int stride; - int w, h; - - w = pixman_image_get_width(dest); - h = pixman_image_get_height(dest); - - if (x + width <= 0 || x >= w || - y + height <= 0 || y >= h || - width == 0 || height == 0) { - return; - } - - if (x < 0) { - width += x; - x = 0; - } - if (x + width > w) { - width = w - x; - } - - if (y < 0) { - height += y; - y = 0; - } - if (y + height > h) { - height = h - y; - } - - stride = pixman_image_get_stride(dest); - data = (uint32_t *) ( - (uint8_t *)pixman_image_get_data(dest) + y * stride + 4 * x); - - if ((*data & 0xff000000U) == 0xff000000U) { - spice_pixman_fill_rect_rop(dest, - x, y, width, height, - 0x00ffffff, SPICE_ROP_AND); - } -} - -static void __blit_image(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - pixman_image_t *src_image, - int offset_x, int offset_y) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - pixman_box32_t *rects; - int n_rects, i; - - rects = pixman_region32_rectangles(region, &n_rects); - - for (i = 0; i < n_rects; i++) { - int src_x, src_y, dest_x, dest_y, width, height; - - dest_x = rects[i].x1; - dest_y = rects[i].y1; - width = rects[i].x2 - rects[i].x1; - height = rects[i].y2 - rects[i].y1; - - src_x = rects[i].x1 - offset_x; - src_y = rects[i].y1 - offset_y; - - spice_pixman_blit(canvas->image, - src_image, - src_x, src_y, - dest_x, dest_y, - width, height); - } -} - -static void blit_image(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - pixman_image_t *src_image, - int offset_x, int offset_y) -{ - __blit_image(spice_canvas, region, src_image, offset_x, offset_y); -} - -static void blit_image_from_surface(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - SpiceCanvas *surface_canvas, - int offset_x, int offset_y) -{ - SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; - __blit_image(spice_canvas, region, sw_surface_canvas->image, offset_x, offset_y); -} - -static void __blit_image_rop(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - pixman_image_t *src_image, - int offset_x, int offset_y, - SpiceROP rop) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - pixman_box32_t *rects; - int n_rects, i; - - rects = pixman_region32_rectangles(region, &n_rects); - - for (i = 0; i < n_rects; i++) { - int src_x, src_y, dest_x, dest_y, width, height; - - dest_x = rects[i].x1; - dest_y = rects[i].y1; - width = rects[i].x2 - rects[i].x1; - height = rects[i].y2 - rects[i].y1; - - src_x = rects[i].x1 - offset_x; - src_y = rects[i].y1 - offset_y; - - spice_pixman_blit_rop(canvas->image, - src_image, - src_x, src_y, - dest_x, dest_y, - width, height, rop); - } -} - -static void blit_image_rop(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - pixman_image_t *src_image, - int offset_x, int offset_y, - SpiceROP rop) -{ - __blit_image_rop(spice_canvas, region, src_image, offset_x, offset_y, rop); -} - -static void blit_image_rop_from_surface(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - SpiceCanvas *surface_canvas, - int offset_x, int offset_y, - SpiceROP rop) -{ - SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; - __blit_image_rop(spice_canvas, region, sw_surface_canvas->image, offset_x, offset_y, rop); -} - - - -static void __scale_image(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - pixman_image_t *src, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - pixman_transform_t transform; - pixman_fixed_t fsx, fsy; - - fsx = ((pixman_fixed_48_16_t) src_width * 65536) / dest_width; - fsy = ((pixman_fixed_48_16_t) src_height * 65536) / dest_height; - - pixman_image_set_clip_region32(canvas->image, region); - - pixman_transform_init_scale(&transform, fsx, fsy); - pixman_transform_translate(&transform, NULL, - pixman_int_to_fixed (src_x), - pixman_int_to_fixed (src_y)); - - pixman_image_set_transform(src, &transform); - pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE); - spice_return_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE || - scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST); - pixman_image_set_filter(src, - (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ? - PIXMAN_FILTER_NEAREST : PIXMAN_FILTER_GOOD, - NULL, 0); - - pixman_image_composite32(PIXMAN_OP_SRC, - src, NULL, canvas->image, - 0, 0, /* src */ - 0, 0, /* mask */ - dest_x, dest_y, /* dst */ - dest_width, dest_height); - - pixman_transform_init_identity(&transform); - pixman_image_set_transform(src, &transform); - - pixman_image_set_clip_region32(canvas->image, NULL); -} - -static void scale_image(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - pixman_image_t *src, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode) -{ - __scale_image(spice_canvas, region, src, src_x, src_y, src_width, src_height, dest_x, dest_y, - dest_width,dest_height,scale_mode); -} - -static void scale_image_from_surface(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - SpiceCanvas *surface_canvas, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode) -{ - SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; - __scale_image(spice_canvas, region, sw_surface_canvas->image, src_x, src_y, src_width, - src_height, dest_x, dest_y, dest_width,dest_height,scale_mode); -} - -static void __scale_image_rop(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - pixman_image_t *src, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode, SpiceROP rop) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - pixman_transform_t transform; - pixman_image_t *scaled; - pixman_box32_t *rects; - int n_rects, i; - pixman_fixed_t fsx, fsy; - - fsx = ((pixman_fixed_48_16_t) src_width * 65536) / dest_width; - fsy = ((pixman_fixed_48_16_t) src_height * 65536) / dest_height; - - scaled = pixman_image_create_bits(spice_pixman_image_get_format(src), - dest_width, - dest_height, - NULL, 0); - - pixman_region32_translate(region, -dest_x, -dest_y); - pixman_image_set_clip_region32(scaled, region); - - pixman_transform_init_scale(&transform, fsx, fsy); - pixman_transform_translate(&transform, NULL, - pixman_int_to_fixed (src_x), - pixman_int_to_fixed (src_y)); - - pixman_image_set_transform(src, &transform); - pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE); - spice_return_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE || - scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST); - pixman_image_set_filter(src, - (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ? - PIXMAN_FILTER_NEAREST : PIXMAN_FILTER_GOOD, - NULL, 0); - - pixman_image_composite32(PIXMAN_OP_SRC, - src, NULL, scaled, - 0, 0, /* src */ - 0, 0, /* mask */ - 0, 0, /* dst */ - dest_width, - dest_height); - - pixman_transform_init_identity(&transform); - pixman_image_set_transform(src, &transform); - - /* Translate back */ - pixman_region32_translate(region, dest_x, dest_y); - - rects = pixman_region32_rectangles(region, &n_rects); - - for (i = 0; i < n_rects; i++) { - spice_pixman_blit_rop(canvas->image, - scaled, - rects[i].x1 - dest_x, - rects[i].y1 - dest_y, - rects[i].x1, rects[i].y1, - rects[i].x2 - rects[i].x1, - rects[i].y2 - rects[i].y1, - rop); - } - - pixman_image_unref(scaled); -} - -static void scale_image_rop(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - pixman_image_t *src, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode, SpiceROP rop) -{ - __scale_image_rop(spice_canvas, region, src, src_x, src_y, src_width, src_height, dest_x, - dest_y, dest_width, dest_height, scale_mode, rop); -} - -static void scale_image_rop_from_surface(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - SpiceCanvas *surface_canvas, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode, SpiceROP rop) -{ - SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; - __scale_image_rop(spice_canvas, region, sw_surface_canvas->image, src_x, src_y, src_width, - src_height, dest_x, dest_y, dest_width, dest_height, scale_mode, rop); -} - -static pixman_image_t *canvas_get_as_surface(SwCanvas *canvas, - int with_alpha) -{ - pixman_image_t *target; - - if (with_alpha && - canvas->base.format == SPICE_SURFACE_FMT_32_xRGB) { - target = pixman_image_create_bits(PIXMAN_a8r8g8b8, - pixman_image_get_width(canvas->image), - pixman_image_get_height(canvas->image), - pixman_image_get_data(canvas->image), - pixman_image_get_stride(canvas->image)); - } else { - target = pixman_image_ref(canvas->image); - } - - return target; -} - -static void __blend_image(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - int dest_has_alpha, - pixman_image_t *src, - int src_x, int src_y, - int dest_x, int dest_y, - int width, int height, - int overall_alpha) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - pixman_image_t *mask, *dest; - - dest = canvas_get_as_surface(canvas, dest_has_alpha); - - pixman_image_set_clip_region32(dest, region); - - mask = NULL; - if (overall_alpha != 0xff) { - pixman_color_t color = { 0 }; - color.alpha = overall_alpha * 0x101; - mask = pixman_image_create_solid_fill(&color); - } - - pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE); - - pixman_image_composite32(PIXMAN_OP_OVER, - src, mask, dest, - src_x, src_y, /* src */ - 0, 0, /* mask */ - dest_x, dest_y, /* dst */ - width, - height); - - if (canvas->base.format == SPICE_SURFACE_FMT_32_xRGB && - !dest_has_alpha) { - clear_dest_alpha(dest, dest_x, dest_y, width, height); - } - - if (mask) { - pixman_image_unref(mask); - } - - pixman_image_set_clip_region32(dest, NULL); - pixman_image_unref(dest); -} - -static void blend_image(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - int dest_has_alpha, - pixman_image_t *src, - int src_x, int src_y, - int dest_x, int dest_y, - int width, int height, - int overall_alpha) -{ - __blend_image(spice_canvas, region, dest_has_alpha, src, src_x, src_y, - dest_x, dest_y, width, height, - overall_alpha); -} - -static void blend_image_from_surface(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - int dest_has_alpha, - SpiceCanvas *surface_canvas, - int src_has_alpha, - int src_x, int src_y, - int dest_x, int dest_y, - int width, int height, - int overall_alpha) -{ - SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; - pixman_image_t *src; - - src = canvas_get_as_surface(sw_surface_canvas, src_has_alpha); - __blend_image(spice_canvas, region, dest_has_alpha, - src, src_x, src_y, - dest_x, dest_y, - width, height, overall_alpha); - pixman_image_unref(src); -} - -static void __blend_scale_image(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - int dest_has_alpha, - pixman_image_t *src, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode, - int overall_alpha) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - pixman_transform_t transform; - pixman_image_t *mask, *dest; - pixman_fixed_t fsx, fsy; - - fsx = ((pixman_fixed_48_16_t) src_width * 65536) / dest_width; - fsy = ((pixman_fixed_48_16_t) src_height * 65536) / dest_height; - - dest = canvas_get_as_surface(canvas, dest_has_alpha); - - pixman_image_set_clip_region32(dest, region); - - pixman_transform_init_scale(&transform, fsx, fsy); - pixman_transform_translate(&transform, NULL, - pixman_int_to_fixed (src_x), - pixman_int_to_fixed (src_y)); - - mask = NULL; - if (overall_alpha != 0xff) { - pixman_color_t color = { 0 }; - color.alpha = overall_alpha * 0x101; - mask = pixman_image_create_solid_fill(&color); - } - - pixman_image_set_transform(src, &transform); - pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE); - spice_return_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE || - scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST); - pixman_image_set_filter(src, - (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ? - PIXMAN_FILTER_NEAREST : PIXMAN_FILTER_GOOD, - NULL, 0); - - pixman_image_composite32(PIXMAN_OP_OVER, - src, mask, dest, - 0, 0, /* src */ - 0, 0, /* mask */ - dest_x, dest_y, /* dst */ - dest_width, dest_height); - - if (canvas->base.format == SPICE_SURFACE_FMT_32_xRGB && - !dest_has_alpha) { - clear_dest_alpha(dest, dest_x, dest_y, dest_width, dest_height); - } - - pixman_transform_init_identity(&transform); - pixman_image_set_transform(src, &transform); - - if (mask) { - pixman_image_unref(mask); - } - - pixman_image_set_clip_region32(dest, NULL); - pixman_image_unref(dest); -} - -static void blend_scale_image(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - int dest_has_alpha, - pixman_image_t *src, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode, - int overall_alpha) -{ - __blend_scale_image(spice_canvas, region, dest_has_alpha, - src, src_x, src_y, src_width, src_height, - dest_x, dest_y, dest_width, dest_height, - scale_mode, overall_alpha); -} - -static void blend_scale_image_from_surface(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - int dest_has_alpha, - SpiceCanvas *surface_canvas, - int src_has_alpha, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - int scale_mode, - int overall_alpha) -{ - SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; - pixman_image_t *src; - - src = canvas_get_as_surface(sw_surface_canvas, src_has_alpha); - __blend_scale_image(spice_canvas, region, dest_has_alpha, src, src_x, src_y, src_width, - src_height, dest_x, dest_y, dest_width, dest_height, scale_mode, - overall_alpha); - pixman_image_unref(src); -} - -static void __colorkey_image(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - pixman_image_t *src_image, - int offset_x, int offset_y, - uint32_t transparent_color) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - pixman_box32_t *rects; - int n_rects, i; - - rects = pixman_region32_rectangles(region, &n_rects); - - for (i = 0; i < n_rects; i++) { - int src_x, src_y, dest_x, dest_y, width, height; - - dest_x = rects[i].x1; - dest_y = rects[i].y1; - width = rects[i].x2 - rects[i].x1; - height = rects[i].y2 - rects[i].y1; - - src_x = rects[i].x1 - offset_x; - src_y = rects[i].y1 - offset_y; - - spice_pixman_blit_colorkey(canvas->image, - src_image, - src_x, src_y, - dest_x, dest_y, - width, height, - transparent_color); - } -} - -static void colorkey_image(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - pixman_image_t *src_image, - int offset_x, int offset_y, - uint32_t transparent_color) -{ - __colorkey_image(spice_canvas, region, src_image, offset_x, offset_y, transparent_color); -} - -static void colorkey_image_from_surface(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - SpiceCanvas *surface_canvas, - int offset_x, int offset_y, - uint32_t transparent_color) -{ - SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; - __colorkey_image(spice_canvas, region, sw_surface_canvas->image, offset_x, offset_y, - transparent_color); -} - -static void __colorkey_scale_image(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - pixman_image_t *src, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - uint32_t transparent_color) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - pixman_transform_t transform; - pixman_image_t *scaled; - pixman_box32_t *rects; - int n_rects, i; - pixman_fixed_t fsx, fsy; - - fsx = ((pixman_fixed_48_16_t) src_width * 65536) / dest_width; - fsy = ((pixman_fixed_48_16_t) src_height * 65536) / dest_height; - - scaled = pixman_image_create_bits(spice_pixman_image_get_format (src), - dest_width, - dest_height, - NULL, 0); - - pixman_region32_translate(region, -dest_x, -dest_y); - pixman_image_set_clip_region32(scaled, region); - - pixman_transform_init_scale(&transform, fsx, fsy); - pixman_transform_translate(&transform, NULL, - pixman_int_to_fixed (src_x), - pixman_int_to_fixed (src_y)); - - pixman_image_set_transform(src, &transform); - pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE); - pixman_image_set_filter(src, - PIXMAN_FILTER_NEAREST, - NULL, 0); - - pixman_image_composite32(PIXMAN_OP_SRC, - src, NULL, scaled, - 0, 0, /* src */ - 0, 0, /* mask */ - 0, 0, /* dst */ - dest_width, - dest_height); - - pixman_transform_init_identity(&transform); - pixman_image_set_transform(src, &transform); - - /* Translate back */ - pixman_region32_translate(region, dest_x, dest_y); - - rects = pixman_region32_rectangles(region, &n_rects); - - for (i = 0; i < n_rects; i++) { - spice_pixman_blit_colorkey(canvas->image, - scaled, - rects[i].x1 - dest_x, - rects[i].y1 - dest_y, - rects[i].x1, rects[i].y1, - rects[i].x2 - rects[i].x1, - rects[i].y2 - rects[i].y1, - transparent_color); - } - - pixman_image_unref(scaled); -} - -static void colorkey_scale_image(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - pixman_image_t *src, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - uint32_t transparent_color) -{ - __colorkey_scale_image(spice_canvas, region, src, src_x, src_y, src_width, src_height, dest_x, - dest_y, dest_width, dest_height, transparent_color); -} - -static void colorkey_scale_image_from_surface(SpiceCanvas *spice_canvas, - pixman_region32_t *region, - SpiceCanvas *surface_canvas, - int src_x, int src_y, - int src_width, int src_height, - int dest_x, int dest_y, - int dest_width, int dest_height, - uint32_t transparent_color) -{ - SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; - __colorkey_scale_image(spice_canvas, region, sw_surface_canvas->image, src_x, src_y, - src_width, src_height, dest_x, dest_y, dest_width, dest_height, - transparent_color); -} - -static void canvas_put_image(SpiceCanvas *spice_canvas, -#ifdef WIN32 - HDC dc, -#endif - const SpiceRect *dest, const uint8_t *src_data, - uint32_t src_width, uint32_t src_height, int src_stride, - const QRegion *clip) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - pixman_image_t *src; - uint32_t dest_width; - uint32_t dest_height; - double sx, sy; - pixman_transform_t transform; - - src = pixman_image_create_bits(PIXMAN_x8r8g8b8, - src_width, - src_height, - (uint32_t*)src_data, - src_stride); - - - if (clip) { - pixman_image_set_clip_region32 (canvas->image, (pixman_region32_t *)clip); - } - - dest_width = dest->right - dest->left; - dest_height = dest->bottom - dest->top; - - if (dest_width != src_width || dest_height != src_height) { - sx = (double)(src_width) / (dest_width); - sy = (double)(src_height) / (dest_height); - - pixman_transform_init_scale(&transform, - pixman_double_to_fixed(sx), - pixman_double_to_fixed(sy)); - pixman_image_set_transform(src, &transform); - pixman_image_set_filter(src, - PIXMAN_FILTER_NEAREST, - NULL, 0); - } - - pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE); - - pixman_image_composite32(PIXMAN_OP_SRC, - src, NULL, canvas->image, - 0, 0, /* src */ - 0, 0, /* mask */ - dest->left, dest->top, /* dst */ - dest_width, dest_height); - - - if (clip) { - pixman_image_set_clip_region32(canvas->image, NULL); - } - pixman_image_unref(src); -} - - -static void canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox, - SpiceClip *clip, SpiceText *text) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - pixman_region32_t dest_region; - pixman_image_t *str_mask, *brush; - SpiceString *str; - SpicePoint pos = { 0, }; - int depth; - - pixman_region32_init_rect(&dest_region, - bbox->left, bbox->top, - bbox->right - bbox->left, - bbox->bottom - bbox->top); - - canvas_clip_pixman(&canvas->base, &dest_region, clip); - - if (!pixman_region32_not_empty(&dest_region)) { - touch_brush(&canvas->base, &text->fore_brush); - touch_brush(&canvas->base, &text->back_brush); - pixman_region32_fini(&dest_region); - return; - } - - if (!rect_is_empty(&text->back_area)) { - pixman_region32_t back_region; - - /* Nothing else makes sense for text and we should deprecate it - * and actually it means OVER really */ - spice_return_if_fail(text->fore_mode == SPICE_ROPD_OP_PUT); - - pixman_region32_init_rect(&back_region, - text->back_area.left, - text->back_area.top, - text->back_area.right - text->back_area.left, - text->back_area.bottom - text->back_area.top); - - pixman_region32_intersect(&back_region, &back_region, &dest_region); - - if (pixman_region32_not_empty(&back_region)) { - draw_brush(spice_canvas, &back_region, &text->back_brush, SPICE_ROP_COPY); - } - - pixman_region32_fini(&back_region); - } - str = (SpiceString *)SPICE_GET_ADDRESS(text->str); - - if (str->flags & SPICE_STRING_FLAGS_RASTER_A1) { - depth = 1; - } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A4) { - depth = 4; - } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A8) { - spice_warning("untested path A8 glyphs"); - depth = 8; - } else { - spice_warning("unsupported path vector glyphs"); - pixman_region32_fini (&dest_region); - return; - } - - brush = canvas_get_pixman_brush(canvas, &text->fore_brush); - - str_mask = canvas_get_str_mask(&canvas->base, str, depth, &pos); - if (brush) { - pixman_image_set_clip_region32(canvas->image, &dest_region); - - pixman_image_composite32(PIXMAN_OP_OVER, - brush, - str_mask, - canvas->image, - 0, 0, - 0, 0, - pos.x, pos.y, - pixman_image_get_width(str_mask), - pixman_image_get_height(str_mask)); - if (canvas->base.format == SPICE_SURFACE_FMT_32_xRGB) { - clear_dest_alpha(canvas->image, pos.x, pos.y, - pixman_image_get_width(str_mask), - pixman_image_get_height(str_mask)); - } - pixman_image_unref(brush); - - pixman_image_set_clip_region32(canvas->image, NULL); - } - pixman_image_unref(str_mask); - pixman_region32_fini(&dest_region); -} - -static void canvas_read_bits(SpiceCanvas *spice_canvas, uint8_t *dest, - int dest_stride, const SpiceRect *area) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - pixman_image_t* surface; - uint8_t *src; - int src_stride; - uint8_t *dest_end; - int bpp; - - spice_return_if_fail(canvas && area); - - surface = canvas->image; - - bpp = spice_pixman_image_get_bpp(surface) / 8; - - src_stride = pixman_image_get_stride(surface); - src = (uint8_t *)pixman_image_get_data(surface) + - area->top * src_stride + area->left * bpp; - dest_end = dest + (area->bottom - area->top) * dest_stride; - for (; dest != dest_end; dest += dest_stride, src += src_stride) { - memcpy(dest, src, (area->right - area->left) * bpp); - } -} - -static void canvas_clear(SpiceCanvas *spice_canvas) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - spice_pixman_fill_rect(canvas->image, - 0, 0, - pixman_image_get_width(canvas->image), - pixman_image_get_height(canvas->image), - 0); -} - -static void canvas_destroy(SpiceCanvas *spice_canvas) -{ - SwCanvas *canvas = (SwCanvas *)spice_canvas; - if (!canvas) { - return; - } - pixman_image_unref(canvas->image); - canvas_base_destroy(&canvas->base); - if (canvas->private_data) { - free(canvas->private_data); - } - free(canvas); -} - -static int need_init = 1; -static SpiceCanvasOps sw_canvas_ops; - -static SpiceCanvas *canvas_create_common(pixman_image_t *image, - uint32_t format -#ifdef SW_CANVAS_CACHE - , SpiceImageCache *bits_cache - , SpicePaletteCache *palette_cache -#elif defined(SW_CANVAS_IMAGE_CACHE) - , SpiceImageCache *bits_cache -#endif - , SpiceImageSurfaces *surfaces - , SpiceGlzDecoder *glz_decoder - , SpiceJpegDecoder *jpeg_decoder - , SpiceZlibDecoder *zlib_decoder - ) -{ - SwCanvas *canvas; - - if (need_init) { - return NULL; - } - spice_pixman_image_set_format(image, - spice_surface_format_to_pixman (format)); - - canvas = spice_new0(SwCanvas, 1); - canvas_base_init(&canvas->base, &sw_canvas_ops, - pixman_image_get_width (image), - pixman_image_get_height (image), - format -#ifdef SW_CANVAS_CACHE - , bits_cache - , palette_cache -#elif defined(SW_CANVAS_IMAGE_CACHE) - , bits_cache -#endif - , surfaces - , glz_decoder - , jpeg_decoder - , zlib_decoder - ); - canvas->private_data = NULL; - canvas->private_data_size = 0; - - canvas->image = image; - - return (SpiceCanvas *)canvas; -} - -SpiceCanvas *canvas_create(int width, int height, uint32_t format -#ifdef SW_CANVAS_CACHE - , SpiceImageCache *bits_cache - , SpicePaletteCache *palette_cache -#elif defined(SW_CANVAS_IMAGE_CACHE) - , SpiceImageCache *bits_cache -#endif - , SpiceImageSurfaces *surfaces - , SpiceGlzDecoder *glz_decoder - , SpiceJpegDecoder *jpeg_decoder - , SpiceZlibDecoder *zlib_decoder - ) -{ - pixman_image_t *image; - - image = pixman_image_create_bits(spice_surface_format_to_pixman (format), - width, height, NULL, 0); - - return canvas_create_common(image, format -#ifdef SW_CANVAS_CACHE - , bits_cache - , palette_cache -#elif defined(SW_CANVAS_IMAGE_CACHE) - , bits_cache -#endif - , surfaces - , glz_decoder - , jpeg_decoder - , zlib_decoder - ); -} - -SpiceCanvas *canvas_create_for_data(int width, int height, uint32_t format, - uint8_t *data, int stride -#ifdef SW_CANVAS_CACHE - , SpiceImageCache *bits_cache - , SpicePaletteCache *palette_cache -#elif defined(SW_CANVAS_IMAGE_CACHE) - , SpiceImageCache *bits_cache -#endif - , SpiceImageSurfaces *surfaces - , SpiceGlzDecoder *glz_decoder - , SpiceJpegDecoder *jpeg_decoder - , SpiceZlibDecoder *zlib_decoder - ) -{ - pixman_image_t *image; - - image = pixman_image_create_bits(spice_surface_format_to_pixman (format), - width, height, (uint32_t *)data, stride); - - return canvas_create_common(image, format -#ifdef SW_CANVAS_CACHE - , bits_cache - , palette_cache -#elif defined(SW_CANVAS_IMAGE_CACHE) - , bits_cache -#endif - , surfaces - , glz_decoder - , jpeg_decoder - , zlib_decoder - ); -} - -void sw_canvas_init() //unsafe global function -{ - if (!need_init) { - return; - } - need_init = 0; - - canvas_base_init_ops(&sw_canvas_ops); - sw_canvas_ops.draw_text = canvas_draw_text; - sw_canvas_ops.put_image = canvas_put_image; - sw_canvas_ops.clear = canvas_clear; - sw_canvas_ops.read_bits = canvas_read_bits; - sw_canvas_ops.destroy = canvas_destroy; - - sw_canvas_ops.fill_solid_spans = fill_solid_spans; - sw_canvas_ops.fill_solid_rects = fill_solid_rects; - sw_canvas_ops.fill_solid_rects_rop = fill_solid_rects_rop; - sw_canvas_ops.fill_tiled_rects = fill_tiled_rects; - sw_canvas_ops.fill_tiled_rects_from_surface = fill_tiled_rects_from_surface; - sw_canvas_ops.fill_tiled_rects_rop = fill_tiled_rects_rop; - sw_canvas_ops.fill_tiled_rects_rop_from_surface = fill_tiled_rects_rop_from_surface; - sw_canvas_ops.blit_image = blit_image; - sw_canvas_ops.blit_image_from_surface = blit_image_from_surface; - sw_canvas_ops.blit_image_rop = blit_image_rop; - sw_canvas_ops.blit_image_rop_from_surface = blit_image_rop_from_surface; - sw_canvas_ops.scale_image = scale_image; - sw_canvas_ops.scale_image_from_surface = scale_image_from_surface; - sw_canvas_ops.scale_image_rop = scale_image_rop; - sw_canvas_ops.scale_image_rop_from_surface = scale_image_rop_from_surface; - sw_canvas_ops.blend_image = blend_image; - sw_canvas_ops.blend_image_from_surface = blend_image_from_surface; - sw_canvas_ops.blend_scale_image = blend_scale_image; - sw_canvas_ops.blend_scale_image_from_surface = blend_scale_image_from_surface; - sw_canvas_ops.colorkey_image = colorkey_image; - sw_canvas_ops.colorkey_image_from_surface = colorkey_image_from_surface; - sw_canvas_ops.colorkey_scale_image = colorkey_scale_image; - sw_canvas_ops.colorkey_scale_image_from_surface = colorkey_scale_image_from_surface; - sw_canvas_ops.copy_region = copy_region; - sw_canvas_ops.get_image = get_image; - rop3_init(); -} diff -Nru spice-gtk-0.9/common/sw_canvas.h spice-gtk-0.12/common/sw_canvas.h --- spice-gtk-0.9/common/sw_canvas.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/common/sw_canvas.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H__CANVAS -#define _H__CANVAS - -#include - -#include "draw.h" -#include "pixman_utils.h" -#include "canvas_base.h" -#include "region.h" - -SpiceCanvas *canvas_create(int width, int height, uint32_t format -#ifdef SW_CANVAS_CACHE - , SpiceImageCache *bits_cache - , SpicePaletteCache *palette_cache -#elif defined(SW_CANVAS_IMAGE_CACHE) - , SpiceImageCache *bits_cache -#endif - , SpiceImageSurfaces *surfaces - , SpiceGlzDecoder *glz_decoder - , SpiceJpegDecoder *jpeg_decoder - , SpiceZlibDecoder *zlib_decoder - ); - -SpiceCanvas *canvas_create_for_data(int width, int height, uint32_t format, uint8_t *data, int stride -#ifdef SW_CANVAS_CACHE - , SpiceImageCache *bits_cache - , SpicePaletteCache *palette_cache -#elif defined(SW_CANVAS_IMAGE_CACHE) - , SpiceImageCache *bits_cache -#endif - , SpiceImageSurfaces *surfaces - , SpiceGlzDecoder *glz_decoder - , SpiceJpegDecoder *jpeg_decoder - , SpiceZlibDecoder *zlib_decoder - ); - - -void sw_canvas_init(); - -#endif diff -Nru spice-gtk-0.9/config.h.in spice-gtk-0.12/config.h.in --- spice-gtk-0.9/config.h.in 2012-01-31 10:22:59.000000000 +0000 +++ spice-gtk-0.12/config.h.in 2012-04-24 11:21:02.000000000 +0000 @@ -42,6 +42,10 @@ /* Define if you have a polkit with polkit_authority_get_sync() */ #undef HAVE_POLKIT_AUTHORITY_GET_SYNC +/* Define if you have a polkit with + polkit_authorization_result_get_dismissed() */ +#undef HAVE_POLKIT_AUTHORIZATION_RESULT_GET_DISMISSED + /* Have Quartz? */ #undef HAVE_QUARTZ @@ -145,6 +149,9 @@ /* Whether to use ucontext coroutine impl */ #undef WITH_UCONTEXT +/* Define if compiling with usb.ids support */ +#undef WITH_USBIDS + /* Whether to use fiber coroutine impl */ #undef WITH_WINFIBER @@ -162,3 +169,6 @@ # undef WORDS_BIGENDIAN # endif #endif + +/* enable compile-time and run-time bounds-checking, and some warnings */ +#undef _FORTIFY_SOURCE diff -Nru spice-gtk-0.9/configure spice-gtk-0.12/configure --- spice-gtk-0.9/configure 2012-01-31 10:22:58.000000000 +0000 +++ spice-gtk-0.12/configure 2012-04-24 11:21:01.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for spice-gtk 0.9. +# Generated by GNU Autoconf 2.68 for spice-gtk 0.12. # # Report bugs to . # @@ -630,8 +630,8 @@ # Identity of this package. PACKAGE_NAME='spice-gtk' PACKAGE_TARNAME='spice-gtk' -PACKAGE_VERSION='0.9' -PACKAGE_STRING='spice-gtk 0.9' +PACKAGE_VERSION='0.12' +PACKAGE_STRING='spice-gtk 0.12' PACKAGE_BUGREPORT='spice-devel@lists.freedesktop.org' PACKAGE_URL='' @@ -671,18 +671,22 @@ # include #endif" +enable_option_checking=no ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS AM_BACKSLASH -AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V SPICE_GTK_REQUIRES SPICE_GLIB_REQUIRES -SPICE_COMMON_SRCDIR SPICE_GTK_CFLAGS SPICE_GLIB_CFLAGS SPICE_CFLAGS +WARN_PYFLAGS +WARN_LDFLAGS +WARN_CFLAGS WITH_PYTHON_FALSE WITH_PYTHON_TRUE PYTHON_INCLUDES @@ -719,6 +723,7 @@ WITH_WINFIBER_TRUE WITH_UCONTEXT_FALSE WITH_UCONTEXT_TRUE +USB_IDS ACL_HELPER_DIR PIE_LDFLAGS PIE_CFLAGS @@ -728,10 +733,10 @@ ACL_LIBS POLKIT_LIBS POLKIT_CFLAGS -USBREDIR_LIBS -USBREDIR_CFLAGS WITH_USBREDIR_FALSE WITH_USBREDIR_TRUE +USBREDIR_LIBS +USBREDIR_CFLAGS SMARTCARD_LIBS SMARTCARD_CFLAGS WITH_SMARTCARD_FALSE @@ -789,14 +794,17 @@ CELT051_CFLAGS PIXMAN_LIBS PIXMAN_CFLAGS +COMMON_CFLAGS +subdirs LIBM -PROTOCOL_LIBS -PROTOCOL_CFLAGS OS_WIN32_FALSE OS_WIN32_TRUE HAVE_LD_VERSION_SCRIPT_FALSE HAVE_LD_VERSION_SCRIPT_TRUE PYTHON +STOW +SUPPORT_GL_FALSE +SUPPORT_GL_TRUE GTK_DOC_USE_REBASE_FALSE GTK_DOC_USE_REBASE_TRUE GTK_DOC_USE_LIBTOOL_FALSE @@ -855,6 +863,13 @@ INTLTOOL_KEYS_RULE INTLTOOL_DIRECTORY_RULE INTLTOOL_DESKTOP_RULE +intltool__v_merge_options_0 +intltool__v_merge_options_ +INTLTOOL_V_MERGE_OPTIONS +INTLTOOL__v_MERGE_0 +INTLTOOL__v_MERGE_ +INTLTOOL_V_MERGE +AM_DEFAULT_VERBOSITY INTLTOOL_EXTRACT INTLTOOL_MERGE INTLTOOL_UPDATE @@ -886,6 +901,7 @@ am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE +am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE @@ -996,6 +1012,7 @@ enable_polkit enable_pie with_usb_acl_helper_dir +with_usb_ids_path with_coroutine enable_introspection enable_vala @@ -1017,8 +1034,6 @@ PKG_CONFIG_LIBDIR GTKDOC_DEPS_CFLAGS GTKDOC_DEPS_LIBS -PROTOCOL_CFLAGS -PROTOCOL_LIBS PIXMAN_CFLAGS PIXMAN_LIBS CELT051_CFLAGS @@ -1050,8 +1065,9 @@ POLKIT_CFLAGS POLKIT_LIBS PYGTK_CFLAGS -PYGTK_LIBS' - +PYGTK_LIBS +PYTHON' +ac_subdirs_all='spice-common' # Initialize some variables set by options. ac_init_help= @@ -1593,7 +1609,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures spice-gtk 0.9 to adapt to many kinds of systems. +\`configure' configures spice-gtk 0.12 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1663,7 +1679,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of spice-gtk 0.9:";; + short | recursive ) echo "Configuration of spice-gtk 0.12:";; esac cat <<\_ACEOF @@ -1721,6 +1737,7 @@ --with-usb-acl-helper-dir=DIR Directory where the USB ACL helper binary should be installed + --with-usb-ids-path Specify the path to usb.ids [default=auto] --with-coroutine=[ucontext/gthread/winfiber/auto] use ucontext or GThread for coroutines [default=auto] @@ -1744,10 +1761,6 @@ C compiler flags for GTKDOC_DEPS, overriding pkg-config GTKDOC_DEPS_LIBS linker flags for GTKDOC_DEPS, overriding pkg-config - PROTOCOL_CFLAGS - C compiler flags for PROTOCOL, overriding pkg-config - PROTOCOL_LIBS - linker flags for PROTOCOL, overriding pkg-config PIXMAN_CFLAGS C compiler flags for PIXMAN, overriding pkg-config PIXMAN_LIBS linker flags for PIXMAN, overriding pkg-config @@ -1797,6 +1810,7 @@ PYGTK_CFLAGS C compiler flags for PYGTK, overriding pkg-config PYGTK_LIBS linker flags for PYGTK, overriding pkg-config + PYTHON the Python interpreter Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1864,7 +1878,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -spice-gtk configure 0.9 +spice-gtk configure 0.12 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2233,7 +2247,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by spice-gtk $as_me 0.9, which was +It was created by spice-gtk $as_me 0.12, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -3053,7 +3067,7 @@ # Define the identity of the package. PACKAGE='spice-gtk' - VERSION='0.9' + VERSION='0.12' cat >>confdefs.h <<_ACEOF @@ -3083,11 +3097,11 @@ # We need awk for the "check" target. The system "awk" is bad on # some platforms. -# Always define AMTAR for backward compatibility. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' @@ -3310,6 +3324,7 @@ if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' + am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= @@ -4123,6 +4138,7 @@ # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -4182,7 +4198,7 @@ break fi ;; - msvisualcpp | msvcmsys) + msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. @@ -11706,14 +11722,12 @@ ;; esac +INTLTOOL_REQUIRED_VERSION_AS_INT=`echo 0.40.0 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` +INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3` +INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` if test -n "0.40.0"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for intltool >= 0.40.0" >&5 $as_echo_n "checking for intltool >= 0.40.0... " >&6; } - - INTLTOOL_REQUIRED_VERSION_AS_INT=`echo 0.40.0 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` - INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3` - INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_APPLIED_VERSION found" >&5 $as_echo "$INTLTOOL_APPLIED_VERSION found" >&6; } test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || @@ -11844,25 +11858,48 @@ as_fn_error $? "The intltool scripts were not found. Please install intltool." "$LINENO" 5 fi - INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' -INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -p $(top_srcdir)/po $< $@' - INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' -INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< $@' - INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' +if test -z "$AM_DEFAULT_VERBOSITY"; then + AM_DEFAULT_VERBOSITY=1 +fi + + +INTLTOOL_V_MERGE='$(INTLTOOL__v_MERGE_$(V))' +INTLTOOL__v_MERGE_='$(INTLTOOL__v_MERGE_$(AM_DEFAULT_VERBOSITY))' +INTLTOOL__v_MERGE_0='@echo " ITMRG " $@;' + + + + +INTLTOOL_V_MERGE_OPTIONS='$(intltool__v_merge_options_$(V))' +intltool__v_merge_options_='$(intltool__v_merge_options_$(AM_DEFAULT_VERBOSITY))' +intltool__v_merge_options_0='-q' + + + + + INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' +INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -p $(top_srcdir)/po $< $@' + INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' +INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' +if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge 5000; then + INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u --no-translations $< $@' +else + INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)_it_tmp_dir=tmp.intltool.$$RANDOM && mkdir $$_it_tmp_dir && LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u $$_it_tmp_dir $< $@ && rmdir $$_it_tmp_dir' +fi + INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' @@ -12181,7 +12218,7 @@ if test $? -ne 0; then as_fn_error $? "perl 5.8.1 is required for intltool" "$LINENO" 5 else - IT_PERL_VERSION="`$INTLTOOL_PERL -e \"printf '%vd', $^V\"`" + IT_PERL_VERSION=`$INTLTOOL_PERL -e "printf '%vd', $^V"` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IT_PERL_VERSION" >&5 $as_echo "$IT_PERL_VERSION" >&6; } fi @@ -13401,8 +13438,15 @@ -# Define default SPICE_COMMON_SRCDIR -SPICE_COMMON_SRCDIR='$(top_srcdir)'/common +# no opengl support yet + if false; then + SUPPORT_GL_TRUE= + SUPPORT_GL_FALSE='#' +else + SUPPORT_GL_TRUE='#' + SUPPORT_GL_FALSE= +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -13957,6 +14001,7 @@ # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -14016,7 +14061,7 @@ break fi ;; - msvisualcpp | msvcmsys) + msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. @@ -14253,6 +14298,53 @@ fi +# Extract the first word of "stow", so it can be a program name with args. +set dummy stow; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STOW+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STOW"; then + ac_cv_prog_STOW="$STOW" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STOW="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_STOW" && ac_cv_prog_STOW="no" +fi +fi +STOW=$ac_cv_prog_STOW +if test -n "$STOW"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STOW" >&5 +$as_echo "$STOW" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test "x$STOW" = "xyes" && test -d /usr/local/stow; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: *** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME} ***" >&5 +$as_echo "$as_me: *** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME} ***" >&6;} + ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}" + +fi + + if test "x$CC" != xcc; then @@ -14750,99 +14842,6 @@ done - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PROTOCOL" >&5 -$as_echo_n "checking for PROTOCOL... " >&6; } - -if test -n "$PROTOCOL_CFLAGS"; then - pkg_cv_PROTOCOL_CFLAGS="$PROTOCOL_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"spice-protocol >= 0.10.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "spice-protocol >= 0.10.1") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_PROTOCOL_CFLAGS=`$PKG_CONFIG --cflags "spice-protocol >= 0.10.1" 2>/dev/null` -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$PROTOCOL_LIBS"; then - pkg_cv_PROTOCOL_LIBS="$PROTOCOL_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"spice-protocol >= 0.10.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "spice-protocol >= 0.10.1") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_PROTOCOL_LIBS=`$PKG_CONFIG --libs "spice-protocol >= 0.10.1" 2>/dev/null` -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - PROTOCOL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "spice-protocol >= 0.10.1" 2>&1` - else - PROTOCOL_PKG_ERRORS=`$PKG_CONFIG --print-errors "spice-protocol >= 0.10.1" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$PROTOCOL_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (spice-protocol >= 0.10.1) were not met: - -$PROTOCOL_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables PROTOCOL_CFLAGS -and PROTOCOL_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 - -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables PROTOCOL_CFLAGS -and PROTOCOL_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } - -else - PROTOCOL_CFLAGS=$pkg_cv_PROTOCOL_CFLAGS - PROTOCOL_LIBS=$pkg_cv_PROTOCOL_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - - LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) @@ -14977,20 +14976,15 @@ -srcdir="$(dirname $0)" -if test ! -e "$srcdir/gtk/generated_marshallers.c"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pyparsing python module" >&5 -$as_echo_n "checking for pyparsing python module... " >&6; } - echo "import pyparsing" | ${PYTHON} - >/dev/null 2>&1 - if test $? -ne 0 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - as_fn_error $? "pyparsing python module is required to compile this package" "$LINENO" 5 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } -fi + +subdirs="$subdirs spice-common" + +COMMON_CFLAGS='-I ${top_srcdir}/spice-common/ -I ${top_srcdir}/spice-common/spice-protocol/' + + + +srcdir="$(dirname $0)" if test ! -e "$srcdir/gtk/vncdisplaykeymap_osx2xtkbd.c"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Text::CSV Perl module" >&5 $as_echo_n "checking for Text::CSV Perl module... " >&6; } @@ -16724,14 +16718,7 @@ if test "x$enable_usbredir" = "xno"; then - if false; then - WITH_USBREDIR_TRUE= - WITH_USBREDIR_FALSE='#' -else - WITH_USBREDIR_TRUE='#' - WITH_USBREDIR_FALSE= -fi - + have_usbredir="no" else pkg_failed=no @@ -16742,12 +16729,12 @@ pkg_cv_USBREDIR_CFLAGS="$USBREDIR_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.3.3\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.3.3") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.4.2 libusbredirparser >= 0.4\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.4.2 libusbredirparser >= 0.4") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_USBREDIR_CFLAGS=`$PKG_CONFIG --cflags "gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.3.3" 2>/dev/null` + pkg_cv_USBREDIR_CFLAGS=`$PKG_CONFIG --cflags "gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.4.2 libusbredirparser >= 0.4" 2>/dev/null` else pkg_failed=yes fi @@ -16758,12 +16745,12 @@ pkg_cv_USBREDIR_LIBS="$USBREDIR_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.3.3\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.3.3") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.4.2 libusbredirparser >= 0.4\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.4.2 libusbredirparser >= 0.4") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_USBREDIR_LIBS=`$PKG_CONFIG --libs "gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.3.3" 2>/dev/null` + pkg_cv_USBREDIR_LIBS=`$PKG_CONFIG --libs "gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.4.2 libusbredirparser >= 0.4" 2>/dev/null` else pkg_failed=yes fi @@ -16783,9 +16770,9 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - USBREDIR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.3.3" 2>&1` + USBREDIR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.4.2 libusbredirparser >= 0.4" 2>&1` else - USBREDIR_PKG_ERRORS=`$PKG_CONFIG --print-errors "gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.3.3" 2>&1` + USBREDIR_PKG_ERRORS=`$PKG_CONFIG --print-errors "gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.4.2 libusbredirparser >= 0.4" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$USBREDIR_PKG_ERRORS" >&5 @@ -16810,7 +16797,8 @@ $as_echo "#define USE_USBREDIR 1" >>confdefs.h fi - if test "x$have_usbredir" = "xyes"; then +fi + if test "x$have_usbredir" = "xyes"; then WITH_USBREDIR_TRUE= WITH_USBREDIR_FALSE='#' else @@ -16818,7 +16806,6 @@ WITH_USBREDIR_FALSE= fi -fi # Check whether --enable-polkit was given. if test "${enable_polkit+set}" = set; then : @@ -17016,6 +17003,53 @@ #define HAVE_POLKIT_AUTHORITY_GET_SYNC $ac_have_pk_auth_get_sync _ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for polkit_authorization_result_get_dismissed in -lpolkit-gobject-1" >&5 +$as_echo_n "checking for polkit_authorization_result_get_dismissed in -lpolkit-gobject-1... " >&6; } +if ${ac_cv_lib_polkit_gobject_1_polkit_authorization_result_get_dismissed+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpolkit-gobject-1 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char polkit_authorization_result_get_dismissed (); +int +main () +{ +return polkit_authorization_result_get_dismissed (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_polkit_gobject_1_polkit_authorization_result_get_dismissed=yes +else + ac_cv_lib_polkit_gobject_1_polkit_authorization_result_get_dismissed=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_polkit_gobject_1_polkit_authorization_result_get_dismissed" >&5 +$as_echo "$ac_cv_lib_polkit_gobject_1_polkit_authorization_result_get_dismissed" >&6; } +if test "x$ac_cv_lib_polkit_gobject_1_polkit_authorization_result_get_dismissed" = xyes; then : + ac_have_pk_authorization_result_get_dismissed="1" +else + ac_have_pk_authorization_result_get_dismissed="0" +fi + + +cat >>confdefs.h <<_ACEOF +#define HAVE_POLKIT_AUTHORIZATION_RESULT_GET_DISMISSED $ac_have_pk_authorization_result_get_dismissed +_ACEOF + else if false; then WITH_POLKIT_TRUE= @@ -17084,6 +17118,35 @@ +# Check whether --with-usb-ids-path was given. +if test "${with_usb_ids_path+set}" = set; then : + withval=$with_usb_ids_path; USB_IDS="$with_usb_ids_path" +else + USB_IDS="auto" +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for usb.ids" >&5 +$as_echo_n "checking for usb.ids... " >&6; } +if test "x$USB_IDS" = "xauto"; then + if test -n "$PKG_CONFIG"; then + USB_IDS=$($PKG_CONFIG --variable=usbids usbutils) + else + USB_IDS= + fi +fi +if test -n "$USB_IDS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USB_IDS" >&5 +$as_echo "$USB_IDS" >&6; } + + +$as_echo "#define WITH_USBIDS 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } +fi + + # Check whether --with-coroutine was given. if test "${with_coroutine+set}" = set; then : withval=$with_coroutine; @@ -17251,6 +17314,7 @@ else found_introspection=no fi + enable_introspection=$found_introspection ;; #( *) : as_fn_error $? "invalid argument passed to --enable-introspection, should be one of [no/auto/yes]" "$LINENO" 5 @@ -17558,9 +17622,11 @@ + + # Find any Python interpreter. if test -z "$PYTHON"; then - for ac_prog in python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 + for ac_prog in python python2 python3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -17648,7 +17714,7 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 $as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } if ${am_cv_python_pythondir+:} false; then : $as_echo_n "(cached) " >&6 @@ -17659,8 +17725,7 @@ else am_py_prefix=$prefix fi - am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null || - echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null` case $am_cv_python_pythondir in $am_py_prefix*) am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` @@ -17686,7 +17751,7 @@ pkgpythondir=\${pythondir}/$PACKAGE - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 $as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } if ${am_cv_python_pyexecdir+:} false; then : $as_echo_n "(cached) " >&6 @@ -17697,8 +17762,7 @@ else am_py_exec_prefix=$exec_prefix fi - am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null || - echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null` case $am_cv_python_pyexecdir in $am_py_exec_prefix*) am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` @@ -17806,119 +17870,1008 @@ - - - - -MAYBE_WARN="-Wall -Wno-sign-compare -Wno-deprecated-declarations" - -# Check whether --enable-werror was given. + # Check whether --enable-werror was given. if test "${enable_werror+set}" = set; then : enableval=$enable_werror; set_werror="$enableval" else if test -d $srcdir/.git; then - is_git_version=true - set_werror=yes - else - set_werror=no - fi -fi - - -# invalidate cached value if MAYBE_WARN has changed -if test "x$spice_cv_warn_maybe" != "x$MAYBE_WARN"; then - unset spice_cv_warn_cflags -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for supported warning flags" >&5 -$as_echo_n "checking for supported warning flags... " >&6; } -if ${spice_cv_warn_cflags+:} false; then : + is_git_version=true + set_werror=yes + else + set_werror=no + fi +fi + + + # List of warnings that are not relevant / wanted + + # Don't care about C++ compiler compat + dontwarn="$dontwarn -Wc++-compat" + dontwarn="$dontwarn -Wabi" + dontwarn="$dontwarn -Wdeprecated" + # Don't care about ancient C standard compat + dontwarn="$dontwarn -Wtraditional" + # Don't care about ancient C standard compat + dontwarn="$dontwarn -Wtraditional-conversion" + # Ignore warnings in /usr/include + dontwarn="$dontwarn -Wsystem-headers" + # Happy for compiler to add struct padding + dontwarn="$dontwarn -Wpadded" + # GCC very confused with -O2 + dontwarn="$dontwarn -Wunreachable-code" + + + dontwarn="$dontwarn -Wconversion" + dontwarn="$dontwarn -Wsign-conversion" + dontwarn="$dontwarn -Wvla" + dontwarn="$dontwarn -Wundef" + dontwarn="$dontwarn -Wcast-qual" + dontwarn="$dontwarn -Wlong-long" + dontwarn="$dontwarn -Wswitch-default" + dontwarn="$dontwarn -Wswitch-enum" + dontwarn="$dontwarn -Wstrict-overflow" + dontwarn="$dontwarn -Wunsafe-loop-optimizations" + dontwarn="$dontwarn -Wformat-nonliteral" + dontwarn="$dontwarn -Wfloat-equal" + dontwarn="$dontwarn -Wdeclaration-after-statement" + dontwarn="$dontwarn -Wcast-qual" + dontwarn="$dontwarn -Wconversion" + dontwarn="$dontwarn -Wsign-conversion" + dontwarn="$dontwarn -Wpacked" + dontwarn="$dontwarn -Wunused-macros" + dontwarn="$dontwarn -Woverlength-strings" + dontwarn="$dontwarn -Wstack-protector" + dontwarn="$dontwarn -Winline" + dontwarn="$dontwarn -Wbad-function-cast" + dontwarn="$dontwarn -Wshadow" + + # We want to enable thse, but need to sort out the + # decl mess with gtk/generated_*.c + dontwarn="$dontwarn -Wmissing-prototypes" + dontwarn="$dontwarn -Wmissing-declarations" + + # Get all possible GCC warnings + + + if test -n "$GCC"; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Wno-missing-field-initializers is supported" >&5 +$as_echo_n "checking whether -Wno-missing-field-initializers is supported... " >&6; } + if ${gl_cv_cc_nomfi_supported+:} false; then : $as_echo_n "(cached) " >&6 else - echo - WARN_CFLAGS="" - - # Some warning options are not supported by all versions of - # gcc, so test all desired options against the current - # compiler. - # - # Note that there are some order dependencies - # here. Specifically, an option that disables a warning will - # have no net effect if a later option then enables that - # warnings, (perhaps implicitly). So we put some grouped - # options (-Wall and -Wextra) up front and the -Wno options - # last. - - for W in $MAYBE_WARN; do - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $W" >&5 -$as_echo_n "checking whether $CC supports $W... " >&6; } - - spice_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $W" - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +int +main () +{ + + ; + return 0; +} _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - spice_cc_flag=yes + gl_cv_cc_nomfi_supported=yes else - spice_cc_flag=no + gl_cv_cc_nomfi_supported=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$spice_save_CFLAGS" - - if test "x$spice_cc_flag" = "xyes"; then - WARN_CFLAGS="$WARN_CFLAGS $W" - else - : - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $spice_cc_flag" >&5 -$as_echo "$spice_cc_flag" >&6; } - - done - if test "$set_werror" != "no"; then + CFLAGS="$gl_save_CFLAGS" +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports \"-Werror\"" >&5 -$as_echo_n "checking whether $CC supports \"-Werror\"... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_nomfi_supported" >&5 +$as_echo "$gl_cv_cc_nomfi_supported" >&6; } - spice_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS "-Werror"" + if test "$gl_cv_cc_nomfi_supported" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Wno-missing-field-initializers is needed" >&5 +$as_echo_n "checking whether -Wno-missing-field-initializers is needed... " >&6; } + if ${gl_cv_cc_nomfi_needed+:} false; then : + $as_echo_n "(cached) " >&6 +else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -W -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +void f (void) + { + typedef struct { int a; int b; } s_t; + s_t s1 = { 0, }; + } + +int +main () +{ + ; + return 0; +} _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - spice_cc_flag=yes + gl_cv_cc_nomfi_needed=no else - spice_cc_flag=no + gl_cv_cc_nomfi_needed=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$spice_save_CFLAGS" - - if test "x$spice_cc_flag" = "xyes"; then - WARN_CFLAGS="$WARN_CFLAGS -Werror" - else - : - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $spice_cc_flag" >&5 -$as_echo "$spice_cc_flag" >&6; } - - fi - - spice_cv_warn_cflags=$WARN_CFLAGS - spice_cv_warn_maybe=$MAYBE_WARN + CFLAGS="$gl_save_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking which warning flags were supported" >&5 -$as_echo_n "checking which warning flags were supported... " >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $spice_cv_warn_cflags" >&5 -$as_echo "$spice_cv_warn_cflags" >&6; } -WARN_CFLAGS="$spice_cv_warn_cflags" -SPICE_CFLAGS="$SPICE_CFLAGS $WARN_CFLAGS" - + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_nomfi_needed" >&5 +$as_echo "$gl_cv_cc_nomfi_needed" >&6; } + fi + fi + + gl_manywarn_set= + for gl_manywarn_item in \ + -Wall \ + -W \ + -Wformat-y2k \ + -Wformat-nonliteral \ + -Wformat-security \ + -Winit-self \ + -Wmissing-include-dirs \ + -Wswitch-default \ + -Wswitch-enum \ + -Wunused \ + -Wunknown-pragmas \ + -Wstrict-aliasing \ + -Wstrict-overflow \ + -Wsystem-headers \ + -Wfloat-equal \ + -Wtraditional \ + -Wtraditional-conversion \ + -Wdeclaration-after-statement \ + -Wundef \ + -Wshadow \ + -Wunsafe-loop-optimizations \ + -Wpointer-arith \ + -Wbad-function-cast \ + -Wc++-compat \ + -Wcast-qual \ + -Wcast-align \ + -Wwrite-strings \ + -Wconversion \ + -Wsign-conversion \ + -Wlogical-op \ + -Waggregate-return \ + -Wstrict-prototypes \ + -Wold-style-definition \ + -Wmissing-prototypes \ + -Wmissing-declarations \ + -Wmissing-noreturn \ + -Wmissing-format-attribute \ + -Wpacked \ + -Wpadded \ + -Wredundant-decls \ + -Wnested-externs \ + -Wunreachable-code \ + -Winline \ + -Winvalid-pch \ + -Wlong-long \ + -Wvla \ + -Wvolatile-register-var \ + -Wdisabled-optimization \ + -Wstack-protector \ + -Woverlength-strings \ + -Wbuiltin-macro-redefined \ + -Wmudflap \ + -Wpacked-bitfield-compat \ + -Wsync-nand \ + ; do + gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" + done + # The following are not documented in the manual but are included in + # output from gcc --help=warnings. + for gl_manywarn_item in \ + -Wattributes \ + -Wcoverage-mismatch \ + -Wmultichar \ + -Wunused-macros \ + ; do + gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" + done + # More warnings from gcc 4.6.2 --help=warnings. + for gl_manywarn_item in \ + -Wabi \ + -Wcpp \ + -Wdeprecated \ + -Wdeprecated-declarations \ + -Wdiv-by-zero \ + -Wdouble-promotion \ + -Wendif-labels \ + -Wextra \ + -Wformat-contains-nul \ + -Wformat-extra-args \ + -Wformat-zero-length \ + -Wformat=2 \ + -Wmultichar \ + -Wnormalized=nfc \ + -Woverflow \ + -Wpointer-to-int-cast \ + -Wpragmas \ + -Wsuggest-attribute=const \ + -Wsuggest-attribute=noreturn \ + -Wsuggest-attribute=pure \ + -Wtrampolines \ + ; do + gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" + done + + # Disable the missing-field-initializers warning if needed + if test "$gl_cv_cc_nomfi_needed" = yes; then + gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" + fi + + maybewarn=$gl_manywarn_set + + + # Remove the ones we don't want, blacklisted earlier + + gl_warn_set= + set x $maybewarn; shift + for gl_warn_item + do + case " $dontwarn " in + *" $gl_warn_item "*) + ;; + *) + gl_warn_set="$gl_warn_set $gl_warn_item" + ;; + esac + done + wantwarn=$gl_warn_set + + + # Check for $CC support of each warning + for w in $wantwarn; do + as_gl_Warn=`$as_echo "gl_cv_warn_$w" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles $w" >&5 +$as_echo_n "checking whether compiler handles $w... " >&6; } +if eval \${$as_gl_Warn+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} $w" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + eval "$as_gl_Warn=yes" +else + eval "$as_gl_Warn=no" +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +eval ac_res=\$$as_gl_Warn + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_gl_Warn"\" = x"yes"; then : + as_fn_append WARN_CFLAGS " $w" +fi + + done + + # GNULIB uses '-W' (aka -Wextra) which includes a bunch of stuff. + # Unfortunately, this means you can't simply use '-Wsign-compare' + # with gl_MANYWARN_COMPLEMENT + # So we have -W enabled, and then have to explicitly turn off... + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -Wno-sign-compare" >&5 +$as_echo_n "checking whether compiler handles -Wno-sign-compare... " >&6; } +if ${gl_cv_warn__Wno_sign_compare+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wno-sign-compare" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__Wno_sign_compare=yes +else + gl_cv_warn__Wno_sign_compare=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__Wno_sign_compare" >&5 +$as_echo "$gl_cv_warn__Wno_sign_compare" >&6; } +if test "x$gl_cv_warn__Wno_sign_compare" = xyes; then : + as_fn_append WARN_CFLAGS " -Wno-sign-compare" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -Wno-unused-parameter" >&5 +$as_echo_n "checking whether compiler handles -Wno-unused-parameter... " >&6; } +if ${gl_cv_warn__Wno_unused_parameter+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wno-unused-parameter" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__Wno_unused_parameter=yes +else + gl_cv_warn__Wno_unused_parameter=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__Wno_unused_parameter" >&5 +$as_echo "$gl_cv_warn__Wno_unused_parameter" >&6; } +if test "x$gl_cv_warn__Wno_unused_parameter" = xyes; then : + as_fn_append WARN_CFLAGS " -Wno-unused-parameter" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -Wno-missing-field-initializers" >&5 +$as_echo_n "checking whether compiler handles -Wno-missing-field-initializers... " >&6; } +if ${gl_cv_warn__Wno_missing_field_initializers+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wno-missing-field-initializers" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__Wno_missing_field_initializers=yes +else + gl_cv_warn__Wno_missing_field_initializers=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__Wno_missing_field_initializers" >&5 +$as_echo "$gl_cv_warn__Wno_missing_field_initializers" >&6; } +if test "x$gl_cv_warn__Wno_missing_field_initializers" = xyes; then : + as_fn_append WARN_CFLAGS " -Wno-missing-field-initializers" +fi + + # We can't enable this due to horrible spice_usb_device_get_description + # signature + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -Wno-format-nonliteral" >&5 +$as_echo_n "checking whether compiler handles -Wno-format-nonliteral... " >&6; } +if ${gl_cv_warn__Wno_format_nonliteral+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wno-format-nonliteral" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__Wno_format_nonliteral=yes +else + gl_cv_warn__Wno_format_nonliteral=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__Wno_format_nonliteral" >&5 +$as_echo "$gl_cv_warn__Wno_format_nonliteral" >&6; } +if test "x$gl_cv_warn__Wno_format_nonliteral" = xyes; then : + as_fn_append WARN_CFLAGS " -Wno-format-nonliteral" +fi + + # We use some deprecated functions to avoid #ifdef hell while maintaining + # compat with older gtk / glib versions + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -Wno-deprecated-declarations" >&5 +$as_echo_n "checking whether compiler handles -Wno-deprecated-declarations... " >&6; } +if ${gl_cv_warn__Wno_deprecated_declarations+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wno-deprecated-declarations" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__Wno_deprecated_declarations=yes +else + gl_cv_warn__Wno_deprecated_declarations=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__Wno_deprecated_declarations" >&5 +$as_echo "$gl_cv_warn__Wno_deprecated_declarations" >&6; } +if test "x$gl_cv_warn__Wno_deprecated_declarations" = xyes; then : + as_fn_append WARN_CFLAGS " -Wno-deprecated-declarations" +fi + + + + + # GNULIB expects this to be part of -Wc++-compat, but we turn + # that one off, so we need to manually enable this again + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -Wjump-misses-init" >&5 +$as_echo_n "checking whether compiler handles -Wjump-misses-init... " >&6; } +if ${gl_cv_warn__Wjump_misses_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wjump-misses-init" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__Wjump_misses_init=yes +else + gl_cv_warn__Wjump_misses_init=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__Wjump_misses_init" >&5 +$as_echo "$gl_cv_warn__Wjump_misses_init" >&6; } +if test "x$gl_cv_warn__Wjump_misses_init" = xyes; then : + as_fn_append WARN_CFLAGS " -Wjump-misses-init" +fi + + + # GNULIB turns on -Wformat=2 which implies -Wformat-nonliteral, + # so we need to manually re-exclude it. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -Wno-format-nonliteral" >&5 +$as_echo_n "checking whether compiler handles -Wno-format-nonliteral... " >&6; } +if ${gl_cv_warn__Wno_format_nonliteral+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wno-format-nonliteral" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__Wno_format_nonliteral=yes +else + gl_cv_warn__Wno_format_nonliteral=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__Wno_format_nonliteral" >&5 +$as_echo "$gl_cv_warn__Wno_format_nonliteral" >&6; } +if test "x$gl_cv_warn__Wno_format_nonliteral" = xyes; then : + as_fn_append WARN_CFLAGS " -Wno-format-nonliteral" +fi + + + # This should be < 1024 really. pixman_utils is the blackspot + # preventing lower usage + as_gl_Warn=`$as_echo "gl_cv_warn_-Wframe-larger-than=9216" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -Wframe-larger-than=9216" >&5 +$as_echo_n "checking whether compiler handles -Wframe-larger-than=9216... " >&6; } +if eval \${$as_gl_Warn+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wframe-larger-than=9216" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + eval "$as_gl_Warn=yes" +else + eval "$as_gl_Warn=no" +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +eval ac_res=\$$as_gl_Warn + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_gl_Warn"\" = x"yes"; then : + as_fn_append WARN_CFLAGS " -Wframe-larger-than=9216" +fi + + + # Use improved glibc headers + +$as_echo "#define _FORTIFY_SOURCE 2" >>confdefs.h + + + # Extra special flags + case $host in + *-*-linux*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -fstack-protector-all" >&5 +$as_echo_n "checking whether compiler handles -fstack-protector-all... " >&6; } +if ${gl_cv_warn__fstack_protector_all+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -fstack-protector-all" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__fstack_protector_all=yes +else + gl_cv_warn__fstack_protector_all=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__fstack_protector_all" >&5 +$as_echo "$gl_cv_warn__fstack_protector_all" >&6; } +if test "x$gl_cv_warn__fstack_protector_all" = xyes; then : + as_fn_append WARN_CFLAGS " -fstack-protector-all" +fi + + as_gl_Warn=`$as_echo "gl_cv_warn_--param=ssp-buffer-size=4" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles --param=ssp-buffer-size=4" >&5 +$as_echo_n "checking whether compiler handles --param=ssp-buffer-size=4... " >&6; } +if eval \${$as_gl_Warn+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} --param=ssp-buffer-size=4" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + eval "$as_gl_Warn=yes" +else + eval "$as_gl_Warn=no" +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +eval ac_res=\$$as_gl_Warn + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_gl_Warn"\" = x"yes"; then : + as_fn_append WARN_CFLAGS " --param=ssp-buffer-size=4" +fi + + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -fexceptions" >&5 +$as_echo_n "checking whether compiler handles -fexceptions... " >&6; } +if ${gl_cv_warn__fexceptions+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -fexceptions" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__fexceptions=yes +else + gl_cv_warn__fexceptions=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__fexceptions" >&5 +$as_echo "$gl_cv_warn__fexceptions" >&6; } +if test "x$gl_cv_warn__fexceptions" = xyes; then : + as_fn_append WARN_CFLAGS " -fexceptions" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -fasynchronous-unwind-tables" >&5 +$as_echo_n "checking whether compiler handles -fasynchronous-unwind-tables... " >&6; } +if ${gl_cv_warn__fasynchronous_unwind_tables+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -fasynchronous-unwind-tables" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__fasynchronous_unwind_tables=yes +else + gl_cv_warn__fasynchronous_unwind_tables=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__fasynchronous_unwind_tables" >&5 +$as_echo "$gl_cv_warn__fasynchronous_unwind_tables" >&6; } +if test "x$gl_cv_warn__fasynchronous_unwind_tables" = xyes; then : + as_fn_append WARN_CFLAGS " -fasynchronous-unwind-tables" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -fdiagnostics-show-option" >&5 +$as_echo_n "checking whether compiler handles -fdiagnostics-show-option... " >&6; } +if ${gl_cv_warn__fdiagnostics_show_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -fdiagnostics-show-option" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__fdiagnostics_show_option=yes +else + gl_cv_warn__fdiagnostics_show_option=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__fdiagnostics_show_option" >&5 +$as_echo "$gl_cv_warn__fdiagnostics_show_option" >&6; } +if test "x$gl_cv_warn__fdiagnostics_show_option" = xyes; then : + as_fn_append WARN_CFLAGS " -fdiagnostics-show-option" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -funit-at-a-time" >&5 +$as_echo_n "checking whether compiler handles -funit-at-a-time... " >&6; } +if ${gl_cv_warn__funit_at_a_time+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -funit-at-a-time" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__funit_at_a_time=yes +else + gl_cv_warn__funit_at_a_time=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__funit_at_a_time" >&5 +$as_echo "$gl_cv_warn__funit_at_a_time" >&6; } +if test "x$gl_cv_warn__funit_at_a_time" = xyes; then : + as_fn_append WARN_CFLAGS " -funit-at-a-time" +fi + + + # Need -fipa-pure-const in order to make -Wsuggest-attribute=pure + # fire even without -O. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -fipa-pure-const" >&5 +$as_echo_n "checking whether compiler handles -fipa-pure-const... " >&6; } +if ${gl_cv_warn__fipa_pure_const+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -fipa-pure-const" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__fipa_pure_const=yes +else + gl_cv_warn__fipa_pure_const=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__fipa_pure_const" >&5 +$as_echo "$gl_cv_warn__fipa_pure_const" >&6; } +if test "x$gl_cv_warn__fipa_pure_const" = xyes; then : + as_fn_append WARN_CFLAGS " -fipa-pure-const" +fi + + + # We should eventually enable this, but right now there are at + # least 75 functions triggering warnings. + as_gl_Warn=`$as_echo "gl_cv_warn_-Wno-suggest-attribute=pure" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -Wno-suggest-attribute=pure" >&5 +$as_echo_n "checking whether compiler handles -Wno-suggest-attribute=pure... " >&6; } +if eval \${$as_gl_Warn+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wno-suggest-attribute=pure" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + eval "$as_gl_Warn=yes" +else + eval "$as_gl_Warn=no" +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +eval ac_res=\$$as_gl_Warn + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_gl_Warn"\" = x"yes"; then : + as_fn_append WARN_CFLAGS " -Wno-suggest-attribute=pure" +fi + + as_gl_Warn=`$as_echo "gl_cv_warn_-Wno-suggest-attribute=const" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -Wno-suggest-attribute=const" >&5 +$as_echo_n "checking whether compiler handles -Wno-suggest-attribute=const... " >&6; } +if eval \${$as_gl_Warn+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wno-suggest-attribute=const" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + eval "$as_gl_Warn=yes" +else + eval "$as_gl_Warn=no" +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +eval ac_res=\$$as_gl_Warn + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_gl_Warn"\" = x"yes"; then : + as_fn_append WARN_CFLAGS " -Wno-suggest-attribute=const" +fi + + + if test "$set_werror" = "yes" + then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -Werror" >&5 +$as_echo_n "checking whether compiler handles -Werror... " >&6; } +if ${gl_cv_warn__Werror+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__Werror=yes +else + gl_cv_warn__Werror=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__Werror" >&5 +$as_echo "$gl_cv_warn__Werror" >&6; } +if test "x$gl_cv_warn__Werror" = xyes; then : + as_fn_append WARN_CFLAGS " -Werror" +fi + + fi + + WARN_LDFLAGS=$WARN_CFLAGS + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler handles -Wno-write-strings" >&5 +$as_echo_n "checking whether compiler handles -Wno-write-strings... " >&6; } +if ${gl_cv_warn__Wno_write_strings+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} -Wno-write-strings" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + gl_cv_warn__Wno_write_strings=yes +else + gl_cv_warn__Wno_write_strings=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn__Wno_write_strings" >&5 +$as_echo "$gl_cv_warn__Wno_write_strings" >&6; } +if test "x$gl_cv_warn__Wno_write_strings" = xyes; then : + as_fn_append WARN_CFLAGS " -Wno-write-strings" +fi + + WARN_PYFLAGS=$WARN_CFLAGS + + + +SPICE_CFLAGS="$SPICE_CFLAGS $WARN_CFLAGS" + SPICE_GLIB_CFLAGS="$PROTOCOL_CFLAGS $PIXMAN_CFLAGS $CELT051_CFLAGS $PULSE_CFLAGS $GST_CFLAGS $GLIB2_CFLAGS $GIO_CFLAGS $GOBJECT2_CFLAGS $SSL_CFLAGS $SASL_CFLAGS" @@ -17930,7 +18883,6 @@ - # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; @@ -17941,10 +18893,37 @@ no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi AM_BACKSLASH='\' -ac_config_files="$ac_config_files Makefile spice-client-glib-2.0.pc spice-client-gtk-2.0.pc spice-client-gtk-3.0.pc spice-controller.pc common/Makefile data/Makefile data/spicy.desktop.in data/spicy.nsis po/Makefile.in python_modules/Makefile gtk/Makefile gtk/controller/Makefile doc/Makefile doc/reference/Makefile vapi/Makefile" +ac_config_files="$ac_config_files Makefile spice-client-glib-2.0.pc spice-client-gtk-2.0.pc spice-client-gtk-3.0.pc spice-controller.pc data/Makefile data/spicy.desktop.in data/spicy.nsis po/Makefile.in gtk/Makefile gtk/controller/Makefile doc/Makefile doc/reference/Makefile vapi/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -18099,6 +19078,10 @@ as_fn_error $? "conditional \"GTK_DOC_USE_REBASE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${SUPPORT_GL_TRUE}" && test -z "${SUPPORT_GL_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_GL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -18164,10 +19147,6 @@ as_fn_error $? "conditional \"WITH_USBREDIR\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${WITH_USBREDIR_TRUE}" && test -z "${WITH_USBREDIR_FALSE}"; then - as_fn_error $? "conditional \"WITH_USBREDIR\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${WITH_POLKIT_TRUE}" && test -z "${WITH_POLKIT_FALSE}"; then as_fn_error $? "conditional \"WITH_POLKIT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -18617,7 +19596,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by spice-gtk $as_me 0.9, which was +This file was extended by spice-gtk $as_me 0.12, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18683,7 +19662,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -spice-gtk config.status 0.9 +spice-gtk config.status 0.12 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" @@ -19099,12 +20078,10 @@ "spice-client-gtk-2.0.pc") CONFIG_FILES="$CONFIG_FILES spice-client-gtk-2.0.pc" ;; "spice-client-gtk-3.0.pc") CONFIG_FILES="$CONFIG_FILES spice-client-gtk-3.0.pc" ;; "spice-controller.pc") CONFIG_FILES="$CONFIG_FILES spice-controller.pc" ;; - "common/Makefile") CONFIG_FILES="$CONFIG_FILES common/Makefile" ;; "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; "data/spicy.desktop.in") CONFIG_FILES="$CONFIG_FILES data/spicy.desktop.in" ;; "data/spicy.nsis") CONFIG_FILES="$CONFIG_FILES data/spicy.nsis" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; - "python_modules/Makefile") CONFIG_FILES="$CONFIG_FILES python_modules/Makefile" ;; "gtk/Makefile") CONFIG_FILES="$CONFIG_FILES gtk/Makefile" ;; "gtk/controller/Makefile") CONFIG_FILES="$CONFIG_FILES gtk/controller/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; @@ -20487,6 +21464,151 @@ # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi + +# +# CONFIG_SUBDIRS section. +# +if test "$no_recursion" != yes; then + + # Remove --cache-file, --srcdir, and --disable-option-checking arguments + # so they do not pile up. + ac_sub_configure_args= + ac_prev= + eval "set x $ac_configure_args" + shift + for ac_arg + do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + ;; + --disable-option-checking) + ;; + *) + case $ac_arg in + *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_sub_configure_args " '$ac_arg'" ;; + esac + done + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ac_arg="--prefix=$prefix" + case $ac_arg in + *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" + + # Pass --silent + if test "$silent" = yes; then + ac_sub_configure_args="--silent $ac_sub_configure_args" + fi + + # Always prepend --disable-option-checking to silence warnings, since + # different subdirs can have different --enable and --with options. + ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" + + ac_popdir=`pwd` + for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d "$srcdir/$ac_dir" || continue + + ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" + $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 + $as_echo "$ac_msg" >&6 + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + cd "$ac_dir" + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f "$ac_srcdir/configure.gnu"; then + ac_sub_configure=$ac_srcdir/configure.gnu + elif test -f "$ac_srcdir/configure"; then + ac_sub_configure=$ac_srcdir/configure + elif test -f "$ac_srcdir/configure.in"; then + # This should be Cygnus configure. + ac_sub_configure=$ac_aux_dir/configure + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 +$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative name. + ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + # The eval makes quoting arguments work. + eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ + --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || + as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 + fi + + cd "$ac_popdir" + done +fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} diff -Nru spice-gtk-0.9/configure.ac spice-gtk-0.12/configure.ac --- spice-gtk-0.9/configure.ac 2012-01-28 09:42:40.000000000 +0000 +++ spice-gtk-0.12/configure.ac 2012-04-21 18:45:31.000000000 +0000 @@ -23,8 +23,8 @@ GTK_DOC_CHECK([1.14],[--flavour no-tmpl]) -# Define default SPICE_COMMON_SRCDIR -SPICE_COMMON_SRCDIR='$(top_srcdir)'/common +# no opengl support yet +AM_CONDITIONAL(SUPPORT_GL, false) AC_PROG_CC AC_PROG_CC_C99 @@ -32,6 +32,13 @@ AC_MSG_ERROR([C99 compiler is required.]) fi + +AC_CHECK_PROG([STOW], [stow], [yes], [no]) +AS_IF([test "x$STOW" = "xyes" && test -d /usr/local/stow], [ + AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME} ***]) + ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}" +]) + AC_PROG_INSTALL AC_CANONICAL_HOST AC_PROG_LIBTOOL @@ -59,25 +66,17 @@ AC_CHECK_HEADERS([sys/ipc.h sys/shm.h]) AC_CHECK_HEADERS([sys/socket.h netinet/in.h arpa/inet.h]) -dnl ========================================================================= -dnl Chek optional features -PKG_CHECK_MODULES(PROTOCOL, spice-protocol >= 0.10.1) -AC_SUBST(PROTOCOL_CFLAGS) - AC_CHECK_LIBM AC_SUBST(LIBM) -srcdir="$(dirname $0)" -if test ! -e "$srcdir/gtk/generated_marshallers.c"; then - AC_MSG_CHECKING([for pyparsing python module]) - echo "import pyparsing" | ${PYTHON} - >/dev/null 2>&1 - if test $? -ne 0 ; then - AC_MSG_RESULT([not found]) - AC_MSG_ERROR([pyparsing python module is required to compile this package]) - fi - AC_MSG_RESULT([found]) -fi +AC_CONFIG_SUBDIRS([spice-common]) +COMMON_CFLAGS='-I ${top_srcdir}/spice-common/ -I ${top_srcdir}/spice-common/spice-protocol/' +AC_SUBST(COMMON_CFLAGS) +dnl ========================================================================= +dnl Chek optional features + +srcdir="$(dirname $0)" if test ! -e "$srcdir/gtk/vncdisplaykeymap_osx2xtkbd.c"; then AC_MSG_CHECKING([for Text::CSV Perl module]) perl -MText::CSV -e "" >/dev/null 2>&1 @@ -341,10 +340,10 @@ [enable_usbredir="auto"]) if test "x$enable_usbredir" = "xno"; then - AM_CONDITIONAL(WITH_USBREDIR, false) + have_usbredir="no" else PKG_CHECK_MODULES([USBREDIR], - [gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.3.3], + [gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost >= 0.4.2 libusbredirparser >= 0.4], [have_usbredir=yes], [have_usbredir=no]) if test "x$have_usbredir" = "xno" && test "x$enable_usbredir" = "xyes"; then @@ -353,8 +352,8 @@ if test "x$have_usbredir" = "xyes"; then AC_DEFINE(USE_USBREDIR, [1], [Define if supporting usbredir proxying]) fi - AM_CONDITIONAL([WITH_USBREDIR], [test "x$have_usbredir" = "xyes"]) fi +AM_CONDITIONAL([WITH_USBREDIR], [test "x$have_usbredir" = "xyes"]) AC_ARG_ENABLE([polkit], AS_HELP_STRING([--enable-polkit=@<:@auto/yes/no@:>@], @@ -382,6 +381,8 @@ # Check for polkit_authority_get_sync() AC_CHECK_LIB([polkit-gobject-1], [polkit_authority_get_sync], ac_have_pk_auth_get_sync="1", ac_have_pk_auth_get_sync="0") AC_DEFINE_UNQUOTED(HAVE_POLKIT_AUTHORITY_GET_SYNC, $ac_have_pk_auth_get_sync, [Define if you have a polkit with polkit_authority_get_sync()]) + AC_CHECK_LIB([polkit-gobject-1], [polkit_authorization_result_get_dismissed], ac_have_pk_authorization_result_get_dismissed="1", ac_have_pk_authorization_result_get_dismissed="0") + AC_DEFINE_UNQUOTED(HAVE_POLKIT_AUTHORIZATION_RESULT_GET_DISMISSED, $ac_have_pk_authorization_result_get_dismissed, [Define if you have a polkit with polkit_authorization_result_get_dismissed()]) else AM_CONDITIONAL(WITH_POLKIT, false) fi @@ -426,6 +427,27 @@ [ACL_HELPER_DIR="${bindir}/"]) AC_SUBST([ACL_HELPER_DIR]) +AC_ARG_WITH([usb-ids-path], + AC_HELP_STRING([--with-usb-ids-path], + [Specify the path to usb.ids @<:@default=auto@:>@]), + [USB_IDS="$with_usb_ids_path"], + [USB_IDS="auto"]) +AC_MSG_CHECKING([for usb.ids]) +if test "x$USB_IDS" = "xauto"; then + if test -n "$PKG_CONFIG"; then + USB_IDS=$($PKG_CONFIG --variable=usbids usbutils) + else + USB_IDS= + fi +fi +if test -n "$USB_IDS"; then + AC_MSG_RESULT([$USB_IDS]) + AC_SUBST(USB_IDS) + AC_DEFINE(WITH_USBIDS, [1], [Define if compiling with usb.ids support]) +else + AC_MSG_RESULT([not found]) +fi + AC_ARG_WITH([coroutine], AS_HELP_STRING([--with-coroutine=@<:@ucontext/gthread/winfiber/auto@:>@], [use ucontext or GThread for coroutines @<:@default=auto@:>@]), @@ -547,76 +569,8 @@ dnl =========================================================================== dnl check compiler flags -AC_DEFUN([SPICE_CC_TRY_FLAG], [ - AC_MSG_CHECKING([whether $CC supports $1]) - - spice_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $1" - - AC_COMPILE_IFELSE([AC_LANG_SOURCE([ ])], [spice_cc_flag=yes], [spice_cc_flag=no]) - CFLAGS="$spice_save_CFLAGS" - - if test "x$spice_cc_flag" = "xyes"; then - ifelse([$2], , :, [$2]) - else - ifelse([$3], , :, [$3]) - fi - AC_MSG_RESULT([$spice_cc_flag]) -]) - - -dnl Use lots of warning flags with with gcc and compatible compilers - -dnl Note: if you change the following variable, the cache is automatically -dnl skipped and all flags rechecked. So there's no need to do anything -dnl else. If for any reason you need to force a recheck, just change -dnl MAYBE_WARN in an ignorable way (like adding whitespace) - -dnl MAYBE_WARN="-Wall -Wno-sign-compare -Werror -Wno-deprecated-declarations" - -MAYBE_WARN="-Wall -Wno-sign-compare -Wno-deprecated-declarations" - -AC_ARG_ENABLE([werror], - AS_HELP_STRING([--enable-werror], [Use -Werror (if supported)]), - [set_werror="$enableval"], - [if test -d $srcdir/.git; then - is_git_version=true - set_werror=yes - else - set_werror=no - fi]) - -# invalidate cached value if MAYBE_WARN has changed -if test "x$spice_cv_warn_maybe" != "x$MAYBE_WARN"; then - unset spice_cv_warn_cflags -fi -AC_CACHE_CHECK([for supported warning flags], spice_cv_warn_cflags, [ - echo - WARN_CFLAGS="" - - # Some warning options are not supported by all versions of - # gcc, so test all desired options against the current - # compiler. - # - # Note that there are some order dependencies - # here. Specifically, an option that disables a warning will - # have no net effect if a later option then enables that - # warnings, (perhaps implicitly). So we put some grouped - # options (-Wall and -Wextra) up front and the -Wno options - # last. - - for W in $MAYBE_WARN; do - SPICE_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"]) - done - if test "$set_werror" != "no"; then - SPICE_CC_TRY_FLAG(["-Werror"], [WARN_CFLAGS="$WARN_CFLAGS -Werror"]) - fi - - spice_cv_warn_cflags=$WARN_CFLAGS - spice_cv_warn_maybe=$MAYBE_WARN +SPICE_COMPILE_WARNINGS - AC_MSG_CHECKING([which warning flags were supported])]) -WARN_CFLAGS="$spice_cv_warn_cflags" SPICE_CFLAGS="$SPICE_CFLAGS $WARN_CFLAGS" AC_SUBST(SPICE_CFLAGS) @@ -627,7 +581,6 @@ AC_SUBST(SPICE_GLIB_CFLAGS) AC_SUBST(SPICE_GTK_CFLAGS) -AC_SUBST(SPICE_COMMON_SRCDIR) AC_SUBST(SPICE_GLIB_REQUIRES) AC_SUBST(SPICE_GTK_REQUIRES) @@ -639,12 +592,10 @@ spice-client-gtk-2.0.pc spice-client-gtk-3.0.pc spice-controller.pc -common/Makefile data/Makefile data/spicy.desktop.in data/spicy.nsis po/Makefile.in -python_modules/Makefile gtk/Makefile gtk/controller/Makefile doc/Makefile diff -Nru spice-gtk-0.9/data/Makefile.in spice-gtk-0.12/data/Makefile.in --- spice-gtk-0.9/data/Makefile.in 2012-01-31 10:22:59.000000000 +0000 +++ spice-gtk-0.12/data/Makefile.in 2012-04-24 11:21:03.000000000 +0000 @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -39,22 +39,24 @@ $(srcdir)/spicy.desktop.in.in $(srcdir)/spicy.nsis.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/check_python.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/intltool.m4 \ - $(top_srcdir)/m4/ld-version.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/ld-version.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/manywarnings.m4 \ + $(top_srcdir)/m4/spice-compile-warnings.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = spicy.desktop.in spicy.nsis CONFIG_CLEAN_VPATH_FILES = -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = @@ -79,6 +81,12 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(policydir)" "$(DESTDIR)$(vapidir)" DATA = $(policy_DATA) $(vapi_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -103,6 +111,7 @@ CELT051_LIBDIR = @CELT051_LIBDIR@ CELT051_LIBS = @CELT051_LIBS@ CFLAGS = @CFLAGS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ @@ -153,6 +162,10 @@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ @@ -208,8 +221,6 @@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PROTOCOL_CFLAGS = @PROTOCOL_CFLAGS@ -PROTOCOL_LIBS = @PROTOCOL_LIBS@ PULSE_CFLAGS = @PULSE_CFLAGS@ PULSE_LIBS = @PULSE_LIBS@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ @@ -229,7 +240,6 @@ SMARTCARD_CFLAGS = @SMARTCARD_CFLAGS@ SMARTCARD_LIBS = @SMARTCARD_LIBS@ SPICE_CFLAGS = @SPICE_CFLAGS@ -SPICE_COMMON_SRCDIR = @SPICE_COMMON_SRCDIR@ SPICE_GLIB_CFLAGS = @SPICE_GLIB_CFLAGS@ SPICE_GLIB_REQUIRES = @SPICE_GLIB_REQUIRES@ SPICE_GTK_API_VERSION = @SPICE_GTK_API_VERSION@ @@ -238,14 +248,19 @@ SPICE_GTK_REQUIRES = @SPICE_GTK_REQUIRES@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ +STOW = @STOW@ STRIP = @STRIP@ USBREDIR_CFLAGS = @USBREDIR_CFLAGS@ USBREDIR_LIBS = @USBREDIR_LIBS@ +USB_IDS = @USB_IDS@ USE_NLS = @USE_NLS@ VALAC = @VALAC@ VAPIDIR = @VAPIDIR@ VAPIGEN = @VAPIGEN@ VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_LDFLAGS = @WARN_LDFLAGS@ +WARN_PYFLAGS = @WARN_PYFLAGS@ XGETTEXT = @XGETTEXT@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ @@ -283,6 +298,8 @@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ @@ -301,6 +318,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ @@ -399,9 +417,7 @@ @$(NORMAL_UNINSTALL) @list='$(policy_DATA)'; test -n "$(policydir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(policydir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(policydir)" && rm -f $$files + dir='$(DESTDIR)$(policydir)'; $(am__uninstall_files_from_dir) install-vapiDATA: $(vapi_DATA) @$(NORMAL_INSTALL) test -z "$(vapidir)" || $(MKDIR_P) "$(DESTDIR)$(vapidir)" @@ -419,9 +435,7 @@ @$(NORMAL_UNINSTALL) @list='$(vapi_DATA)'; test -n "$(vapidir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(vapidir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(vapidir)" && rm -f $$files + dir='$(DESTDIR)$(vapidir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: @@ -476,10 +490,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: diff -Nru spice-gtk-0.9/data/spice-protocol.vapi spice-gtk-0.12/data/spice-protocol.vapi --- spice-gtk-0.9/data/spice-protocol.vapi 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/data/spice-protocol.vapi 2012-04-11 13:51:02.000000000 +0000 @@ -34,7 +34,7 @@ [CCode (cprefix = "CONTROLLER_")] public enum MsgId { - //extrenal app -> spice client + //external app -> spice client HOST, PORT, SPORT, @@ -60,8 +60,17 @@ SHOW, HIDE, - //spice client -> extrenal app + ENABLE_SMARTCARD, + + ENABLE_USB, + ENABLE_USB_AUTOSHARE, + USB_FILTER, + + //spice client -> external app MENU_ITEM_CLICK, + + COLOR_DEPTH, + DISABLE_EFFECTS, } [CCode (cname = "unsigned int", cprefix = "CONTROLLER_", has_type_id = false)] @@ -105,4 +114,95 @@ GRAYED, } } + + [CCode (cprefix = "FrgMenu", cheader_filename = "spice/foreign_menu_prot.h")] + namespace ForeignMenu { + [CCode (cname = "FOREIGN_MENU_MAGIC")] + public const uint32 MAGIC; + [CCode (cname = "FOREIGN_MENU_VERSION")] + public const int VERSION; + + [Compact] + public struct InitHeader { + uint32 magic; + uint32 version; + uint32 size; + } + + [Compact] + [CCode (has_destroy_function = false)] + public struct Init { + InitHeader base; + uint64 credentials; + string title; // utf8 + } + + [Compact] + public struct Msg { + uint32 id; + uint32 size; + } + + [CCode (cprefix = "FOREIGN_MENU_", cname = "int")] + public enum MsgId { + //external app -> spice client + SET_TITLE, + ADD_ITEM, + MODIFY_ITEM, + REMOVE_ITEM, + CLEAR, + + //spice client -> external app + ITEM_EVENT, + APP_ACTIVATED, + APP_DEACTIVATED, + } + + [Compact] + [CCode (cname = "FrgMenuSetTitle")] + public struct SetTitle { + Msg base; + string string; // utf8 + } + + [CCode (cprefix = "FOREIGN_MENU_ITEM_TYPE_", cname = "unsigned int", has_type_id = false)] + [Flags] + public enum MenuFlags { + CHECKED, + DIM, + SEPARATOR + } + + [Compact] + [CCode (cname = "FrgMenuAddItem")] + public struct AddItem { + Msg base; + uint32 id; + uint32 type; + uint32 position; + string string; // utf8 + } + + [Compact] + [CCode (cname = "FrgMenuRmItem")] + public struct RmItem { + Msg base; + uint32 id; + } + + [CCode (cprefix = "FOREIGN_MENU_EVENT_", cname = "int")] + public enum EventType { + CLICK, + CHECKED, + UNCHECKED, + } + + [Compact] + [CCode (cname = "FrgMenuEvent")] + public struct Event { + Msg base; + uint32 id; + uint32 action; + } + } } diff -Nru spice-gtk-0.9/data/spicy.nsis spice-gtk-0.12/data/spicy.nsis --- spice-gtk-0.9/data/spicy.nsis 2012-01-31 10:23:04.000000000 +0000 +++ spice-gtk-0.12/data/spicy.nsis 2012-04-24 11:21:11.000000000 +0000 @@ -9,11 +9,11 @@ # # makensis spicy.nsis # -# which will generate the output file 'spicy-0.9.exe' which is a Windows +# which will generate the output file 'spicy-0.12.exe' which is a Windows # installer containing your program. Name "spicy" -OutFile "spicy-0.9.exe" +OutFile "spicy-0.12.exe" InstallDir "c:\spicy" InstallDirRegKey HKLM SOFTWARE\spicy "Install_Dir" diff -Nru spice-gtk-0.9/debian/changelog spice-gtk-0.12/debian/changelog --- spice-gtk-0.9/debian/changelog 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/changelog 2012-06-26 12:24:38.000000000 +0000 @@ -1,7 +1,49 @@ -spice-gtk (0.9-0ubuntu1) precise; urgency=low +spice-gtk (0.12-2ubuntu3) precise; urgency=high + + * Build on precise. Valac version 0.14 + + -- Boris Derzhavets Tue, 26 Jun 2012 16:52:45 +0800 + +spice-gtk (0.12-2) unstable; urgency=low + + * Enable usb redirect (Closes: #677662) + * Switch to vala 0.16 (Closes: #675665) + * Enable multiarch for libspice-client-glib-2.0-1, + libspice-client-gtk-2.0-1, libspice-client-gtk-3.0-1 + * Build with hardening flags + + -- Liang Guo Fri, 25 May 2012 21:52:45 +0800 + + +spice-gtk (0.12-1) unstable; urgency=low + + * New upstream release + * Update debian/copyright, file moved + - common -> spice-common/common + - spice-protocol -> spice-common/spice-protocol + * debian/patches: + - Refresh debian/patches/remove-libjpeg-turbo-warning.patch + - Add fix-parsing-uri-query.patch + - Add fix-spice-audio-binding.patch + * Refresh debian/libspice-client-glib-2.0-1.symbols, new function added + + -- Liang Guo Thu, 03 May 2012 09:45:49 +0800 + +spice-gtk (0.11-1) unstable; urgency=low + + * New upstream release (Closes: #667569) + * Update debian/copyright, new file added + * Bump Standards-Version to 3.9.3, no changes needed + * Refresh debian/libspice-client-glib-2.0-1.symbols + * Update debian/rules, build spice-gtk in a subdirectory + * Include missed .deps and .vapi files in libspice-client-gtk-2.0-dev + * Add libtext-csv-perl to Build-Depends + + -- Liang Guo Fri, 06 Apr 2012 21:22:13 +0800 + +spice-gtk (0.9-1) unstable; urgency=low [ Jeremy Bicha ] - * Pulled from Debian git repository * New upstream release. - add USB redirection support, see Hans comments in the log and that post for details: http://hansdegoede.livejournal.com/11084.html @@ -34,7 +76,7 @@ * debian/control: - Replace libspice-client-glib-2.0-4 with libspice-client-glib-2.0-1 - -- Jeremy Bicha Mon, 13 Feb 2012 18:06:18 -0500 + -- Liang Guo Wed, 01 Feb 2012 14:38:05 +0800 spice-gtk (0.7-3) unstable; urgency=low diff -Nru spice-gtk-0.9/debian/compat spice-gtk-0.12/debian/compat --- spice-gtk-0.9/debian/compat 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/compat 2012-06-26 12:18:50.000000000 +0000 @@ -1 +1 @@ -8 +9 diff -Nru spice-gtk-0.9/debian/control spice-gtk-0.12/debian/control --- spice-gtk-0.9/debian/control 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/control 2012-06-26 12:22:55.000000000 +0000 @@ -1,10 +1,9 @@ Source: spice-gtk Section: misc Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Liang Guo +Maintainer: Liang Guo Build-Depends: - debhelper (>= 8.0.0), + debhelper (>= 9), libspice-protocol-dev (>= 0.10.1), libspice-server-dev, libpixman-1-dev (>= 0.17.7), @@ -26,7 +25,13 @@ gobject-introspection, libgirepository1.0-dev, gir1.2-gtk-2.0, -Standards-Version: 3.9.2 + libtext-csv-perl, + libusbredirhost-dev, + libacl1-dev, + libpolkit-agent-1-dev, + libpolkit-gobject-1-dev, + dpkg-dev (>= 1.16.1~), +Standards-Version: 3.9.3 X-Python-Version: >= 2.5 Homepage: http://www.spice-space.org/ Vcs-Git: git://git.debian.org/collab-maint/spice-gtk.git @@ -46,6 +51,8 @@ Package: libspice-client-glib-2.0-1 Section: libs Architecture: i386 amd64 +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, ${misc:Depends} Replaces: libspice-client-glib-2.0-4 Conflicts: libspice-client-glib-2.0-4 @@ -58,6 +65,7 @@ Package: gir1.2-spice-client-glib-2.0 Section: introspection Architecture: i386 amd64 +Pre-Depends: ${misc:Pre-Depends} Depends: ${misc:Depends}, ${gir:Depends} Description: GObject for communicating with Spice servers (GObject-Introspection) libspice-glib4 provides glib objects for spice protocol @@ -84,6 +92,8 @@ Package: libspice-client-gtk-2.0-1 Section: libs Architecture: i386 amd64 +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, ${misc:Depends} Description: GTK2 widget for SPICE clients (runtime library) libspice-gtk2 provides gtk2 widget to show spice display @@ -118,6 +128,8 @@ Package: libspice-client-gtk-3.0-1 Section: libs Architecture: i386 amd64 +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, ${misc:Depends} Description: GTK3 widget for SPICE clients (runtime library) libspice-gtk3 provides gtk3 widget to show spice display diff -Nru spice-gtk-0.9/debian/copyright spice-gtk-0.12/debian/copyright --- spice-gtk-0.9/debian/copyright 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/copyright 2012-06-26 12:18:50.000000000 +0000 @@ -3,23 +3,33 @@ Source: http://www.spice-space.org/ Files: * -Copyright: Copyright (C) 2009,2010,2011 Red Hat, Inc. +Copyright: Copyright (C) 2009,2010,2011,2012 Red Hat, Inc. License: LGPL-2.1+ Files: debian/* Copyright: 2011 Liang Guo License: LGPL-2.1+ -Files: common/lz_compress_tmpl.c common/lz.c common/lz_decompress_tmpl.c +Files: spice-common/common/lz_compress_tmpl.c + spice-common/common/lz.c + spice-common/common/lz_decompress_tmpl.c Copyright: Copyright 2009 Red Hat, Inc. and/or its affiliates. Copyright (C) 2005, 2006, 2007 Ariya Hidayat (ariya@kde.org) License: LGPL-2.1+ and MIT -Files: common/draw.h common/messages.h +Files: spice-common/common/draw.h spice-common/common/messages.h + spice-common/spice-protocol/spice/ipc_ring.h + spice-common/spice-protocol/spice/protocol.h + spice-common/spice-protocol/spice/qxl_dev.h + spice-common/spice-protocol/spice/start-packed.h + spice-common/spice-protocol/spice/stats.h + spice-common/spice-protocol/spice/types.h + spice-common/spice-protocol/spice/vd_agent.h + spice-common/spice-protocol/spice/vdi_dev.h Copyright: Copyright (C) 2009, 2010 Red Hat, Inc. License: BSD-3-clause -Files: common/lz.h +Files: spice-common/common/lz.h Copyright: Copyright 2009-2011 Red Hat, Inc. and/or its affiliates License: MIT Comment: No copyright holder in file header @@ -173,7 +183,7 @@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Files: common/lines.* +Files: spice-common/common/lines.* Copyright: Copyright 1987, 1989, 1998 The Open Group Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts License: diff -Nru spice-gtk-0.9/debian/gir1.2-spice-client-glib-2.0.install spice-gtk-0.12/debian/gir1.2-spice-client-glib-2.0.install --- spice-gtk-0.9/debian/gir1.2-spice-client-glib-2.0.install 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/gir1.2-spice-client-glib-2.0.install 2012-06-26 12:18:50.000000000 +0000 @@ -1 +1 @@ -usr/lib/girepository-1.0/SpiceClientGLib-2.0.typelib +usr/lib/*/girepository-1.0/SpiceClientGLib-2.0.typelib usr/lib/girepository-1.0 diff -Nru spice-gtk-0.9/debian/gir1.2-spice-client-gtk-2.0.install spice-gtk-0.12/debian/gir1.2-spice-client-gtk-2.0.install --- spice-gtk-0.9/debian/gir1.2-spice-client-gtk-2.0.install 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/gir1.2-spice-client-gtk-2.0.install 2012-06-26 12:18:50.000000000 +0000 @@ -1 +1 @@ -usr/lib/girepository-1.0/SpiceClientGtk-2.0.typelib +usr/lib/*/girepository-1.0/SpiceClientGtk-2.0.typelib usr/lib/girepository-1.0 diff -Nru spice-gtk-0.9/debian/gir1.2-spice-client-gtk-3.0.install spice-gtk-0.12/debian/gir1.2-spice-client-gtk-3.0.install --- spice-gtk-0.9/debian/gir1.2-spice-client-gtk-3.0.install 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/gir1.2-spice-client-gtk-3.0.install 2012-06-26 12:18:50.000000000 +0000 @@ -1 +1 @@ -usr/lib/girepository-1.0/SpiceClientGtk-3.0.typelib +usr/lib/*/girepository-1.0/SpiceClientGtk-3.0.typelib usr/lib/girepository-1.0 diff -Nru spice-gtk-0.9/debian/libspice-client-glib-2.0-1.install spice-gtk-0.12/debian/libspice-client-glib-2.0-1.install --- spice-gtk-0.9/debian/libspice-client-glib-2.0-1.install 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/libspice-client-glib-2.0-1.install 2012-06-26 12:18:50.000000000 +0000 @@ -1,2 +1,4 @@ -usr/lib/libspice-client-glib-2.0.so.* -usr/lib/libspice-controller.so.* +usr/lib/*/libspice-client-glib-2.0.so.* +usr/lib/*/libspice-controller.so.* +usr/lib/*/spice-gtk/spice-client-glib-usb-acl-helper +usr/share/polkit-1/actions/org.spice-space.lowlevelusbaccess.policy diff -Nru spice-gtk-0.9/debian/libspice-client-glib-2.0-1.postinst spice-gtk-0.12/debian/libspice-client-glib-2.0-1.postinst --- spice-gtk-0.9/debian/libspice-client-glib-2.0-1.postinst 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/debian/libspice-client-glib-2.0-1.postinst 2012-06-26 12:18:50.000000000 +0000 @@ -0,0 +1,11 @@ +#!/bin/sh +set -e +#DEBHELPER# +for i in /usr/lib/*/spice-gtk/spice-client-glib-usb-acl-helper +do + # only do something when no setting exists + if ! dpkg-statoverride --list $i >/dev/null 2>&1 + then + dpkg-statoverride --update --add root root 4755 $i + fi +done diff -Nru spice-gtk-0.9/debian/libspice-client-glib-2.0-1.postrm spice-gtk-0.12/debian/libspice-client-glib-2.0-1.postrm --- spice-gtk-0.9/debian/libspice-client-glib-2.0-1.postrm 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/debian/libspice-client-glib-2.0-1.postrm 2012-06-26 12:18:50.000000000 +0000 @@ -0,0 +1,10 @@ +#!/bin/sh +set -e +#DEBHELPER# +for i in /usr/lib/x86_64-linux-gnu/spice-gtk/spice-client-glib-usb-acl-helper +do + if dpkg-statoverride --list $i >/dev/null 2>&1 + then + dpkg-statoverride --remove $i + fi +done diff -Nru spice-gtk-0.9/debian/libspice-client-glib-2.0-1.symbols spice-gtk-0.12/debian/libspice-client-glib-2.0-1.symbols --- spice-gtk-0.9/debian/libspice-client-glib-2.0-1.symbols 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/libspice-client-glib-2.0-1.symbols 2012-06-26 12:18:50.000000000 +0000 @@ -28,6 +28,7 @@ spice_inputs_motion@SPICEGTK_1 0.7 spice_inputs_position@SPICEGTK_1 0.7 spice_inputs_set_key_locks@SPICEGTK_1 0.7 + spice_main_agent_test_capability@SPICEGTK_1 0.11 spice_main_channel_get_type@SPICEGTK_1 0.7 spice_main_clipboard_grab@SPICEGTK_1 0.7 spice_main_clipboard_notify@SPICEGTK_1 0.7 @@ -64,6 +65,7 @@ spice_smartcard_reader_is_software@SPICEGTK_1 0.7 spice_usb_device_get_description@SPICEGTK_1 0.8 spice_usb_device_get_type@SPICEGTK_1 0.8 + spice_usb_device_manager_can_redirect_device@SPICEGTK_1 0.11 spice_usb_device_manager_connect_device_async@SPICEGTK_1 0.8 spice_usb_device_manager_connect_device_finish@SPICEGTK_1 0.8 spice_usb_device_manager_disconnect_device@SPICEGTK_1 0.8 @@ -71,7 +73,7 @@ spice_usb_device_manager_get_devices@SPICEGTK_1 0.8 spice_usb_device_manager_get_type@SPICEGTK_1 0.8 spice_usb_device_manager_is_device_connected@SPICEGTK_1 0.8 - spice_usbredir_channel_get_type@SPICEGTK_1 0.8 + spice_usbredir_channel_get_type@SPICEGTK_1 0.8 spice_util_get_debug@SPICEGTK_1 0.7 spice_util_get_version_string@SPICEGTK_1 0.7 spice_util_set_debug@SPICEGTK_1 0.7 @@ -82,8 +84,13 @@ spice_controller_listener_new@Base 0.9 spice_ctrl_controller_construct@Base 0.7 spice_ctrl_controller_get_ca_file@Base 0.7 + spice_ctrl_controller_get_color_depth@Base 0.12 spice_ctrl_controller_get_disable_channels@Base 0.7 + spice_ctrl_controller_get_disable_effects@Base 0.12 spice_ctrl_controller_get_display_flags@Base 0.7 + spice_ctrl_controller_get_enable_smartcard@Base 0.11 + spice_ctrl_controller_get_enable_usb_autoshare@Base 0.12 + spice_ctrl_controller_get_enable_usbredir@Base 0.12 spice_ctrl_controller_get_host@Base 0.7 spice_ctrl_controller_get_host_subject@Base 0.7 spice_ctrl_controller_get_hotkeys@Base 0.7 @@ -91,10 +98,12 @@ spice_ctrl_controller_get_password@Base 0.7 spice_ctrl_controller_get_port@Base 0.7 spice_ctrl_controller_get_secure_channels@Base 0.7 + spice_ctrl_controller_get_send_cad@Base 0.12 spice_ctrl_controller_get_sport@Base 0.7 spice_ctrl_controller_get_title@Base 0.7 spice_ctrl_controller_get_tls_ciphers@Base 0.7 spice_ctrl_controller_get_type@Base 0.7 + spice_ctrl_controller_get_usb_filter@Base 0.12 spice_ctrl_controller_listen@Base 0.7 spice_ctrl_controller_listen_finish@Base 0.7 spice_ctrl_controller_menu_item_click_msg@Base 0.7 @@ -102,6 +111,18 @@ spice_ctrl_controller_send_msg@Base 0.7 spice_ctrl_controller_send_msg_finish@Base 0.7 spice_ctrl_error_quark@Base 0.7 + spice_ctrl_foreign_menu_app_activated_msg@Base 0.11 + spice_ctrl_foreign_menu_construct@Base 0.11 + spice_ctrl_foreign_menu_get_menu@Base 0.11 + spice_ctrl_foreign_menu_get_title@Base 0.11 + spice_ctrl_foreign_menu_get_type@Base 0.11 + spice_ctrl_foreign_menu_listen@Base 0.11 + spice_ctrl_foreign_menu_listen_finish@Base 0.11 + spice_ctrl_foreign_menu_menu_item_checked_msg@Base 0.11 + spice_ctrl_foreign_menu_menu_item_click_msg@Base 0.11 + spice_ctrl_foreign_menu_new@Base 0.11 + spice_ctrl_foreign_menu_send_msg@Base 0.11 + spice_ctrl_foreign_menu_send_msg_finish@Base 0.11 spice_ctrl_menu_construct@Base 0.7 spice_ctrl_menu_construct_from_string@Base 0.7 spice_ctrl_menu_find_id@Base 0.7 @@ -115,3 +136,7 @@ spice_ctrl_menu_new@Base 0.7 spice_ctrl_menu_new_from_string@Base 0.7 spice_ctrl_menu_to_string@Base 0.7 + spice_foreign_menu_listener_accept_async@Base 0.11 + spice_foreign_menu_listener_accept_finish@Base 0.11 + spice_foreign_menu_listener_error_quark@Base 0.11 + spice_foreign_menu_listener_new@Base 0.11 diff -Nru spice-gtk-0.9/debian/libspice-client-glib-2.0-dev.install spice-gtk-0.12/debian/libspice-client-glib-2.0-dev.install --- spice-gtk-0.9/debian/libspice-client-glib-2.0-dev.install 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/libspice-client-glib-2.0-dev.install 2012-06-26 12:18:50.000000000 +0000 @@ -1,7 +1,7 @@ -usr/lib/libspice-client-glib-2.0.so -usr/lib/libspice-controller.so -usr/lib/pkgconfig/spice-controller.pc -usr/lib/pkgconfig/spice-client-glib-2.0.pc +usr/lib/*/libspice-client-glib-2.0.so +usr/lib/*/libspice-controller.so +usr/lib/*/pkgconfig/spice-controller.pc +usr/lib/*/pkgconfig/spice-client-glib-2.0.pc usr/include/spice-client-glib-2.0 usr/include/spice-controller usr/share/vala/vapi/spice-protocol.vapi diff -Nru spice-gtk-0.9/debian/libspice-client-gtk-2.0-1.install spice-gtk-0.12/debian/libspice-client-gtk-2.0-1.install --- spice-gtk-0.9/debian/libspice-client-gtk-2.0-1.install 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/libspice-client-gtk-2.0-1.install 2012-06-26 12:18:50.000000000 +0000 @@ -1 +1 @@ -usr/lib/libspice-client-gtk-2.0.so.* +usr/lib/*/libspice-client-gtk-2.0.so.* diff -Nru spice-gtk-0.9/debian/libspice-client-gtk-2.0-dev.install spice-gtk-0.12/debian/libspice-client-gtk-2.0-dev.install --- spice-gtk-0.9/debian/libspice-client-gtk-2.0-dev.install 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/libspice-client-gtk-2.0-dev.install 2012-06-26 12:18:50.000000000 +0000 @@ -1,5 +1,7 @@ usr/include/spice-client-gtk-2.0/* -usr/lib/libspice-client-gtk-2.0.so -usr/lib/pkgconfig/spice-client-gtk-2.0.pc +usr/lib/*/libspice-client-gtk-2.0.so +usr/lib/*/pkgconfig/spice-client-gtk-2.0.pc usr/share/gtk-doc usr/share/gir-1.0/SpiceClientGtk-2.0.gir +usr/share/vala/vapi/spice-client-gtk-2.0.deps +usr/share/vala/vapi/spice-client-gtk-2.0.vapi diff -Nru spice-gtk-0.9/debian/libspice-client-gtk-3.0-1.install spice-gtk-0.12/debian/libspice-client-gtk-3.0-1.install --- spice-gtk-0.9/debian/libspice-client-gtk-3.0-1.install 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/libspice-client-gtk-3.0-1.install 2012-06-26 12:18:50.000000000 +0000 @@ -1 +1 @@ -usr/lib/libspice-client-gtk-3.0.so.* +usr/lib/*/libspice-client-gtk-3.0.so.* diff -Nru spice-gtk-0.9/debian/libspice-client-gtk-3.0-dev.install spice-gtk-0.12/debian/libspice-client-gtk-3.0-dev.install --- spice-gtk-0.9/debian/libspice-client-gtk-3.0-dev.install 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/libspice-client-gtk-3.0-dev.install 2012-06-26 12:18:50.000000000 +0000 @@ -1,6 +1,6 @@ usr/include/spice-client-gtk-3.0/* -usr/lib/libspice-client-gtk-3.0.so -usr/lib/pkgconfig/spice-client-gtk-3.0.pc +usr/lib/*/libspice-client-gtk-3.0.so +usr/lib/*/pkgconfig/spice-client-gtk-3.0.pc usr/share/gir-1.0/SpiceClientGtk-3.0.gir usr/share/vala/vapi/spice-client-gtk-3.0.deps usr/share/vala/vapi/spice-client-gtk-3.0.vapi diff -Nru spice-gtk-0.9/debian/patches/fix-parsing-uri-query.patch spice-gtk-0.12/debian/patches/fix-parsing-uri-query.patch --- spice-gtk-0.9/debian/patches/fix-parsing-uri-query.patch 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/debian/patches/fix-parsing-uri-query.patch 2012-06-26 12:18:50.000000000 +0000 @@ -0,0 +1,46 @@ +From da0071300e1191f26757b4cf5146418c8b1db997 Mon Sep 17 00:00:00 2001 +From: Marc-André Lureau +Date: Wed, 02 May 2012 12:01:16 +0000 +Subject: Fix parsing URI query + +Do not depend on uninitialized "len" variable to set the query string. + +https://bugzilla.redhat.com/show_bug.cgi?id=818169 +--- +diff --git a/gtk/spice-session.c b/gtk/spice-session.c +index 959e099..b3c66ce 100644 +--- a/gtk/spice-session.c ++++ b/gtk/spice-session.c +@@ -249,7 +249,6 @@ static int spice_uri_parse(SpiceSession *session, const char *original_uri) + gchar key[32], value[128]; + gchar *host = NULL, *port = NULL, *tls_port = NULL, *uri = NULL, *password = NULL; + gchar **target_key; +- int len; + gchar *path = NULL; + gchar *authority = NULL; + gchar *query = NULL; +@@ -277,12 +276,10 @@ static int spice_uri_parse(SpiceSession *session, const char *original_uri) + + if (path) { + size_t prefix = strcspn(path, URI_QUERY_START); +- if (len) +- query = path + prefix; ++ query = path + prefix; + } else { + size_t prefix = strcspn(authority, URI_QUERY_START); +- if (len) +- query = authority + prefix; ++ query = authority + prefix; + } + + if (query && query[0]) { +@@ -320,6 +317,7 @@ static int spice_uri_parse(SpiceSession *session, const char *original_uri) + } + + while (query && query[0] != '\0') { ++ int len; + if (sscanf(query, "%31[-a-zA-Z0-9]=%127[^;&]%n", key, value, &len) != 2) { + g_warning("Failed to parse URI query '%s'", query); + goto fail; +-- +cgit v0.9.0.2-2-gbebe diff -Nru spice-gtk-0.9/debian/patches/fix-spice-audio-binding.patch spice-gtk-0.12/debian/patches/fix-spice-audio-binding.patch --- spice-gtk-0.9/debian/patches/fix-spice-audio-binding.patch 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/debian/patches/fix-spice-audio-binding.patch 2012-06-26 12:18:50.000000000 +0000 @@ -0,0 +1,40 @@ +From bac3fd5ae1b783237100a1e5edf989ce7bd39d51 Mon Sep 17 00:00:00 2001 +From: Marc-André Lureau +Date: Thu, 10 May 2012 00:55:14 +0000 +Subject: python: fix Spice.Audio binding + +The spice_audio_new() function is not correctly generated h2def.py +anymore because of the surrounding #ifdef and macros. Add it in +the manual.defs instead. + +Avoid API breakage: +2012-05-10 01:56:48,884 (cli:83): Uncaught exception: +Traceback (most recent call last): + File /usr/share/virt-manager/virtManager/console.py, line 475, in +_channel_new_cb + self.audio = spice.Audio(self.spice_session) +TypeError: GObject.__init__() takes exactly 0 arguments (1 given) + +https://bugzilla.redhat.com/show_bug.cgi?id=820335 +--- +diff --git a/gtk/spice-client-gtk-manual.defs b/gtk/spice-client-gtk-manual.defs +index 60f207c..9631b74 100644 +--- a/gtk/spice-client-gtk-manual.defs ++++ b/gtk/spice-client-gtk-manual.defs +@@ -104,3 +104,14 @@ + '("failed" "SPICE_CLIENT_ERROR_FAILED") + ) + ) ++ ++(define-function spice_audio_new ++ (c-name "spice_audio_new") ++ (is-constructor-of "SpiceAudio") ++ (return-type "SpiceAudio*") ++ (parameters ++ '("SpiceSession*" "session") ++ '("GMainContext*" "context") ++ '("const-char*" "name") ++ ) ++) +-- +cgit v0.9.0.2-2-gbebe diff -Nru spice-gtk-0.9/debian/patches/remove-libjpeg-turbo-warning.patch spice-gtk-0.12/debian/patches/remove-libjpeg-turbo-warning.patch --- spice-gtk-0.9/debian/patches/remove-libjpeg-turbo-warning.patch 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/patches/remove-libjpeg-turbo-warning.patch 2012-06-26 12:18:50.000000000 +0000 @@ -1,9 +1,9 @@ Debian don't have libjpeg-turbo now, disable this warning or compile will fail. --- a/gtk/channel-display-mjpeg.c +++ b/gtk/channel-display-mjpeg.c -@@ -83,7 +83,6 @@ - // requires jpeg-turbo - st->mjpeg_cinfo.out_color_space = JCS_EXT_BGRX; +@@ -86,7 +86,6 @@ + else + st->mjpeg_cinfo.out_color_space = JCS_EXT_BGRX; #else -#warning "You should consider building with libjpeg-turbo" st->mjpeg_cinfo.out_color_space = JCS_RGB; diff -Nru spice-gtk-0.9/debian/patches/series spice-gtk-0.12/debian/patches/series --- spice-gtk-0.9/debian/patches/series 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/patches/series 2012-06-26 12:18:50.000000000 +0000 @@ -1 +1,3 @@ remove-libjpeg-turbo-warning.patch +fix-parsing-uri-query.patch +fix-spice-audio-binding.patch diff -Nru spice-gtk-0.9/debian/rules spice-gtk-0.12/debian/rules --- spice-gtk-0.9/debian/rules 2012-02-13 23:16:15.000000000 +0000 +++ spice-gtk-0.12/debian/rules 2012-06-26 12:23:17.000000000 +0000 @@ -12,8 +12,10 @@ CFLAGS += -O2 endif -#libspice_client_gtkinclude_HEADERS and libspice_client_glibinclude_HEADERS -#should be copied to build directory, or build will fail. +DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/buildflags.mk build-arch: build build-indep: build @@ -23,17 +25,25 @@ touch build-stamp build-gtk2-stamp: - dh_auto_configure -- \ + mkdir build-gtk2 + ls |grep -v debian|grep -v build-gtk2|grep -v build-gtk3|xargs -i cp -r {} build-gtk2/ + cd build-gtk2 && ./configure --prefix=/usr --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \ --enable-smartcard=no --with-gtk=2.0 --disable-static \ - --enable-introspection --enable-usbredir=no - dh_auto_build + --enable-introspection --enable-vala \ + --enable-usbredir=yes --enable-polkit=yes \ + --with-usb-acl-helper-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/spice-gtk + $(MAKE) -C build-gtk2 touch build-gtk2-stamp build-gtk3-stamp: - dh_auto_configure -B$(CURDIR)/build-gtk3 -- \ + mkdir build-gtk3 + ls |grep -v debian|grep -v build-gtk2|grep -v build-gtk3|xargs -i cp -r {} build-gtk3/ + cd build-gtk3 && ./configure --prefix=/usr --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \ --enable-smartcard=no --with-gtk=3.0 --disable-static \ - --enable-introspection --enable-vala --enable-usbredir=no - dh_auto_build -B$(CURDIR)/build-gtk3 -D$(CURDIR) + --enable-introspection --enable-vala \ + --enable-usbredir=yes --enable-polkit=yes \ + --with-usb-acl-helper-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/spice-gtk + $(MAKE) -C build-gtk3 touch build-gtk3-stamp clean: clean-patched @@ -41,15 +51,7 @@ dh_testdir dh_testroot [ ! -d $(CURDIR)/build-gtk3 ] || rm -rf $(CURDIR)/build-gtk3 - [ ! -f Makefile ] || $(MAKE) clean - [ ! -f po/Makefile ] || $(MAKE) -C po distclean - [ ! -f common/Makefile ] || $(MAKE) -C common distclean - [ ! -f gtk/Makefile ] || $(MAKE) -C gtk distclean - [ ! -f python_modules/Makefile ] || $(MAKE) -C python_modules distclean - -rm Makefile data/Makefile config.h config.log config.status \ - libtool spice-client-glib-2.0.pc spice-client-gtk-2.0.pc \ - spice-client-gtk-3.0.pc spice-controller.pc doc/Makefile \ - doc/reference/Makefile vapi/Makefile stamp-h1 + [ ! -d $(CURDIR)/build-gtk2 ] || rm -rf $(CURDIR)/build-gtk2 dh_clean install: install-stamp @@ -59,7 +61,7 @@ dh_prep dh_installdirs $(MAKE) -C $(CURDIR)/build-gtk3 install DESTDIR=$(CURDIR)/debian/tmp - $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp + $(MAKE) -C $(CURDIR)/build-gtk2 install DESTDIR=$(CURDIR)/debian/tmp mv $(CURDIR)/debian/tmp/usr/bin/snappy $(CURDIR)/debian/tmp/usr/bin/spicy-snapshot dh_install --sourcedir=debian/tmp touch install-stamp @@ -67,6 +69,7 @@ binary-arch: build install dh_testdir dh_testroot + dh_install --list-missing dh_installchangelogs dh_installdocs dh_installexamples diff -Nru spice-gtk-0.9/doc/Makefile.in spice-gtk-0.12/doc/Makefile.in --- spice-gtk-0.9/doc/Makefile.in 2012-01-31 10:22:59.000000000 +0000 +++ spice-gtk-0.12/doc/Makefile.in 2012-04-24 11:21:03.000000000 +0000 @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -37,22 +37,24 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/check_python.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/intltool.m4 \ - $(top_srcdir)/m4/ld-version.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/ld-version.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/manywarnings.m4 \ + $(top_srcdir)/m4/spice-compile-warnings.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = @@ -118,6 +120,7 @@ CELT051_LIBDIR = @CELT051_LIBDIR@ CELT051_LIBS = @CELT051_LIBS@ CFLAGS = @CFLAGS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ @@ -168,6 +171,10 @@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ @@ -223,8 +230,6 @@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PROTOCOL_CFLAGS = @PROTOCOL_CFLAGS@ -PROTOCOL_LIBS = @PROTOCOL_LIBS@ PULSE_CFLAGS = @PULSE_CFLAGS@ PULSE_LIBS = @PULSE_LIBS@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ @@ -244,7 +249,6 @@ SMARTCARD_CFLAGS = @SMARTCARD_CFLAGS@ SMARTCARD_LIBS = @SMARTCARD_LIBS@ SPICE_CFLAGS = @SPICE_CFLAGS@ -SPICE_COMMON_SRCDIR = @SPICE_COMMON_SRCDIR@ SPICE_GLIB_CFLAGS = @SPICE_GLIB_CFLAGS@ SPICE_GLIB_REQUIRES = @SPICE_GLIB_REQUIRES@ SPICE_GTK_API_VERSION = @SPICE_GTK_API_VERSION@ @@ -253,14 +257,19 @@ SPICE_GTK_REQUIRES = @SPICE_GTK_REQUIRES@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ +STOW = @STOW@ STRIP = @STRIP@ USBREDIR_CFLAGS = @USBREDIR_CFLAGS@ USBREDIR_LIBS = @USBREDIR_LIBS@ +USB_IDS = @USB_IDS@ USE_NLS = @USE_NLS@ VALAC = @VALAC@ VAPIDIR = @VAPIDIR@ VAPIGEN = @VAPIGEN@ VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_LDFLAGS = @WARN_LDFLAGS@ +WARN_PYFLAGS = @WARN_PYFLAGS@ XGETTEXT = @XGETTEXT@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ @@ -298,6 +307,8 @@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ @@ -316,6 +327,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ @@ -570,10 +582,15 @@ installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: diff -Nru spice-gtk-0.9/doc/reference/html/annotation-glossary.html spice-gtk-0.12/doc/reference/html/annotation-glossary.html --- spice-gtk-0.9/doc/reference/html/annotation-glossary.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/annotation-glossary.html 2012-04-24 11:26:38.000000000 +0000 @@ -20,7 +20,9 @@   -E +A +  |  + E  |  T @@ -28,6 +30,10 @@

Annotation Glossary

+

A

+
+allow-none
+

NULL is ok, both for passing and for returning.

E

element-type
diff -Nru spice-gtk-0.9/doc/reference/html/api-index-full.html spice-gtk-0.12/doc/reference/html/api-index-full.html --- spice-gtk-0.9/doc/reference/html/api-index-full.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/api-index-full.html 2012-04-24 11:26:38.000000000 +0000 @@ -65,12 +65,16 @@
+spice_audio_get, function in SpiceAudio +
+
+
spice_audio_new, function in SpiceAudio

C

-SpiceChannel, struct in SpiceChannel +SpiceChannel, struct in SpiceChannel
@@ -98,7 +102,7 @@
-SpiceChannelClass, struct in SpiceChannel +SpiceChannelClass, struct in SpiceChannel
@@ -134,6 +138,26 @@
+spice_channel_test_common_capability, function in SpiceChannel +
+
+
+spice_channel_type_to_string, function in SpiceChannel +
+
+
+SpiceClientError, enum in SpiceSession +
+
+
+SPICE_CLIENT_ERROR, macro in SpiceSession +
+
+
+spice_client_error_quark, function in SpiceSession +
+
+
SpiceCursorChannel, struct in SpiceCursorChannel
@@ -207,6 +231,10 @@
+SpiceDisplay:zoom-level, object property in SpiceDisplay +
+
+
SpiceDisplayChannel, struct in SpiceDisplayChannel
@@ -474,6 +502,10 @@
+spice_main_agent_test_capability, function in SpiceMainChannel +
+
+
spice_main_clipboard_grab, function in SpiceMainChannel
@@ -506,9 +538,17 @@
+spice_main_send_monitor_config, function in SpiceMainChannel +
+
+
spice_main_set_display, function in SpiceMainChannel
+
+spice_main_set_display_enabled, function in SpiceMainChannel +
+

P

SpicePlaybackChannel, struct in SpicePlaybackChannel @@ -546,6 +586,10 @@ SpicePlaybackChannelClass, struct in SpicePlaybackChannel
+
+spice_playback_channel_set_delay, function in SpicePlaybackChannel +
+

R

SpiceRecordChannel, struct in SpiceRecordChannel @@ -581,7 +625,7 @@

S

-SpiceSession, struct in SpiceSession +SpiceSession, struct in SpiceSession
@@ -649,6 +693,10 @@
+SpiceSession:name, object property in SpiceSession +
+
+
SpiceSession:password, object property in SpiceSession
@@ -685,11 +733,15 @@
+SpiceSession:uuid, object property in SpiceSession +
+
+
SpiceSession:verify, object property in SpiceSession
-SpiceSessionClass, struct in SpiceSession +SpiceSessionClass, struct in SpiceSession
@@ -713,6 +765,14 @@
+spice_session_get_read_only, function in SpiceSession +
+
+
+spice_session_has_channel_type, function in SpiceSession +
+
+
spice_session_new, function in SpiceSession
@@ -799,6 +859,10 @@
+SpiceUsbDeviceManager::device-error, object signal in SpiceUsbDeviceManager +
+
+
SpiceUsbDeviceManager::device-removed, object signal in SpiceUsbDeviceManager
@@ -851,6 +915,18 @@
+spice_usb_device_manager_can_redirect_device, function in SpiceUsbDeviceManager +
+
+
+spice_usb_device_manager_connect_device_async, function in SpiceUsbDeviceManager +
+
+
+spice_usb_device_manager_connect_device_finish, function in SpiceUsbDeviceManager +
+
+
spice_usb_device_manager_disconnect_device, function in SpiceUsbDeviceManager
diff -Nru spice-gtk-0.9/doc/reference/html/ch01.html spice-gtk-0.12/doc/reference/html/ch01.html --- spice-gtk-0.9/doc/reference/html/ch01.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/ch01.html 2012-04-24 11:26:38.000000000 +0000 @@ -21,7 +21,7 @@

-Object Hierarchy

+Object Hierarchy
     GObject
         SpiceAudio
@@ -35,13 +35,12 @@
             SpiceSmartcardChannel
             SpiceUsbredirChannel
         GInitiallyUnowned
-            GtkWidget
-                GtkDrawingArea
+            GtkWidget
+                GtkDrawingArea
                     SpiceDisplay
-                GtkContainer
-                    GtkBox
-                        GtkVBox
-                            SpiceUsbDeviceWidget
+                GtkContainer
+                    GtkBox
+                        SpiceUsbDeviceWidget
         SpiceGtkSession
         SpiceSession
         SpiceSmartcardManager
diff -Nru spice-gtk-0.9/doc/reference/html/ch02.html spice-gtk-0.12/doc/reference/html/ch02.html
--- spice-gtk-0.9/doc/reference/html/ch02.html	2012-01-31 13:32:39.000000000 +0000
+++ spice-gtk-0.12/doc/reference/html/ch02.html	2012-04-24 11:26:38.000000000 +0000
@@ -21,7 +21,7 @@
 
 

-Session and Channels Objects, from spice-client-glib

+Session and Channels Objects, from spice-client-glib
Spice Session — handles connection details, and active channels diff -Nru spice-gtk-0.9/doc/reference/html/ch03.html spice-gtk-0.12/doc/reference/html/ch03.html --- spice-gtk-0.9/doc/reference/html/ch03.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/ch03.html 2012-04-24 11:26:38.000000000 +0000 @@ -21,7 +21,7 @@

-GTK Widget, from spice-client-gtk

+GTK Widget, from spice-client-gtk
Spice GTK Session — handles GTK connection details diff -Nru spice-gtk-0.9/doc/reference/html/index.sgml spice-gtk-0.12/doc/reference/html/index.sgml --- spice-gtk-0.9/doc/reference/html/index.sgml 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/index.sgml 2012-04-24 11:26:37.000000000 +0000 @@ -15,10 +15,18 @@ + + + + + + + + @@ -34,6 +42,7 @@ + @@ -43,6 +52,7 @@ + @@ -66,6 +76,8 @@ + + @@ -145,6 +157,9 @@ + + + @@ -185,6 +200,7 @@ + @@ -284,6 +300,7 @@ + @@ -314,6 +331,7 @@ + @@ -355,8 +373,11 @@ - + + + + @@ -364,6 +385,7 @@ + @@ -372,6 +394,7 @@ + diff -Nru spice-gtk-0.9/doc/reference/html/object-tree.html spice-gtk-0.12/doc/reference/html/object-tree.html --- spice-gtk-0.9/doc/reference/html/object-tree.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/object-tree.html 2012-04-24 11:26:38.000000000 +0000 @@ -35,13 +35,12 @@ SpiceSmartcardChannel SpiceUsbredirChannel GInitiallyUnowned - GtkWidget - GtkDrawingArea + GtkWidget + GtkDrawingArea SpiceDisplay - GtkContainer - GtkBox - GtkVBox - SpiceUsbDeviceWidget + GtkContainer + GtkBox + SpiceUsbDeviceWidget SpiceGtkSession SpiceSession SpiceSmartcardManager diff -Nru spice-gtk-0.9/doc/reference/html/SpiceAudio.html spice-gtk-0.12/doc/reference/html/SpiceAudio.html --- spice-gtk-0.9/doc/reference/html/SpiceAudio.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/SpiceAudio.html 2012-04-24 11:26:38.000000000 +0000 @@ -51,6 +51,8 @@ struct SpiceAudio; struct SpiceAudioClass; +SpiceAudio * spice_audio_get (SpiceSession *session, + GMainContext *context); SpiceAudio * spice_audio_new (SpiceSession *session, GMainContext *context, const char *name); @@ -85,10 +87,6 @@

The SpiceAudio struct is opaque and should not be accessed directly.

-
-- -

@@ -110,13 +108,48 @@

+

spice_audio_get ()

+
SpiceAudio *        spice_audio_get                     (SpiceSession *session,
+                                                         GMainContext *context);
+

+Gets the SpiceAudio associated with the passed in SpiceSession. +A new SpiceAudio instance will be created the first time this +function is called for a certain SpiceSession. +

+

+Note that this function returns a weak reference, which should not be used +after the SpiceSession itself has been unref-ed by the caller. +

+
++ + + + + + + + + + + + + + +

session :

the SpiceSession to connect to

context :

a GMainContext to attach to (or NULL for default). [allow-none] +

Returns :

a weak reference to a SpiceAudio +instance or NULL if failed. [transfer none] +
+
+
+

spice_audio_new ()

SpiceAudio *        spice_audio_new                     (SpiceSession *session,
                                                          GMainContext *context,
                                                          const char *name);

Warning

-

spice_audio_new has been deprecated since version 0.8 and should not be used in newly-written code. Use spice_audio_get() instead

+

spice_audio_new has been deprecated since version 0.8 and should not be used in newly-written code. Use spice_audio_get() instead

Once instantiated, SpiceAudio will handle the playback and record diff -Nru spice-gtk-0.9/doc/reference/html/SpiceChannel.html spice-gtk-0.12/doc/reference/html/SpiceChannel.html --- spice-gtk-0.9/doc/reference/html/SpiceChannel.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/SpiceChannel.html 2012-04-24 11:26:38.000000000 +0000 @@ -51,8 +51,8 @@ #include <spice-channel.h> enum SpiceChannelEvent; -struct SpiceChannel; -struct SpiceChannelClass; + SpiceChannel; + SpiceChannelClass; SpiceChannel * spice_channel_new (SpiceSession *s, int type, @@ -65,6 +65,10 @@ SpiceChannelEvent reason); gboolean spice_channel_test_capability (SpiceChannel *channel, guint32 cap); +gboolean spice_channel_test_common_capability + (SpiceChannel *channel, + guint32 cap); +const gchar * spice_channel_type_to_string (gint type); void spice_channel_set_capability (SpiceChannel *channel, guint32 cap);

@@ -144,19 +148,19 @@
-

struct SpiceChannel

-
struct SpiceChannel;
+

SpiceChannel

+
typedef struct _SpiceChannel SpiceChannel;

-

struct SpiceChannelClass

-
struct SpiceChannelClass {
+

SpiceChannelClass

+
typedef struct {
     GObjectClass parent_class;
 
     /* signals, main context */
     void (*channel_event)(SpiceChannel *channel, SpiceChannelEvent event);
     void (*open_fd)(SpiceChannel *channel, int with_tls);
-};
+} SpiceChannelClass;
 

@@ -222,12 +226,17 @@

Connect the channel using fd socket.

+

+If fd is -1, a valid fd will be requested later via the +SpiceChannel::open-fd signal. +

- + @@ -274,6 +283,29 @@
+

spice_channel_test_common_capability ()

+
gboolean            spice_channel_test_common_capability
+                                                        (SpiceChannel *channel,
+                                                         guint32 cap);
+

+Test availability of remote "common channel capability". +

+

fd :

a file descriptor (socket)a file descriptor (socket) or -1. +request mechanism

Returns :

++ + + + +

Returns :

+TRUE if cap (common channel capability) is available.
+ +
+
+

spice_channel_type_to_string ()

+
const gchar *       spice_channel_type_to_string        (gint type);
+
+
+

spice_channel_set_capability ()

void                spice_channel_set_capability        (SpiceChannel *channel,
                                                          guint32 cap);
diff -Nru spice-gtk-0.9/doc/reference/html/SpiceCursorChannel.html spice-gtk-0.12/doc/reference/html/SpiceCursorChannel.html --- spice-gtk-0.9/doc/reference/html/SpiceCursorChannel.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/SpiceCursorChannel.html 2012-04-24 11:26:38.000000000 +0000 @@ -87,10 +87,6 @@

The SpiceCursorChannel struct is opaque and should not be accessed directly.

-
-- -

@@ -113,7 +109,7 @@ -

SpiceChannelClass parent_class;

+

SpiceChannelClass parent_class;

Parent class. diff -Nru spice-gtk-0.9/doc/reference/html/SpiceDisplayChannel.html spice-gtk-0.12/doc/reference/html/SpiceDisplayChannel.html --- spice-gtk-0.9/doc/reference/html/SpiceDisplayChannel.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/SpiceDisplayChannel.html 2012-04-24 11:26:38.000000000 +0000 @@ -101,10 +101,6 @@

The SpiceDisplayChannel struct is opaque and should not be accessed directly.

-
-- -

@@ -130,7 +126,7 @@ -

SpiceChannelClass parent_class;

+

SpiceChannelClass parent_class;

Parent class. diff -Nru spice-gtk-0.9/doc/reference/html/SpiceDisplay.html spice-gtk-0.12/doc/reference/html/SpiceDisplay.html --- spice-gtk-0.9/doc/reference/html/SpiceDisplay.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/SpiceDisplay.html 2012-04-24 11:26:38.000000000 +0000 @@ -83,8 +83,8 @@
   GObject
    +----GInitiallyUnowned
-         +----GtkWidget
-               +----GtkDrawingArea
+         +----GtkWidget
+               +----GtkDrawingArea
                      +----SpiceDisplay
 
@@ -96,7 +96,7 @@
 

Implemented Interfaces

SpiceDisplay implements - AtkImplementorIface and GtkBuildable.

+ AtkImplementorIface and GtkBuildable.

Properties

@@ -109,6 +109,7 @@ "resize-guest" gboolean : Read / Write / Construct "scaling" gboolean : Read / Write / Construct "session" SpiceSession* : Read / Write / Construct Only + "zoom-level" gint : Read / Write / Construct
@@ -439,6 +440,19 @@ SpiceSession for this SpiceDisplay

+
+
+

The "zoom-level" property

+
  "zoom-level"               gint                  : Read / Write / Construct
+

+Zoom level in percentage, from 10 to 400. Default to 100. +(this option is only supported with cairo backend when scaling +is enabled) +

+

Allowed values: [10,400]

+

Default value: 100

+

Since 0.10

+

Signal Details

diff -Nru spice-gtk-0.9/doc/reference/html/spice-gtk.devhelp2 spice-gtk-0.12/doc/reference/html/spice-gtk.devhelp2 --- spice-gtk-0.9/doc/reference/html/spice-gtk.devhelp2 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/spice-gtk.devhelp2 2012-04-24 11:26:37.000000000 +0000 @@ -34,17 +34,22 @@ - - + + + + + + + @@ -59,6 +64,7 @@ + @@ -68,18 +74,21 @@ + - - + + + + @@ -116,6 +125,9 @@ + + + @@ -145,6 +157,7 @@ + @@ -197,6 +210,7 @@ + @@ -208,6 +222,7 @@ + @@ -229,15 +244,22 @@ - + + + + + + + + diff -Nru spice-gtk-0.9/doc/reference/html/SpiceInputsChannel.html spice-gtk-0.12/doc/reference/html/SpiceInputsChannel.html --- spice-gtk-0.9/doc/reference/html/SpiceInputsChannel.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/SpiceInputsChannel.html 2012-04-24 11:26:38.000000000 +0000 @@ -123,10 +123,6 @@

The SpiceInputsChannel struct is opaque and should not be accessed directly.

-
-- -

@@ -145,7 +141,7 @@ -

SpiceChannelClass parent_class;

+

SpiceChannelClass parent_class;

Parent class. diff -Nru spice-gtk-0.9/doc/reference/html/SpiceMainChannel.html spice-gtk-0.12/doc/reference/html/SpiceMainChannel.html --- spice-gtk-0.9/doc/reference/html/SpiceMainChannel.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/SpiceMainChannel.html 2012-04-24 11:26:38.000000000 +0000 @@ -59,6 +59,12 @@ int y, int width, int height); +void spice_main_set_display_enabled (SpiceMainChannel *channel, + int id, + gboolean enabled); +gboolean spice_main_send_monitor_config (SpiceMainChannel *channel); +gboolean spice_main_agent_test_capability (SpiceMainChannel *channel, + guint32 cap); void spice_main_clipboard_selection_grab (SpiceMainChannel *channel, guint selection, guint32 *types, @@ -141,10 +147,6 @@

The SpiceMainChannel struct is opaque and should not be accessed directly.

-
-- -

@@ -164,7 +166,7 @@ -

SpiceChannelClass parent_class;

+

SpiceChannelClass parent_class;

Parent class. @@ -219,6 +221,66 @@

+

spice_main_set_display_enabled ()

+
void                spice_main_set_display_enabled      (SpiceMainChannel *channel,
+                                                         int id,
+                                                         gboolean enabled);
+

+When sending monitor configuration to agent guest, don't set +display id, which the agent translates to disabling the display +id. Note: this will take effect next time the monitor +configuration is sent. +

+
++ + + + + + + + + + + + + + +

channel :

a SpiceMainChannel +

id :

display channel ID (if -1: set all displays)

enabled :

wether display id is enabled
+

Since 0.6

+
+
+
+

spice_main_send_monitor_config ()

+
gboolean            spice_main_send_monitor_config      (SpiceMainChannel *channel);
+
+
+
+

spice_main_agent_test_capability ()

+
gboolean            spice_main_agent_test_capability    (SpiceMainChannel *channel,
+                                                         guint32 cap);
+

+Test capability of a remote agent. +

+
++ + + + + + + + + + +

cap :

an agent capability identifier

Returns :

+TRUE if cap (channel kind capability) is available.
+
+
+

spice_main_clipboard_selection_grab ()

void                spice_main_clipboard_selection_grab (SpiceMainChannel *channel,
                                                          guint selection,
diff -Nru spice-gtk-0.9/doc/reference/html/SpicePlaybackChannel.html spice-gtk-0.12/doc/reference/html/SpicePlaybackChannel.html
--- spice-gtk-0.9/doc/reference/html/SpicePlaybackChannel.html	2012-01-31 13:32:39.000000000 +0000
+++ spice-gtk-0.12/doc/reference/html/SpicePlaybackChannel.html	2012-04-24 11:26:38.000000000 +0000
@@ -52,6 +52,8 @@
 
 struct              SpicePlaybackChannel;
 struct              SpicePlaybackChannelClass;
+void                spice_playback_channel_set_delay    (SpicePlaybackChannel *channel,
+                                                         guint32 delay_ms);
 
@@ -101,10 +103,6 @@

The SpicePlaybackChannel struct is opaque and should not be accessed directly.

-
-- -

@@ -126,7 +124,7 @@ -

SpiceChannelClass parent_class;

+

SpiceChannelClass parent_class;

Parent class. @@ -144,6 +142,12 @@
+
+
+

spice_playback_channel_set_delay ()

+
void                spice_playback_channel_set_delay    (SpicePlaybackChannel *channel,
+                                                         guint32 delay_ms);
+

Property Details

diff -Nru spice-gtk-0.9/doc/reference/html/SpiceRecordChannel.html spice-gtk-0.12/doc/reference/html/SpiceRecordChannel.html --- spice-gtk-0.9/doc/reference/html/SpiceRecordChannel.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/SpiceRecordChannel.html 2012-04-24 11:26:38.000000000 +0000 @@ -107,10 +107,6 @@

The SpiceRecordChannel struct is opaque and should not be accessed directly.

-
-- -

@@ -132,7 +128,7 @@ -

SpiceChannelClass parent_class;

+

SpiceChannelClass parent_class;

Parent class. diff -Nru spice-gtk-0.9/doc/reference/html/SpiceSession.html spice-gtk-0.12/doc/reference/html/SpiceSession.html --- spice-gtk-0.9/doc/reference/html/SpiceSession.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/SpiceSession.html 2012-04-24 11:26:38.000000000 +0000 @@ -50,19 +50,26 @@
 #include <spice-session.h>
 
-struct              SpiceSession;
-struct              SpiceSessionClass;
+                    SpiceSession;
+                    SpiceSessionClass;
 SpiceSession *      spice_session_new                   (void);
 gboolean            spice_session_connect               (SpiceSession *session);
 gboolean            spice_session_open_fd               (SpiceSession *session,
                                                          int fd);
 void                spice_session_disconnect            (SpiceSession *session);
 GList *             spice_session_get_channels          (SpiceSession *session);
+gboolean            spice_session_get_read_only         (SpiceSession *session);
+gboolean            spice_session_has_channel_type      (SpiceSession *session,
+                                                         gint type);
 
 enum                SpiceSessionMigration;
 enum                SpiceSessionVerify;
 GOptionGroup *      spice_get_option_group              (void);
 void                spice_set_session_option            (SpiceSession *session);
+
+enum                SpiceClientError;
+#define             SPICE_CLIENT_ERROR
+GQuark              spice_client_error_quark            (void);
 
@@ -97,6 +104,7 @@ "host" gchar* : Read / Write / Construct "inhibit-keyboard-grab" gboolean : Read / Write "migration-state" SpiceSessionMigration : Read + "name" gchar* : Read "password" gchar* : Read / Write "port" gchar* : Read / Write "protocol" gint : Read / Write / Construct @@ -106,6 +114,7 @@ "smartcard-db" gchar* : Read / Write "tls-port" gchar* : Read / Write "uri" gchar* : Read / Write + "uuid" gpointer : Read "verify" SpiceSessionVerify : Read / Write / Construct
@@ -147,19 +156,19 @@

Details

-

struct SpiceSession

-
struct SpiceSession;
+

SpiceSession

+
typedef struct _SpiceSession SpiceSession;

-

struct SpiceSessionClass

-
struct SpiceSessionClass {
+

SpiceSessionClass

+
typedef struct {
     GObjectClass parent_class;
 
     /* signals */
     void (*channel_new)(SpiceSession *session, SpiceChannel *channel);
     void (*channel_destroy)(SpiceSession *session, SpiceChannel *channel);
-};
+} SpiceSessionClass;
 

@@ -205,11 +214,15 @@ descriptor. This is useful if you create the fd yourself, for example to setup a SSH tunnel.

+

+If fd is -1, a valid fd will be requested later via the +SpiceChannel::open-fd signal. +

- +

fd :

a file descriptora file descriptor (socket) or -1
@@ -247,6 +260,49 @@
+

spice_session_get_read_only ()

+
gboolean            spice_session_get_read_only         (SpiceSession *session);
+
++ + + + + + + + + + +

session :

a SpiceSession +

Returns :

wether the session is in read-only mode.
+
+
+
+

spice_session_has_channel_type ()

+
gboolean            spice_session_has_channel_type      (SpiceSession *session,
+                                                         gint type);
+

+See if there is a type channel in the channels associated with this +session. +

+
++ + + + + + + + + + +

session :

a SpiceSession +

Returns :

TRUE if a type channel is available otherwise FALSE.
+
+
+

enum SpiceSessionMigration

typedef enum {
     SPICE_SESSION_MIGRATION_NONE,
@@ -313,6 +369,48 @@
 
 
+
+
+

enum SpiceClientError

+
typedef enum {
+    SPICE_CLIENT_ERROR_FAILED,
+    SPICE_CLIENT_USB_DEVICE_REJECTED,
+    SPICE_CLIENT_USB_DEVICE_LOST,
+} SpiceClientError;
+
+

+Error codes returned by spice-client API. +

+
++ + + + + + + + + + + + + + +

SPICE_CLIENT_ERROR_FAILED

generic error code +

SPICE_CLIENT_USB_DEVICE_REJECTED

SPICE_CLIENT_USB_DEVICE_LOST

+
+
+
+

SPICE_CLIENT_ERROR

+
#define SPICE_CLIENT_ERROR spice_client_error_quark()
+
+
+
+
+

spice_client_error_quark ()

+
GQuark              spice_client_error_quark            (void);
+

Property Details

@@ -334,6 +432,7 @@

Allowed values: >= 0

Default value: 0

+

Since 0.9


@@ -421,6 +520,7 @@

Allowed values: [0,134217728]

Default value: 0

+

Since 0.9


@@ -450,6 +550,16 @@

+

The "name" property

+
  "name"                     gchar*                : Read
+

+Spice server name. +

+

Default value: NULL

+

Since 0.11

+
+
+

The "password" property

  "password"                 gchar*                : Read / Write

@@ -537,6 +647,15 @@


+

The "uuid" property

+
  "uuid"                     gpointer              : Read
+

+Spice server uuid. +

+

Since 0.11

+
+
+

The "verify" property

  "verify"                   SpiceSessionVerify    : Read / Write / Construct

diff -Nru spice-gtk-0.9/doc/reference/html/SpiceSmartcardChannel.html spice-gtk-0.12/doc/reference/html/SpiceSmartcardChannel.html --- spice-gtk-0.9/doc/reference/html/SpiceSmartcardChannel.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/SpiceSmartcardChannel.html 2012-04-24 11:26:38.000000000 +0000 @@ -80,10 +80,6 @@

The SpiceSmartcardChannel struct is opaque and should not be accessed directly.

-
-- -

@@ -100,7 +96,7 @@
- +

SpiceChannelClass parent_class;

SpiceChannelClass parent_class;

Parent class.
diff -Nru spice-gtk-0.9/doc/reference/html/SpiceUsbDeviceManager.html spice-gtk-0.12/doc/reference/html/SpiceUsbDeviceManager.html --- spice-gtk-0.9/doc/reference/html/SpiceUsbDeviceManager.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/SpiceUsbDeviceManager.html 2012-04-24 11:26:38.000000000 +0000 @@ -66,9 +66,24 @@ void spice_usb_device_manager_disconnect_device (SpiceUsbDeviceManager *manager, SpiceUsbDevice *device); +gboolean spice_usb_device_manager_can_redirect_device + (SpiceUsbDeviceManager *self, + SpiceUsbDevice *device, + GError **err); +void spice_usb_device_manager_connect_device_async + (SpiceUsbDeviceManager *manager, + SpiceUsbDevice *device, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean spice_usb_device_manager_connect_device_finish + (SpiceUsbDeviceManager *self, + GAsyncResult *res, + GError **err); + + SpiceUsbDevice; gchar * spice_usb_device_get_description (SpiceUsbDevice *device, const gchar *format); - SpiceUsbDevice;
@@ -123,7 +139,8 @@

Details

SPICE_TYPE_USB_DEVICE

-
#define             SPICE_TYPE_USB_DEVICE
+
#define SPICE_TYPE_USB_DEVICE                    (spice_usb_device_get_type())
+

@@ -132,10 +149,6 @@

The SpiceUsbDeviceManager struct is opaque and should not be accessed directly.

-
-- -

@@ -150,6 +163,8 @@ SpiceUsbDevice *device); void (*auto_connect_failed) (SpiceUsbDeviceManager *manager, SpiceUsbDevice *device, GError *error); + void (*device_error) (SpiceUsbDeviceManager *manager, + SpiceUsbDevice *device, GError *error); };

@@ -174,6 +189,10 @@

auto_connect_failed ()

Signal class handler for the "auto-connect-failed" signal. + +

device_error ()

+ +
@@ -281,6 +300,62 @@
+

spice_usb_device_manager_can_redirect_device ()

+
gboolean            spice_usb_device_manager_can_redirect_device
+                                                        (SpiceUsbDeviceManager *self,
+                                                         SpiceUsbDevice *device,
+                                                         GError **err);
+
+
+
+

spice_usb_device_manager_connect_device_async ()

+
void                spice_usb_device_manager_connect_device_async
+                                                        (SpiceUsbDeviceManager *manager,
+                                                         SpiceUsbDevice *device,
+                                                         GCancellable *cancellable,
+                                                         GAsyncReadyCallback callback,
+                                                         gpointer user_data);
+
++ + + + + + + + + + + + + + + + + + + + + + +

manager :

the SpiceUsbDeviceManager manager

device :

a SpiceUsbDevice to redirect

cancellable :

a GCancellable or NULL

callback :

a GAsyncReadyCallback to call when the request is satisfied

user_data :

data to pass to callback
+
+
+
+

spice_usb_device_manager_connect_device_finish ()

+
gboolean            spice_usb_device_manager_connect_device_finish
+                                                        (SpiceUsbDeviceManager *self,
+                                                         GAsyncResult *res,
+                                                         GError **err);
+
+
+
+

SpiceUsbDevice

+
typedef struct _SpiceUsbDevice SpiceUsbDevice;
+
+
+

spice_usb_device_get_description ()

gchar *             spice_usb_device_get_description    (SpiceUsbDevice *device,
                                                          const gchar *format);
@@ -323,11 +398,6 @@
-
-
-

SpiceUsbDevice

-
typedef struct _SpiceUsbDevice SpiceUsbDevice;
-

Property Details

@@ -447,6 +517,43 @@

+

The "device-error" signal

+
void                user_function                      (SpiceUsbDeviceManager *manager,
+                                                        SpiceUsbDevice        *device,
+                                                        GError                *error,
+                                                        gpointer               user_data)      : Run First
+

+The "device-error" signal is emitted whenever an +error happens which causes a device to no longer be available to the +guest. +

+
++ + + + + + + + + + + + + + + + + + +

manager :

+SpiceUsbDeviceManager that emitted the signal

device :

+SpiceUsbDevice boxed object corresponding to the device which has an error

error :

+GError describing the error

user_data :

user data set when the signal handler was connected.
+
+
+

The "device-removed" signal

void                user_function                      (SpiceUsbDeviceManager *manager,
                                                         SpiceUsbDevice        *device,
diff -Nru spice-gtk-0.9/doc/reference/html/SpiceUsbDeviceWidget.html spice-gtk-0.12/doc/reference/html/SpiceUsbDeviceWidget.html
--- spice-gtk-0.9/doc/reference/html/SpiceUsbDeviceWidget.html	2012-01-31 13:32:39.000000000 +0000
+++ spice-gtk-0.12/doc/reference/html/SpiceUsbDeviceWidget.html	2012-04-24 11:26:38.000000000 +0000
@@ -55,7 +55,7 @@
 struct              SpiceUsbDeviceWidget;
 struct              SpiceUsbDeviceWidgetClass;
 
-GtkWidget *         spice_usb_device_widget_new         (SpiceSession *session,
+GtkWidget *         spice_usb_device_widget_new         (SpiceSession *session,
                                                          const gchar *device_format_string);
 
@@ -64,18 +64,17 @@
   GObject
    +----GInitiallyUnowned
-         +----GtkWidget
-               +----GtkContainer
-                     +----GtkBox
-                           +----GtkVBox
-                                 +----SpiceUsbDeviceWidget
+         +----GtkWidget
+               +----GtkContainer
+                     +----GtkBox
+                           +----SpiceUsbDeviceWidget
 

Implemented Interfaces

SpiceUsbDeviceWidget implements - AtkImplementorIface, GtkBuildable and GtkOrientable.

+ AtkImplementorIface, GtkBuildable and GtkOrientable.

Properties

@@ -105,16 +104,12 @@

The SpiceUsbDeviceWidget struct is opaque and should not be accessed directly.

-
-- -

struct SpiceUsbDeviceWidgetClass

struct SpiceUsbDeviceWidgetClass {
-    GtkVBoxClass parent_class;
+    _SpiceGtkBoxClass parent_class;
 
     /* signals */
     void (*connect_failed) (SpiceUsbDeviceWidget *widget,
@@ -128,8 +123,8 @@
 
 
 
-

GtkVBoxClass parent_class;

-Parent class. +

_SpiceGtkBoxClass parent_class;

+

connect_failed ()

@@ -141,7 +136,7 @@

spice_usb_device_widget_new ()

-
GtkWidget *         spice_usb_device_widget_new         (SpiceSession *session,
+
GtkWidget *         spice_usb_device_widget_new         (SpiceSession *session,
                                                          const gchar *device_format_string);
diff -Nru spice-gtk-0.9/doc/reference/html/SpiceUsbredirChannel.html spice-gtk-0.12/doc/reference/html/SpiceUsbredirChannel.html --- spice-gtk-0.9/doc/reference/html/SpiceUsbredirChannel.html 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/html/SpiceUsbredirChannel.html 2012-04-24 11:26:38.000000000 +0000 @@ -73,10 +73,6 @@

The SpiceUsbredirChannel struct is opaque and should not be accessed directly.

-
-- -

@@ -93,7 +89,7 @@
- +

SpiceChannelClass parent_class;

SpiceChannelClass parent_class;

Parent class.
diff -Nru spice-gtk-0.9/doc/reference/Makefile.am spice-gtk-0.12/doc/reference/Makefile.am --- spice-gtk-0.9/doc/reference/Makefile.am 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/doc/reference/Makefile.am 2012-04-11 13:51:02.000000000 +0000 @@ -1,113 +1,63 @@ -## Process this file with automake to produce Makefile.in +NULL = -# We require automake 1.6 at least. AUTOMAKE_OPTIONS = 1.6 +DOC_MODULE = spice-gtk -# This is a blank Makefile.am for using gtk-doc. -# Copy this to your project's API docs directory and modify the variables to -# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples -# of using the various options. +# The top-level SGML file +DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.xml -# The name of the module, e.g. 'glib'. -DOC_MODULE=spice-gtk - -# Uncomment for versioned docs and specify the version of the module, e.g. '2'. -#DOC_MODULE_VERSION=2 - - -# The top-level SGML file. You can change this if you want to. -DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml - -# Directories containing the source code, relative to $(srcdir). -# gtk-doc will search all .c and .h files beneath these paths -# for inline comments documenting functions and macros. -# e.g. DOC_SOURCE_DIR=../../../gtk ../../../gdk -DOC_SOURCE_DIR=../../gtk - -# Extra options to pass to gtkdoc-scangobj. Not normally needed. -SCANGOBJ_OPTIONS= +# Source code location +DOC_SOURCE_DIR = $(top_srcdir)/gtk # Extra options to supply to gtkdoc-scan. -# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" -SCAN_OPTIONS= +SCAN_OPTIONS = \ + --deprecated-guards="SPICE_DISABLE_DEPRECATED" \ + --ignore-decorators="G_GNUC_INTERNAL" # Extra options to supply to gtkdoc-mkdb. -# e.g. MKDB_OPTIONS=--xml-mode --output-format=xml -MKDB_OPTIONS=--xml-mode --output-format=xml - -# Extra options to supply to gtkdoc-mktmpl -# e.g. MKTMPL_OPTIONS=--only-section-tmpl -MKTMPL_OPTIONS= - -# Extra options to supply to gtkdoc-mkhtml -MKHTML_OPTIONS= - -# Extra options to supply to gtkdoc-fixref. Not normally needed. -# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html -FIXXREF_OPTIONS= +MKDB_OPTIONS = --xml-mode --output-format=xml # Used for dependencies. The docs will be rebuilt if any of these change. -# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h -# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c -HFILE_GLOB=$(top_srcdir)/gtk/*.h -CFILE_GLOB=$(top_srcdir)/gtk/*.c - -# Extra header to include when scanning, which are not under DOC_SOURCE_DIR -# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h -EXTRA_HFILES= +HFILE_GLOB = $(top_srcdir)/gtk/*.h +CFILE_GLOB = $(top_srcdir)/gtk/*.c # Header files to ignore when scanning. Use base file name, no paths -# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h -IGNORE_HFILES= \ - spice-display-mjpeg.h \ +IGNORE_HFILES= \ + bio-gsocket.h \ channel-display-priv.h \ - spice-channel-priv.h \ + channel-usbredir-priv.h \ continuation.h \ + controller \ coroutine.h \ decode.h \ + display \ gio-coroutine.h \ + glib-compat.h \ + smartcard-manager-priv.h \ + spice-audio-priv.h \ spice-channel-cache.h \ + spice-channel-priv.h \ + spice-cmdline.h \ + spice-common.h \ + spice-gstaudio.h \ + spice-gtk-session-priv.h \ spice-marshal.h \ spice-pulse.h \ spice-session-priv.h \ - spice-types.h \ - spice-cmdline.h \ - tcp.h \ - vncdisplaykeymap.h - -# Images to copy into HTML directory. -# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png -HTML_IMAGES= - -# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). -# e.g. content_files=running.sgml building.sgml changes-2.0.sgml -content_files= - -# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded -# These files must be listed here *and* in content_files -# e.g. expand_content_files=running.sgml -expand_content_files= + spice-util-priv.h \ + spice-widget-priv.h \ + usb-acl-helper.h \ + usb-device-manager-priv.h \ + usbutil.h \ + vncdisplaykeymap.h \ + $(NULL) # CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. -# Only needed if you are using gtkdoc-scangobj to dynamically query widget -# signals and properties. -# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) -# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/gtk -I$(top_builddir)/gtk $(SPICE_GLIB_CFLAGS) $(SPICE_GTK_CFLAGS) -GTKDOC_LIBS=$(top_builddir)/gtk/libspice-client-glib-2.0.la $(top_builddir)/gtk/libspice-client-gtk-$(SPICE_GTK_API_VERSION).la +GTKDOC_CFLAGS = -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/gtk -I$(top_builddir)/gtk $(SPICE_GLIB_CFLAGS) $(SPICE_GTK_CFLAGS) $(COMMON_CFLAGS) +GTKDOC_LIBS = $(top_builddir)/gtk/libspice-client-glib-2.0.la $(top_builddir)/gtk/libspice-client-gtk-$(SPICE_GTK_API_VERSION).la -# This includes the standard gtk-doc make rules, copied by gtkdocize. include $(top_srcdir)/gtk-doc.make -# Other files to distribute -# e.g. EXTRA_DIST += version.xml.in -EXTRA_DIST += - -# Files not to distribute -# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types -# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt -#DISTCLEANFILES += - # Comment this out if you want 'make check' to test you doc status # and run some sanity checks if ENABLE_GTK_DOC diff -Nru spice-gtk-0.9/doc/reference/Makefile.in spice-gtk-0.12/doc/reference/Makefile.in --- spice-gtk-0.9/doc/reference/Makefile.in 2012-01-31 10:22:59.000000000 +0000 +++ spice-gtk-0.12/doc/reference/Makefile.in 2012-04-24 11:21:03.000000000 +0000 @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -44,22 +44,24 @@ subdir = doc/reference ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/check_python.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/intltool.m4 \ - $(top_srcdir)/m4/ld-version.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/ld-version.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/manywarnings.m4 \ + $(top_srcdir)/m4/spice-compile-warnings.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = @@ -85,6 +87,7 @@ CELT051_LIBDIR = @CELT051_LIBDIR@ CELT051_LIBS = @CELT051_LIBS@ CFLAGS = @CFLAGS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ @@ -135,6 +138,10 @@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ @@ -190,8 +197,6 @@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PROTOCOL_CFLAGS = @PROTOCOL_CFLAGS@ -PROTOCOL_LIBS = @PROTOCOL_LIBS@ PULSE_CFLAGS = @PULSE_CFLAGS@ PULSE_LIBS = @PULSE_LIBS@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ @@ -211,7 +216,6 @@ SMARTCARD_CFLAGS = @SMARTCARD_CFLAGS@ SMARTCARD_LIBS = @SMARTCARD_LIBS@ SPICE_CFLAGS = @SPICE_CFLAGS@ -SPICE_COMMON_SRCDIR = @SPICE_COMMON_SRCDIR@ SPICE_GLIB_CFLAGS = @SPICE_GLIB_CFLAGS@ SPICE_GLIB_REQUIRES = @SPICE_GLIB_REQUIRES@ SPICE_GTK_API_VERSION = @SPICE_GTK_API_VERSION@ @@ -220,14 +224,19 @@ SPICE_GTK_REQUIRES = @SPICE_GTK_REQUIRES@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ +STOW = @STOW@ STRIP = @STRIP@ USBREDIR_CFLAGS = @USBREDIR_CFLAGS@ USBREDIR_LIBS = @USBREDIR_LIBS@ +USB_IDS = @USB_IDS@ USE_NLS = @USE_NLS@ VALAC = @VALAC@ VAPIDIR = @VAPIDIR@ VAPIGEN = @VAPIGEN@ VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_LDFLAGS = @WARN_LDFLAGS@ +WARN_PYFLAGS = @WARN_PYFLAGS@ XGETTEXT = @XGETTEXT@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ @@ -265,6 +274,8 @@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ @@ -283,106 +294,69 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ - -# We require automake 1.6 at least. +NULL = AUTOMAKE_OPTIONS = 1.6 - -# This is a blank Makefile.am for using gtk-doc. -# Copy this to your project's API docs directory and modify the variables to -# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples -# of using the various options. - -# The name of the module, e.g. 'glib'. DOC_MODULE = spice-gtk -# Uncomment for versioned docs and specify the version of the module, e.g. '2'. -#DOC_MODULE_VERSION=2 - -# The top-level SGML file. You can change this if you want to. +# The top-level SGML file DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.xml -# Directories containing the source code, relative to $(srcdir). -# gtk-doc will search all .c and .h files beneath these paths -# for inline comments documenting functions and macros. -# e.g. DOC_SOURCE_DIR=../../../gtk ../../../gdk -DOC_SOURCE_DIR = ../../gtk - -# Extra options to pass to gtkdoc-scangobj. Not normally needed. -SCANGOBJ_OPTIONS = +# Source code location +DOC_SOURCE_DIR = $(top_srcdir)/gtk # Extra options to supply to gtkdoc-scan. -# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" -SCAN_OPTIONS = +SCAN_OPTIONS = \ + --deprecated-guards="SPICE_DISABLE_DEPRECATED" \ + --ignore-decorators="G_GNUC_INTERNAL" + # Extra options to supply to gtkdoc-mkdb. -# e.g. MKDB_OPTIONS=--xml-mode --output-format=xml MKDB_OPTIONS = --xml-mode --output-format=xml -# Extra options to supply to gtkdoc-mktmpl -# e.g. MKTMPL_OPTIONS=--only-section-tmpl -MKTMPL_OPTIONS = - -# Extra options to supply to gtkdoc-mkhtml -MKHTML_OPTIONS = - -# Extra options to supply to gtkdoc-fixref. Not normally needed. -# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html -FIXXREF_OPTIONS = - # Used for dependencies. The docs will be rebuilt if any of these change. -# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h -# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c HFILE_GLOB = $(top_srcdir)/gtk/*.h CFILE_GLOB = $(top_srcdir)/gtk/*.c -# Extra header to include when scanning, which are not under DOC_SOURCE_DIR -# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h -EXTRA_HFILES = - # Header files to ignore when scanning. Use base file name, no paths -# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h IGNORE_HFILES = \ - spice-display-mjpeg.h \ + bio-gsocket.h \ channel-display-priv.h \ - spice-channel-priv.h \ + channel-usbredir-priv.h \ continuation.h \ + controller \ coroutine.h \ decode.h \ + display \ gio-coroutine.h \ + glib-compat.h \ + smartcard-manager-priv.h \ + spice-audio-priv.h \ spice-channel-cache.h \ + spice-channel-priv.h \ + spice-cmdline.h \ + spice-common.h \ + spice-gstaudio.h \ + spice-gtk-session-priv.h \ spice-marshal.h \ spice-pulse.h \ spice-session-priv.h \ - spice-types.h \ - spice-cmdline.h \ - tcp.h \ - vncdisplaykeymap.h - + spice-util-priv.h \ + spice-widget-priv.h \ + usb-acl-helper.h \ + usb-device-manager-priv.h \ + usbutil.h \ + vncdisplaykeymap.h \ + $(NULL) -# Images to copy into HTML directory. -# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png -HTML_IMAGES = - -# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). -# e.g. content_files=running.sgml building.sgml changes-2.0.sgml -content_files = - -# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded -# These files must be listed here *and* in content_files -# e.g. expand_content_files=running.sgml -expand_content_files = # CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. -# Only needed if you are using gtkdoc-scangobj to dynamically query widget -# signals and properties. -# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) -# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -GTKDOC_CFLAGS = -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/gtk -I$(top_builddir)/gtk $(SPICE_GLIB_CFLAGS) $(SPICE_GTK_CFLAGS) +GTKDOC_CFLAGS = -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/gtk -I$(top_builddir)/gtk $(SPICE_GLIB_CFLAGS) $(SPICE_GTK_CFLAGS) $(COMMON_CFLAGS) GTKDOC_LIBS = $(top_builddir)/gtk/libspice-client-glib-2.0.la $(top_builddir)/gtk/libspice-client-gtk-$(SPICE_GTK_API_VERSION).la @GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -404,12 +378,10 @@ $(DOC_MODULE)-sections.txt \ $(DOC_MODULE)-overrides.txt +EXTRA_DIST = \ + $(HTML_IMAGES) \ + $(SETUP_FILES) -# This includes the standard gtk-doc make rules, copied by gtkdocize. - -# Other files to distribute -# e.g. EXTRA_DIST += version.xml.in -EXTRA_DIST = $(HTML_IMAGES) $(SETUP_FILES) DOC_STAMPS = setup-build.stamp scan-build.stamp sgml-build.stamp \ html-build.stamp pdf-build.stamp \ sgml.stamp html.stamp pdf.stamp @@ -432,11 +404,6 @@ @ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_PDF_FALSE@PDF_BUILD_STAMP = @ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_PDF_TRUE@PDF_BUILD_STAMP = pdf-build.stamp -# Files not to distribute -# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types -# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt -#DISTCLEANFILES += - # Comment this out if you want 'make check' to test you doc status # and run some sanity checks @ENABLE_GTK_DOC_TRUE@TESTS_ENVIRONMENT = cd $(srcdir) && \ @@ -467,6 +434,7 @@ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; +$(top_srcdir)/gtk-doc.make: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -536,10 +504,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: diff -Nru spice-gtk-0.9/doc/reference/spice-gtk-sections.txt spice-gtk-0.12/doc/reference/spice-gtk-sections.txt --- spice-gtk-0.9/doc/reference/spice-gtk-sections.txt 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/doc/reference/spice-gtk-sections.txt 2012-04-24 11:26:37.000000000 +0000 @@ -3,6 +3,7 @@ SpicePlaybackChannel SpicePlaybackChannel SpicePlaybackChannelClass +spice_playback_channel_set_delay SPICE_PLAYBACK_CHANNEL SPICE_IS_PLAYBACK_CHANNEL @@ -25,11 +26,17 @@ spice_session_open_fd spice_session_disconnect spice_session_get_channels +spice_session_get_read_only +spice_session_has_channel_type SpiceSessionMigration SpiceSessionVerify spice_get_option_group spice_set_session_option + +SpiceClientError +SPICE_CLIENT_ERROR +spice_client_error_quark SPICE_SESSION SPICE_IS_SESSION @@ -40,6 +47,10 @@ SPICE_SESSION_GET_CLASS SPICE_TYPE_SESSION_VERIFY spice_session_verify_get_type +SPICE_TYPE_SESSION_MIGRATION +spice_session_migration_get_type + +SpiceSessionPrivate
@@ -48,8 +59,10 @@ SpiceMainChannel SpiceMainChannelClass -spice_main_channel spice_main_set_display +spice_main_set_display_enabled +spice_main_send_monitor_config +spice_main_agent_test_capability spice_main_clipboard_selection_grab spice_main_clipboard_selection_notify spice_main_clipboard_selection_release @@ -66,13 +79,14 @@ SPICE_MAIN_CHANNEL_CLASS SPICE_IS_MAIN_CHANNEL_CLASS SPICE_MAIN_CHANNEL_GET_CLASS + +SpiceMainChannelPrivate
spice-channel SpiceChannel SpiceChannelEvent -SpiceChannelVerify SpiceChannel SpiceChannelClass @@ -82,6 +96,8 @@ spice_channel_open_fd spice_channel_disconnect spice_channel_test_capability +spice_channel_test_common_capability +spice_channel_type_to_string spice_channel_set_capability SPICE_TYPE_CHANNEL_EVENT @@ -94,6 +110,9 @@ SPICE_IS_CHANNEL_CLASS SPICE_CHANNEL_GET_CLASS +SpiceMsgIn +SpiceMsgOut +SpiceChannelPrivate spice_msg_handler spice_msg_in spice_msg_out @@ -105,6 +124,7 @@ SpiceAudio SpiceAudioClass +spice_audio_get spice_audio_new SPICE_AUDIO @@ -114,6 +134,8 @@ SPICE_AUDIO_CLASS SPICE_IS_AUDIO_CLASS SPICE_AUDIO_GET_CLASS + +SpiceAudioPrivate
@@ -267,10 +289,13 @@ spice_usb_device_manager_get spice_usb_device_manager_get_devices spice_usb_device_manager_is_device_connected -spice_usb_device_manager_connect_device spice_usb_device_manager_disconnect_device -spice_usb_device_get_description +spice_usb_device_manager_can_redirect_device +spice_usb_device_manager_connect_device_async +spice_usb_device_manager_connect_device_finish + SpiceUsbDevice +spice_usb_device_get_description SPICE_USB_DEVICE_MANAGER SPICE_IS_USB_DEVICE_MANAGER @@ -301,7 +326,7 @@ SPICE_IS_GTK_SESSION_CLASS SPICE_GTK_SESSION_GET_CLASS -SpiceGtkSectionPrivate +SpiceGtkSessionPrivate
@@ -355,8 +380,11 @@ SPICE_USB_DEVICE_WIDGET_CLASS SPICE_IS_USB_DEVICE_WIDGET_CLASS SPICE_USB_DEVICE_WIDGET_GET_CLASS +SPICE_TYPE_USB_DEVICE_WIDGET SpiceUsbDeviceWidgetPrivate +SpiceGtkBox +SpiceGtkBoxClass
@@ -367,5 +395,7 @@ SPICE_DEBUG spice_util_get_debug SPICE_RESERVED_PADDING +SPICE_DEPRECATED_FOR +spice_g_signal_connect_object
diff -Nru spice-gtk-0.9/gtk/bio-gsocket.c spice-gtk-0.12/gtk/bio-gsocket.c --- spice-gtk-0.9/gtk/bio-gsocket.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/gtk/bio-gsocket.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,111 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2012 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#include +#include + +#include "spice-util.h" +#include "bio-gsocket.h" + +typedef struct bio_gsocket_method { + BIO_METHOD method; + GSocket *gsocket; +} bio_gsocket_method; + +#define BIO_GET_GSOCKET(bio) (((bio_gsocket_method*)bio->method)->gsocket) + +static int bio_gsocket_bwrite(BIO *bio, const char *in, int inl) +{ + int ret; + GError *error = NULL; + + ret = g_socket_send(BIO_GET_GSOCKET(bio), + in, inl, NULL, &error); + BIO_clear_retry_flags(bio); + + if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) + BIO_set_retry_write(bio); + if (error != NULL) { + g_warning("%s", error->message); + g_clear_error(&error); + } + + return ret; +} + +static int bio_gsocket_bread(BIO *bio, char *out, int outl) +{ + int ret; + GError *error = NULL; + + ret = g_socket_receive(BIO_GET_GSOCKET(bio), + out, outl, NULL, &error); + BIO_clear_retry_flags(bio); + + if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) + BIO_set_retry_read(bio); + else if (error != NULL) { + g_warning("%s", error->message); + g_clear_error(&error); + } + + return ret; +} + +static int bio_gsocket_destroy(BIO *bio) +{ + if (bio == NULL || bio->method == NULL) + return 0; + + SPICE_DEBUG("bio gsocket destroy"); + g_free(bio->method); + bio->method = NULL;; + + return 1; +} + +static int bio_gsocket_bputs(BIO *bio, const char *str) +{ + int n, ret; + + n = strlen(str); + ret = bio_gsocket_bwrite(bio, str, n); + + return ret; +} + +G_GNUC_INTERNAL +BIO* bio_new_gsocket(GSocket *gsocket) +{ + BIO *bio = BIO_new_socket(g_socket_get_fd(gsocket), BIO_NOCLOSE); + + bio_gsocket_method *bio_method = g_new(bio_gsocket_method, 1); + bio_method->method = *bio->method; + bio_method->gsocket = gsocket; + + bio->method->destroy(bio); + bio->method = (BIO_METHOD*)bio_method; + + bio->method->bwrite = bio_gsocket_bwrite; + bio->method->bread = bio_gsocket_bread; + bio->method->bputs = bio_gsocket_bputs; + bio->method->destroy = bio_gsocket_destroy; + + return bio; +} + diff -Nru spice-gtk-0.9/gtk/bio-gsocket.h spice-gtk-0.12/gtk/bio-gsocket.h --- spice-gtk-0.9/gtk/bio-gsocket.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/gtk/bio-gsocket.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,30 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2012 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifndef BIO_GSOCKET_H_ +# define BIO_GSOCKET_H_ + +#include +#include + +G_BEGIN_DECLS + +BIO* bio_new_gsocket(GSocket *gsocket); + +G_END_DECLS + +#endif /* !BIO_GSOCKET_H_ */ diff -Nru spice-gtk-0.9/gtk/channel-cursor.h spice-gtk-0.12/gtk/channel-cursor.h --- spice-gtk-0.9/gtk/channel-cursor.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-cursor.h 2012-04-11 13:51:02.000000000 +0000 @@ -35,7 +35,6 @@ /** * SpiceCursorChannel: - * @parent: Parent instance. * * The #SpiceCursorChannel struct is opaque and should not be accessed directly. */ diff -Nru spice-gtk-0.9/gtk/channel-display.c spice-gtk-0.12/gtk/channel-display.c --- spice-gtk-0.9/gtk/channel-display.c 2012-01-27 08:56:56.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-display.c 2012-04-11 13:51:02.000000000 +0000 @@ -73,7 +73,6 @@ #ifdef WIN32 HDC dc; #endif - gboolean migrate_wait_primary; }; G_DEFINE_TYPE(SpiceDisplayChannel, spice_display_channel, SPICE_TYPE_CHANNEL) @@ -97,10 +96,9 @@ static guint signals[SPICE_DISPLAY_LAST_SIGNAL]; static void spice_display_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg); -static void spice_display_channel_init(SpiceDisplayChannel *channel); static void spice_display_channel_up(SpiceChannel *channel); -static void clear_surfaces(SpiceChannel *channel); +static void clear_surfaces(SpiceChannel *channel, gboolean keep_primary); static void clear_streams(SpiceChannel *channel); static display_surface *find_surface(SpiceDisplayChannelPrivate *c, int surface_id); static gboolean display_stream_render(display_stream *st); @@ -124,11 +122,7 @@ static void spice_display_channel_finalize(GObject *object) { - SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(object)->priv; - - c->migrate_wait_primary = FALSE; - - clear_surfaces(SPICE_CHANNEL(object)); + clear_surfaces(SPICE_CHANNEL(object), FALSE); clear_streams(SPICE_CHANNEL(object)); if (G_OBJECT_CLASS(spice_display_channel_parent_class)->finalize) @@ -191,13 +185,9 @@ /* main or coroutine context */ static void spice_display_channel_reset(SpiceChannel *channel, gboolean migrating) { - SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(channel)->priv; - /* palettes, images, and glz_window are cleared in the session */ - - c->migrate_wait_primary = migrating; clear_streams(channel); - clear_surfaces(channel); + clear_surfaces(channel, TRUE); SPICE_CHANNEL_CLASS(spice_display_channel_parent_class)->channel_reset(channel, migrating); } @@ -550,8 +540,8 @@ } #endif -SpiceCanvas *surfaces_get(SpiceImageSurfaces *surfaces, - uint32_t surface_id) +static SpiceCanvas *surfaces_get(SpiceImageSurfaces *surfaces, + uint32_t surface_id) { SpiceDisplayChannelPrivate *c = SPICE_CONTAINEROF(surfaces, SpiceDisplayChannelPrivate, image_surfaces); @@ -619,10 +609,8 @@ display_surface *primary = find_surface(c, 0); if (primary) { - if (c->migrate_wait_primary && - primary->width == surface->width && + if (primary->width == surface->width && primary->height == surface->height) { - c->migrate_wait_primary = FALSE; SPICE_DEBUG("Reusing existing primary surface"); return 0; } @@ -634,8 +622,6 @@ } SPICE_DEBUG("display: create primary canvas"); - c->migrate_wait_primary = FALSE; - #ifdef HAVE_SYS_SHM_H surface->shmid = shmget(IPC_PRIVATE, surface->size, IPC_CREAT | 0777); if (surface->shmid >= 0) { @@ -706,6 +692,7 @@ #ifdef HAVE_SYS_SHM_H else { shmdt(surface->data); + shmctl(surface->shmid, IPC_RMID, 0); } #endif surface->shmid = -1; @@ -730,7 +717,7 @@ return NULL; } -static void clear_surfaces(SpiceChannel *channel) +static void clear_surfaces(SpiceChannel *channel, gboolean keep_primary) { SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(channel)->priv; display_surface *surface; @@ -740,8 +727,8 @@ surface = SPICE_CONTAINEROF(item, display_surface, link); item = ring_next(&c->surfaces, item); - if (c->migrate_wait_primary && surface->primary) { - SPICE_DEBUG("Try to keep exisiting primary surface during migration"); + if (keep_primary && surface->primary) { + SPICE_DEBUG("keeping exisiting primary surface, migration or reset"); continue; } @@ -816,11 +803,6 @@ surface->size = surface->height * surface->stride; surface->primary = true; create_canvas(channel, surface); -#ifdef HAVE_SYS_SHM_H - if (surface->shmid != -1) { - shmctl(surface->shmid, IPC_RMID, 0); - } -#endif } /* coroutine context */ diff -Nru spice-gtk-0.9/gtk/channel-display.h spice-gtk-0.12/gtk/channel-display.h --- spice-gtk-0.9/gtk/channel-display.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-display.h 2012-04-11 13:51:02.000000000 +0000 @@ -35,7 +35,6 @@ /** * SpiceDisplayChannel: - * @parent: Parent instance. * * The #SpiceDisplayChannel struct is opaque and should not be accessed directly. */ diff -Nru spice-gtk-0.9/gtk/channel-display-mjpeg.c spice-gtk-0.12/gtk/channel-display-mjpeg.c --- spice-gtk-0.9/gtk/channel-display-mjpeg.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-display-mjpeg.c 2012-04-11 13:51:02.000000000 +0000 @@ -65,6 +65,7 @@ void stream_mjpeg_data(display_stream *st) { SpiceMsgDisplayStreamCreate *info = spice_msg_in_parsed(st->msg_create); + gboolean back_compat = st->channel->priv->peer_hdr.major_version == 1; int width = info->stream_width; int height = info->stream_height; uint8_t *dest; @@ -80,7 +81,10 @@ jpeg_read_header(&st->mjpeg_cinfo, 1); #ifdef JCS_EXTENSIONS // requires jpeg-turbo - st->mjpeg_cinfo.out_color_space = JCS_EXT_BGRX; + if (back_compat) + st->mjpeg_cinfo.out_color_space = JCS_EXT_RGBX; + else + st->mjpeg_cinfo.out_color_space = JCS_EXT_BGRX; #else #warning "You should consider building with libjpeg-turbo" st->mjpeg_cinfo.out_color_space = JCS_RGB; @@ -121,11 +125,20 @@ uint8_t *s = lines[0]; uint32_t *d = (uint32_t *)s; - for (unsigned int j = lines_read * width; j > 0; ) { - j -= 1; // reverse order, bad for cache? - d[j] = s[j * 3 + 0] << 16 | - s[j * 3 + 1] << 8 | - s[j * 3 + 2]; + if (back_compat) { + for (unsigned int j = lines_read * width; j > 0; ) { + j -= 1; // reverse order, bad for cache? + d[j] = s[j * 3 + 0] | + s[j * 3 + 1] << 8 | + s[j * 3 + 2] << 16; + } + } else { + for (unsigned int j = lines_read * width; j > 0; ) { + j -= 1; // reverse order, bad for cache? + d[j] = s[j * 3 + 0] << 16 | + s[j * 3 + 1] << 8 | + s[j * 3 + 2]; + } } } #endif diff -Nru spice-gtk-0.9/gtk/channel-display-priv.h spice-gtk-0.12/gtk/channel-display-priv.h --- spice-gtk-0.9/gtk/channel-display-priv.h 2012-01-27 08:56:56.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-display-priv.h 2012-04-11 13:51:02.000000000 +0000 @@ -26,13 +26,12 @@ #endif #include -/* spice/common */ -#include "canvas_base.h" -#include "canvas_utils.h" -#include "sw_canvas.h" -#include "ring.h" -#include "quic.h" -#include "rop3.h" +#include "common/canvas_base.h" +#include "common/canvas_utils.h" +#include "common/sw_canvas.h" +#include "common/ring.h" +#include "common/quic.h" +#include "common/rop3.h" G_BEGIN_DECLS diff -Nru spice-gtk-0.9/gtk/channel-inputs.h spice-gtk-0.12/gtk/channel-inputs.h --- spice-gtk-0.9/gtk/channel-inputs.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-inputs.h 2012-04-11 13:51:02.000000000 +0000 @@ -41,7 +41,6 @@ /** * SpiceInputsChannel: - * @parent: Parent instance. * * The #SpiceInputsChannel struct is opaque and should not be accessed directly. */ diff -Nru spice-gtk-0.9/gtk/channel-main.c spice-gtk-0.12/gtk/channel-main.c --- spice-gtk-0.9/gtk/channel-main.c 2012-01-27 08:56:56.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-main.c 2012-04-24 10:41:41.000000000 +0000 @@ -20,6 +20,7 @@ #include "spice-common.h" #include "spice-marshal.h" +#include "spice-util-priv.h" #include "spice-channel-priv.h" #include "spice-session-priv.h" @@ -161,6 +162,7 @@ c->agent_msg_queue = g_queue_new(); spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE); + spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_MAIN_CAP_NAME_AND_UUID); } static void spice_main_get_property(GObject *object, @@ -736,6 +738,7 @@ /* ------------------------------------------------------------------ */ + static void agent_free_msg_queue(SpiceMainChannel *channel) { SpiceMainChannelPrivate *c = channel->priv; @@ -768,17 +771,31 @@ } /* any context: the message is not flushed immediately, - you can wakeup() the channel coroutine or send_msg_queue() */ -static void agent_msg_queue(SpiceMainChannel *channel, int type, int size, void *data) + you can wakeup() the channel coroutine or send_msg_queue() + + expected arguments, pair of data/data_size to send terminated with NULL: + agent_msg_queue_many(main, VD_AGENT_..., + &foo, sizeof(Foo), + data, data_size, NULL); +*/ +G_GNUC_NULL_TERMINATED +static void agent_msg_queue_many(SpiceMainChannel *channel, int type, const void *data, ...) { + va_list args; SpiceMainChannelPrivate *c = channel->priv; SpiceMsgOut *out; VDAgentMessage msg; - void *payload; - guint32 paysize; - guint8 *d = data; + guint8 *payload; + gsize paysize, s, mins, size = 0; + const guint8 *d; - g_assert(VD_AGENT_MAX_DATA_SIZE > sizeof(VDAgentMessage)); // could be a static compilation check + G_STATIC_ASSERT(VD_AGENT_MAX_DATA_SIZE > sizeof(VDAgentMessage)); + + va_start(args, data); + for (d = data; d != NULL; d = va_arg(args, void*)) { + size += va_arg(args, gsize); + } + va_end(args); msg.protocol = VD_AGENT_PROTOCOL; msg.type = type; @@ -789,21 +806,42 @@ out = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_MAIN_AGENT_DATA); payload = spice_marshaller_reserve_space(out->marshaller, paysize); memcpy(payload, &msg, sizeof(VDAgentMessage)); - memcpy(payload + sizeof(VDAgentMessage), d, paysize - sizeof(VDAgentMessage)); - size -= (paysize - sizeof(VDAgentMessage)); - d += (paysize - sizeof(VDAgentMessage)); - g_queue_push_tail(c->agent_msg_queue, out); - - while ((paysize = MIN(VD_AGENT_MAX_DATA_SIZE, size)) > 0) { - out = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_MAIN_AGENT_DATA); - payload = spice_marshaller_reserve_space(out->marshaller, paysize); - memcpy(payload, d, paysize); + payload += sizeof(VDAgentMessage); + paysize -= sizeof(VDAgentMessage); + if (paysize == 0) { g_queue_push_tail(c->agent_msg_queue, out); - size -= paysize; - d += paysize; + out = NULL; + } + + va_start(args, data); + for (d = data; size > 0; d = va_arg(args, void*)) { + s = va_arg(args, gsize); + while (s > 0) { + if (out == NULL) { + paysize = MIN(VD_AGENT_MAX_DATA_SIZE, size); + out = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_MAIN_AGENT_DATA); + payload = spice_marshaller_reserve_space(out->marshaller, paysize); + } + mins = MIN(paysize, s); + memcpy(payload, d, mins); + d += mins; + payload += mins; + s -= mins; + size -= mins; + paysize -= mins; + if (paysize == 0) { + g_queue_push_tail(c->agent_msg_queue, out); + out = NULL; + } + } } + va_end(args); + g_warn_if_fail(out == NULL); } +#define agent_msg_queue(Channel, Type, Size, Data) \ + agent_msg_queue_many((Channel), (Type), (Data), (Size), NULL) + /* any context: the message is not flushed immediately, you can wakeup() the channel coroutine or send_msg_queue() */ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel) @@ -835,7 +873,7 @@ for (i = 0; i < SPICE_N_ELEMENTS(c->display); i++) { if (!c->display[i].enabled) continue; - mon->monitors[j].depth = 32; + mon->monitors[j].depth = c->display_color_depth ? c->display_color_depth : 32; mon->monitors[j].width = c->display[j].width; mon->monitors[j].height = c->display[j].height; mon->monitors[j].x = c->display[j].x; @@ -968,7 +1006,7 @@ g_return_if_fail(VD_AGENT_HAS_CAPABILITY(c->agent_caps, sizeof(c->agent_caps), VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)); - msgsize = sizeof(VDAgentClipboard) + size; + msgsize = sizeof(VDAgentClipboard); if (HAS_CLIPBOARD_SELECTION(c)) msgsize += 4; else if (selection != VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD) { @@ -987,9 +1025,7 @@ } cb->type = type; - memcpy(cb->data, data, size); - - agent_msg_queue(channel, VD_AGENT_CLIPBOARD, msgsize, msg); + agent_msg_queue_many(channel, VD_AGENT_CLIPBOARD, msg, msgsize, data, size, NULL); } /* any context: the message is not flushed immediately, @@ -1054,6 +1090,16 @@ } /* coroutine context */ +static void set_agent_connected(SpiceMainChannel *channel, gboolean connected) +{ + SpiceMainChannelPrivate *c = channel->priv; + + c->agent_connected = connected; + SPICE_DEBUG("agent connected: %s", spice_yes_no(connected)); + g_object_notify_main_context(G_OBJECT(channel), "agent-connected"); +} + +/* coroutine context */ static void agent_start(SpiceMainChannel *channel) { SpiceMainChannelPrivate *c = channel->priv; @@ -1062,7 +1108,7 @@ }; SpiceMsgOut *out; - c->agent_connected = true; + set_agent_connected(channel, TRUE); c->agent_caps_received = false; emit_main_context(channel, SPICE_MAIN_AGENT_UPDATE); @@ -1081,7 +1127,7 @@ { SpiceMainChannelPrivate *c = SPICE_MAIN_CHANNEL(channel)->priv; - c->agent_connected = false; + set_agent_connected(channel, FALSE); c->agent_caps_received = false; c->agent_display_config_sent = false; emit_main_context(channel, SPICE_MAIN_AGENT_UPDATE); @@ -1142,6 +1188,29 @@ } /* coroutine context */ +static void main_handle_name(SpiceChannel *channel, SpiceMsgIn *in) +{ + SpiceMsgMainName *name = spice_msg_in_parsed(in); + SpiceSession *session = spice_channel_get_session(channel); + + SPICE_DEBUG("server name: %s", name->name); + spice_session_set_name(session, (const gchar *)name->name); +} + +/* coroutine context */ +static void main_handle_uuid(SpiceChannel *channel, SpiceMsgIn *in) +{ + SpiceMsgMainUuid *uuid = spice_msg_in_parsed(in); + SpiceSession *session = spice_channel_get_session(channel); + gchar *uuid_str = spice_uuid_to_string(uuid->uuid); + + SPICE_DEBUG("server uuid: %s", uuid_str); + spice_session_set_uuid(session, uuid->uuid); + + g_free(uuid_str); +} + +/* coroutine context */ static void main_handle_mm_time(SpiceChannel *channel, SpiceMsgIn *in) { SpiceSession *session; @@ -1448,7 +1517,7 @@ coroutine_yieldto(mig->from, NULL); break; default: - g_warning("error or unhandled channel event during migration: %d", event); + SPICE_DEBUG("error or unhandled channel event during migration: %d", event); /* go back to main channel to report error */ coroutine_yieldto(mig->from, NULL); } @@ -1637,8 +1706,8 @@ g_return_if_fail(subject[mig->cert_subject_size - 1] == '\0'); } - SPICE_DEBUG("migrate_switch %s %d %d", - host, mig->port, mig->sport); + SPICE_DEBUG("migrate_switch %s %d %d %s", + host, mig->port, mig->sport, subject); if (c->switch_host_delayed_id != 0) { g_warning("Switching host already in progress, aborting it"); @@ -1648,7 +1717,10 @@ session = spice_channel_get_session(channel); spice_session_set_migration_state(session, SPICE_SESSION_MIGRATION_SWITCHING); - g_object_set(session, "host", host, NULL); + g_object_set(session, + "host", host, + "cert-subject", subject, + NULL); spice_session_set_port(session, mig->port, FALSE); spice_session_set_port(session, mig->sport, TRUE); @@ -1668,6 +1740,8 @@ static const spice_msg_handler main_handlers[] = { [ SPICE_MSG_MAIN_INIT ] = main_handle_init, + [ SPICE_MSG_MAIN_NAME ] = main_handle_name, + [ SPICE_MSG_MAIN_UUID ] = main_handle_uuid, [ SPICE_MSG_MAIN_CHANNELS_LIST ] = main_handle_channels_list, [ SPICE_MSG_MAIN_MOUSE_MODE ] = main_handle_mouse_mode, [ SPICE_MSG_MAIN_MULTI_MEDIA_TIME ] = main_handle_mm_time, @@ -1716,6 +1790,27 @@ } /** + * spice_main_agent_test_capability: + * @channel: + * @cap: an agent capability identifier + * + * Test capability of a remote agent. + * + * Returns: %TRUE if @cap (channel kind capability) is available. + **/ +gboolean spice_main_agent_test_capability(SpiceMainChannel *channel, guint32 cap) +{ + g_return_val_if_fail(SPICE_IS_MAIN_CHANNEL(channel), FALSE); + + SpiceMainChannelPrivate *c = channel->priv; + + if (!c->agent_caps_received) + return FALSE; + + return VD_AGENT_HAS_CAPABILITY(c->agent_caps, sizeof(c->agent_caps), cap); +} + +/** * spice_main_set_display: * @channel: * @id: display channel ID @@ -1760,7 +1855,6 @@ * * Deprecated: 0.6: use spice_main_clipboard_selection_grab() instead. **/ -G_GNUC_DEPRECATED_FOR(spice_main_clipboard_selection_grab) void spice_main_clipboard_grab(SpiceMainChannel *channel, guint32 *types, int ntypes) { spice_main_clipboard_selection_grab(channel, VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD, types, ntypes); @@ -1796,7 +1890,6 @@ * * Deprecated: 0.6: use spice_main_clipboard_selection_release() instead. **/ -G_GNUC_DEPRECATED_FOR(spice_main_clipboard_selection_release) void spice_main_clipboard_release(SpiceMainChannel *channel) { spice_main_clipboard_selection_release(channel, VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD); @@ -1837,7 +1930,6 @@ * * Deprecated: 0.6: use spice_main_clipboard_selection_notify() instead. **/ -G_GNUC_DEPRECATED_FOR(spice_main_clipboard_selection_notify) void spice_main_clipboard_notify(SpiceMainChannel *channel, guint32 type, const guchar *data, size_t size) { @@ -1877,7 +1969,6 @@ * * Deprecated: 0.6: use spice_main_clipboard_selection_request() instead. **/ -G_GNUC_DEPRECATED_FOR(spice_main_clipboard_selection_request) void spice_main_clipboard_request(SpiceMainChannel *channel, guint32 type) { spice_main_clipboard_selection_request(channel, VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD, type); @@ -1906,7 +1997,7 @@ /** * spice_main_set_display_enabled: * @channel: a #SpiceMainChannel - * @id: display channel ID + * @id: display channel ID (if -1: set all displays) * @enabled: wether display @id is enabled * * When sending monitor configuration to agent guest, don't set @@ -1920,7 +2011,16 @@ { g_return_if_fail(channel != NULL); g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel)); + g_return_if_fail(id >= -1); SpiceMainChannelPrivate *c = channel->priv; - c->display[id].enabled = enabled; + + if (id == -1) { + gint i; + for (i = 0; i < G_N_ELEMENTS(c->display); i++) + c->display[i].enabled = enabled; + } else { + g_return_if_fail(id < G_N_ELEMENTS(c->display)); + c->display[id].enabled = enabled; + } } diff -Nru spice-gtk-0.9/gtk/channel-main.h spice-gtk-0.12/gtk/channel-main.h --- spice-gtk-0.9/gtk/channel-main.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-main.h 2012-04-11 13:51:02.000000000 +0000 @@ -35,7 +35,6 @@ /** * SpiceMainChannel: - * @parent: Parent instance. * * The #SpiceMainChannel struct is opaque and should not be accessed directly. */ @@ -73,16 +72,24 @@ void spice_main_set_display_enabled(SpiceMainChannel *channel, int id, gboolean enabled); gboolean spice_main_send_monitor_config(SpiceMainChannel *channel); -void spice_main_clipboard_grab(SpiceMainChannel *channel, guint32 *types, int ntypes); -void spice_main_clipboard_release(SpiceMainChannel *channel); -void spice_main_clipboard_notify(SpiceMainChannel *channel, guint32 type, const guchar *data, size_t size); -void spice_main_clipboard_request(SpiceMainChannel *channel, guint32 type); - void spice_main_clipboard_selection_grab(SpiceMainChannel *channel, guint selection, guint32 *types, int ntypes); void spice_main_clipboard_selection_release(SpiceMainChannel *channel, guint selection); void spice_main_clipboard_selection_notify(SpiceMainChannel *channel, guint selection, guint32 type, const guchar *data, size_t size); void spice_main_clipboard_selection_request(SpiceMainChannel *channel, guint selection, guint32 type); +gboolean spice_main_agent_test_capability(SpiceMainChannel *channel, guint32 cap); + +#ifndef SPICE_DISABLE_DEPRECATED +SPICE_DEPRECATED_FOR(spice_main_clipboard_selection_grab) +void spice_main_clipboard_grab(SpiceMainChannel *channel, guint32 *types, int ntypes); +SPICE_DEPRECATED_FOR(spice_main_clipboard_selection_release) +void spice_main_clipboard_release(SpiceMainChannel *channel); +SPICE_DEPRECATED_FOR(spice_main_clipboard_selection_notify) +void spice_main_clipboard_notify(SpiceMainChannel *channel, guint32 type, const guchar *data, size_t size); +SPICE_DEPRECATED_FOR(spice_main_clipboard_selection_request) +void spice_main_clipboard_request(SpiceMainChannel *channel, guint32 type); +#endif + G_END_DECLS #endif /* __SPICE_CLIENT_MAIN_CHANNEL_H__ */ diff -Nru spice-gtk-0.9/gtk/channel-playback.c spice-gtk-0.12/gtk/channel-playback.c --- spice-gtk-0.9/gtk/channel-playback.c 2011-12-22 11:22:01.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-playback.c 2012-04-21 18:47:17.000000000 +0000 @@ -87,7 +87,8 @@ { channel->priv = SPICE_PLAYBACK_CHANNEL_GET_PRIVATE(channel); - spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_PLAYBACK_CAP_CELT_0_5_1); + if (!g_getenv("SPICE_DISABLE_CELT")) + spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_PLAYBACK_CAP_CELT_0_5_1); spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_PLAYBACK_CAP_VOLUME); } diff -Nru spice-gtk-0.9/gtk/channel-playback.h spice-gtk-0.12/gtk/channel-playback.h --- spice-gtk-0.9/gtk/channel-playback.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-playback.h 2012-04-11 13:51:02.000000000 +0000 @@ -35,7 +35,6 @@ /** * SpicePlaybackChannel: - * @parent: Parent instance. * * The #SpicePlaybackChannel struct is opaque and should not be accessed directly. */ diff -Nru spice-gtk-0.9/gtk/channel-record.c spice-gtk-0.12/gtk/channel-record.c --- spice-gtk-0.9/gtk/channel-record.c 2011-12-22 11:22:01.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-record.c 2012-04-21 18:47:17.000000000 +0000 @@ -93,7 +93,8 @@ { channel->priv = SPICE_RECORD_CHANNEL_GET_PRIVATE(channel); - spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_RECORD_CAP_CELT_0_5_1); + if (!g_getenv("SPICE_DISABLE_CELT")) + spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_RECORD_CAP_CELT_0_5_1); spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_RECORD_CAP_VOLUME); } @@ -317,7 +318,8 @@ SpiceRecordChannelPrivate *rc; rc = SPICE_RECORD_CHANNEL(channel)->priv; - if (spice_channel_test_capability(channel, SPICE_RECORD_CAP_CELT_0_5_1)) { + if (!g_getenv("SPICE_DISABLE_CELT") && + spice_channel_test_capability(channel, SPICE_RECORD_CAP_CELT_0_5_1)) { rc->mode = SPICE_AUDIO_DATA_MODE_CELT_0_5_1; } else { rc->mode = SPICE_AUDIO_DATA_MODE_RAW; @@ -375,7 +377,8 @@ p.time = time; while (bytes > 0) { - gsize n, frame_size; + gsize n; + int frame_size; SpiceMsgOut *msg; uint8_t *frame; diff -Nru spice-gtk-0.9/gtk/channel-record.h spice-gtk-0.12/gtk/channel-record.h --- spice-gtk-0.9/gtk/channel-record.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-record.h 2012-04-11 13:51:02.000000000 +0000 @@ -35,7 +35,6 @@ /** * SpiceRecordChannel: - * @parent: Parent instance. * * The #SpiceRecordChannel struct is opaque and should not be accessed directly. */ diff -Nru spice-gtk-0.9/gtk/channel-smartcard.h spice-gtk-0.12/gtk/channel-smartcard.h --- spice-gtk-0.9/gtk/channel-smartcard.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-smartcard.h 2012-04-11 13:51:02.000000000 +0000 @@ -35,7 +35,6 @@ /** * SpiceSmartcardChannel: - * @parent: Parent instance. * * The #SpiceSmartcardChannel struct is opaque and should not be accessed directly. */ diff -Nru spice-gtk-0.9/gtk/channel-usbredir.c spice-gtk-0.12/gtk/channel-usbredir.c --- spice-gtk-0.9/gtk/channel-usbredir.c 2012-01-15 19:43:53.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-usbredir.c 2012-04-11 13:51:02.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* - Copyright 2010-2011 Red Hat, Inc. + Copyright 2010-2012 Red Hat, Inc. Red Hat Authors: Hans de Goede @@ -22,12 +22,14 @@ #include "config.h" #ifdef USE_USBREDIR +#include #include #if USE_POLKIT #include "usb-acl-helper.h" #endif #include "channel-usbredir-priv.h" #include "usb-device-manager-priv.h" +#include "usbutil.h" #endif #include "spice-client.h" @@ -58,13 +60,11 @@ #if USE_POLKIT STATE_WAITING_FOR_ACL_HELPER, #endif - STATE_CONNECTING, STATE_CONNECTED, STATE_DISCONNECTING, }; struct _SpiceUsbredirChannelPrivate { - libusb_context *context; libusb_device *device; struct usbredirhost *host; /* To catch usbredirhost error messages and report them as a GError */ @@ -82,6 +82,7 @@ static void spice_usbredir_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg); static void spice_usbredir_channel_up(SpiceChannel *channel); static void spice_usbredir_channel_dispose(GObject *obj); +static void spice_usbredir_channel_finalize(GObject *obj); static void usbredir_handle_msg(SpiceChannel *channel, SpiceMsgIn *in); static void usbredir_log(void *user_data, int level, const char *msg); @@ -120,9 +121,10 @@ GObjectClass *gobject_class = G_OBJECT_CLASS(klass); SpiceChannelClass *channel_class = SPICE_CHANNEL_CLASS(klass); - gobject_class->dispose = spice_usbredir_channel_dispose; - channel_class->handle_msg = spice_usbredir_handle_msg; - channel_class->channel_up = spice_usbredir_channel_up; + gobject_class->dispose = spice_usbredir_channel_dispose; + gobject_class->finalize = spice_usbredir_channel_finalize; + channel_class->handle_msg = spice_usbredir_handle_msg; + channel_class->channel_up = spice_usbredir_channel_up; channel_class->channel_reset = spice_usbredir_channel_reset; g_type_class_add_private(klass, sizeof(SpiceUsbredirChannelPrivate)); @@ -134,7 +136,7 @@ { SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(obj); - spice_usbredir_channel_disconnect(channel); + spice_usbredir_channel_disconnect_device(channel); /* Chain up to the parent class */ if (G_OBJECT_CLASS(spice_usbredir_channel_parent_class)->dispose) @@ -142,11 +144,11 @@ } /* - * Note we don't have a finalize to unref our : device / context / acl_helper / - * result references. The reason for this is that depending on our state they - * are either: + * Note we don't unref our device / acl_helper / result references in our + * finalize. The reason for this is that depending on our state at dispose + * time they are either: * 1) Already unreferenced - * 2) Will be unreferenced by the disconnect call from dispose + * 2) Will be unreferenced by the disconnect_device call from dispose * 3) Will be unreferenced by spice_usbredir_channel_open_acl_cb * * Now the last one may seem like an issue, since what will happen if @@ -161,6 +163,17 @@ * spice_usbredir_channel_open_acl_cb has run, all references we hold have * been released even in the 3th scenario. */ +static void spice_usbredir_channel_finalize(GObject *obj) +{ + SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(obj); + + if (channel->priv->host) + usbredirhost_close(channel->priv->host); + + /* Chain up to the parent class */ + if (G_OBJECT_CLASS(spice_usbredir_channel_parent_class)->finalize) + G_OBJECT_CLASS(spice_usbredir_channel_parent_class)->finalize(obj); +} static const spice_msg_handler usbredir_handlers[] = { [ SPICE_MSG_SPICEVMC_DATA ] = usbredir_handle_msg, @@ -169,12 +182,37 @@ /* ------------------------------------------------------------------ */ /* private api */ +G_GNUC_INTERNAL +void spice_usbredir_channel_set_context(SpiceUsbredirChannel *channel, + libusb_context *context) +{ + SpiceUsbredirChannelPrivate *priv = channel->priv; + + g_return_if_fail(priv->host == NULL); + + priv->host = usbredirhost_open_full( + context, NULL, + usbredir_log, + usbredir_read_callback, + usbredir_write_callback, + usbredir_write_flush_callback, + usbredir_alloc_lock, + usbredir_lock_lock, + usbredir_unlock_lock, + usbredir_free_lock, + channel, PACKAGE_STRING, + spice_util_get_debug() ? usbredirparser_debug : usbredirparser_warning, + usbredirhost_fl_write_cb_owns_buffer); + if (!priv->host) + g_error("Out of memory allocating usbredirhost"); +} + static gboolean spice_usbredir_channel_open_device( SpiceUsbredirChannel *channel, GError **err) { SpiceUsbredirChannelPrivate *priv = channel->priv; libusb_device_handle *handle = NULL; - int rc; + int rc, status; g_return_val_if_fail(priv->state == STATE_DISCONNECTED #if USE_POLKIT @@ -186,26 +224,14 @@ if (rc != 0) { g_set_error(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, "Could not open usb device: %s [%i]", - spice_usb_device_manager_libusb_strerror(rc), rc); + spice_usbutil_libusb_strerror(rc), rc); return FALSE; } priv->catch_error = err; - priv->host = usbredirhost_open_full( - priv->context, - handle, usbredir_log, - usbredir_read_callback, - usbredir_write_callback, - usbredir_write_flush_callback, - usbredir_alloc_lock, - usbredir_lock_lock, - usbredir_unlock_lock, - usbredir_free_lock, - channel, PACKAGE_STRING, - spice_util_get_debug() ? usbredirparser_debug : usbredirparser_warning, - usbredirhost_fl_write_cb_owns_buffer); + status = usbredirhost_set_device(priv->host, handle); priv->catch_error = NULL; - if (!priv->host) { + if (status != usb_redir_success) { g_return_val_if_fail(err == NULL || *err != NULL, FALSE); return FALSE; } @@ -214,13 +240,11 @@ spice_usb_device_manager_get( spice_channel_get_session(SPICE_CHANNEL(channel)), NULL), err)) { - usbredirhost_close(priv->host); - priv->host = NULL; + usbredirhost_set_device(priv->host, NULL); return FALSE; } - spice_channel_connect(SPICE_CHANNEL(channel)); - priv->state = STATE_CONNECTING; + priv->state = STATE_CONNECTED; return TRUE; } @@ -249,9 +273,8 @@ if (err) { g_simple_async_result_take_error(priv->result, err); libusb_unref_device(priv->device); - priv->device = NULL; - priv->context = NULL; - priv->state = STATE_DISCONNECTED; + priv->device = NULL; + priv->state = STATE_DISCONNECTED; } spice_usb_acl_helper_close_acl(priv->acl_helper); @@ -265,8 +288,8 @@ #endif G_GNUC_INTERNAL -void spice_usbredir_channel_connect_async(SpiceUsbredirChannel *channel, - libusb_context *context, +void spice_usbredir_channel_connect_device_async( + SpiceUsbredirChannel *channel, libusb_device *device, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -276,13 +299,19 @@ GSimpleAsyncResult *result; g_return_if_fail(SPICE_IS_USBREDIR_CHANNEL(channel)); - g_return_if_fail(context != NULL); g_return_if_fail(device != NULL); SPICE_DEBUG("connecting usb channel %p", channel); result = g_simple_async_result_new(G_OBJECT(channel), callback, user_data, - spice_usbredir_channel_connect_async); + spice_usbredir_channel_connect_device_async); + + if (!priv->host) { + g_simple_async_result_set_error(result, + SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, + "Error libusb context not set"); + goto done; + } if (priv->state != STATE_DISCONNECTED) { g_simple_async_result_set_error(result, @@ -291,11 +320,10 @@ goto done; } - priv->context = context; - priv->device = libusb_ref_device(device); + priv->device = libusb_ref_device(device); #if USE_POLKIT priv->result = result; - priv->state = STATE_WAITING_FOR_ACL_HELPER; + priv->state = STATE_WAITING_FOR_ACL_HELPER; priv->acl_helper = spice_usb_acl_helper_new(); g_object_set(spice_channel_get_session(SPICE_CHANNEL(channel)), "inhibit-keyboard-grab", TRUE, NULL); @@ -311,8 +339,7 @@ if (!spice_usbredir_channel_open_device(channel, &err)) { g_simple_async_result_take_error(result, err); libusb_unref_device(priv->device); - priv->device = NULL; - priv->context = NULL; + priv->device = NULL; } #endif @@ -322,14 +349,15 @@ } G_GNUC_INTERNAL -gboolean spice_usbredir_channel_connect_finish(SpiceUsbredirChannel *channel, +gboolean spice_usbredir_channel_connect_device_finish( + SpiceUsbredirChannel *channel, GAsyncResult *res, GError **err) { GSimpleAsyncResult *result = G_SIMPLE_ASYNC_RESULT(res); g_return_val_if_fail(g_simple_async_result_is_valid(res, G_OBJECT(channel), - spice_usbredir_channel_connect_async), + spice_usbredir_channel_connect_device_async), FALSE); if (g_simple_async_result_propagate_error(result, err)) @@ -339,11 +367,11 @@ } G_GNUC_INTERNAL -void spice_usbredir_channel_disconnect(SpiceUsbredirChannel *channel) +void spice_usbredir_channel_disconnect_device(SpiceUsbredirChannel *channel) { SpiceUsbredirChannelPrivate *priv = channel->priv; - SPICE_DEBUG("disconnecting usb channel %p", channel); + SPICE_DEBUG("disconnecting device from usb channel %p", channel); switch (priv->state) { case STATE_DISCONNECTED: @@ -356,24 +384,21 @@ spice_usb_acl_helper_close_acl(priv->acl_helper); break; #endif - case STATE_CONNECTING: case STATE_CONNECTED: - spice_channel_disconnect(SPICE_CHANNEL(channel), SPICE_CHANNEL_NONE); /* * This sets the usb event thread run condition to FALSE, therefor - * it must be done before usbredirhost_close, as usbredirhost_close - * will interrupt the libusb_handle_events call in the thread. + * it must be done before usbredirhost_set_device NULL, as + * usbredirhost_set_device NULL will interrupt the + * libusb_handle_events call in the thread. */ spice_usb_device_manager_stop_event_listening( spice_usb_device_manager_get( spice_channel_get_session(SPICE_CHANNEL(channel)), NULL)); - /* This also closes the libusb handle we passed to its _open */ - usbredirhost_close(priv->host); - priv->host = NULL; + /* This also closes the libusb handle we passed from open_device */ + usbredirhost_set_device(priv->host, NULL); libusb_unref_device(priv->device); - priv->device = NULL; - priv->context = NULL; - priv->state = STATE_DISCONNECTED; + priv->device = NULL; + priv->state = STATE_DISCONNECTED; break; } } @@ -384,6 +409,22 @@ return channel->priv->device; } +G_GNUC_INTERNAL +void spice_usbredir_channel_get_guest_filter( + SpiceUsbredirChannel *channel, + const struct usbredirfilter_rule **rules_ret, + int *rules_count_ret) +{ + SpiceUsbredirChannelPrivate *priv = channel->priv; + + g_return_if_fail(priv->host != NULL); + + usbredirhost_get_guest_filter(priv->host, rules_ret, rules_count_ret); +} + +/* ------------------------------------------------------------------ */ +/* callbacks (any context) */ + /* Note that this function must be re-entrant safe, as it can get called from both the main thread as well as from the usb event handling thread */ static void usbredir_write_flush_callback(void *user_data) @@ -391,15 +432,13 @@ SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(user_data); SpiceUsbredirChannelPrivate *priv = channel->priv; - if (priv->state != STATE_CONNECTED) + if (spice_channel_get_state(SPICE_CHANNEL(channel)) != + SPICE_CHANNEL_STATE_READY) return; usbredirhost_write_guest_data(priv->host); } -/* ------------------------------------------------------------------ */ -/* callbacks (any context) */ - static void usbredir_log(void *user_data, int level, const char *msg) { SpiceUsbredirChannel *channel = user_data; @@ -466,7 +505,16 @@ } static void *usbredir_alloc_lock(void) { +#if GLIB_CHECK_VERSION(2,32,0) + GMutex *mutex; + + mutex = g_new0(GMutex, 1); + g_mutex_init(mutex); + + return mutex; +#else return g_mutex_new(); +#endif } static void usbredir_lock_lock(void *user_data) { @@ -484,7 +532,48 @@ static void usbredir_free_lock(void *user_data) { GMutex *mutex = user_data; +#if GLIB_CHECK_VERSION(2,32,0) + g_mutex_clear(mutex); + g_free(mutex); +#else g_mutex_free(mutex); +#endif +} + +/* --------------------------------------------------------------------- */ + +/* Events to be handled in main context */ +enum { + DEVICE_ERROR, +}; + +struct DEVICE_ERROR { + libusb_device *device; + GError *error; +}; + +/* main context */ +static void do_emit_main_context(GObject *object, int event, gpointer params) +{ + SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(object); + SpiceUsbredirChannelPrivate *priv = channel->priv; + + switch (event) { + case DEVICE_ERROR: { + struct DEVICE_ERROR *p = params; + /* Check that the device has not changed before we manage to run */ + if (p->device == priv->device) { + spice_usbredir_channel_disconnect_device(channel); + spice_usb_device_manager_device_error( + spice_usb_device_manager_get( + spice_channel_get_session(SPICE_CHANNEL(channel)), NULL), + (SpiceUsbDevice *)p->device, p->error); + } + break; + } + default: + g_warn_if_reached(); + } } /* --------------------------------------------------------------------- */ @@ -511,9 +600,6 @@ SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(c); SpiceUsbredirChannelPrivate *priv = channel->priv; - g_return_if_fail(priv->state == STATE_CONNECTING); - - priv->state = STATE_CONNECTED; /* Flush any pending writes */ usbredirhost_write_guest_data(priv->host); } @@ -522,7 +608,7 @@ { SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(c); SpiceUsbredirChannelPrivate *priv = channel->priv; - int size; + int r, size; uint8_t *buf; g_return_if_fail(priv->host != NULL); @@ -534,7 +620,45 @@ priv->read_buf = buf; priv->read_buf_size = size; - usbredirhost_read_guest_data(priv->host); + r = usbredirhost_read_guest_data(priv->host); + if (r != 0) { + libusb_device *device = priv->device; + gchar *desc; + GError *err; + + g_return_if_fail(device != NULL); + + desc = spice_usb_device_get_description((SpiceUsbDevice *)device, + NULL); + switch (r) { + case usbredirhost_read_parse_error: + err = g_error_new(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, + _("usbredir protocol parse error for %s"), desc); + break; + case usbredirhost_read_device_rejected: + err = g_error_new(SPICE_CLIENT_ERROR, + SPICE_CLIENT_USB_DEVICE_REJECTED, + _("%s rejected by host"), desc); + break; + case usbredirhost_read_device_lost: + err = g_error_new(SPICE_CLIENT_ERROR, + SPICE_CLIENT_USB_DEVICE_LOST, + _("%s disconnected (fatal IO error)"), desc); + break; + default: + err = g_error_new(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, + _("Unknown error (%d) for %s"), r, desc); + } + g_free(desc); + + SPICE_DEBUG("%s", err->message); + + g_boxed_copy(spice_usb_device_get_type(), device); + emit_main_context(channel, DEVICE_ERROR, device, err); + g_boxed_free(spice_usb_device_get_type(), device); + + g_error_free(err); + } } #endif /* USE_USBREDIR */ diff -Nru spice-gtk-0.9/gtk/channel-usbredir.h spice-gtk-0.12/gtk/channel-usbredir.h --- spice-gtk-0.9/gtk/channel-usbredir.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-usbredir.h 2012-04-11 13:51:02.000000000 +0000 @@ -38,7 +38,6 @@ /** * SpiceUsbredirChannel: - * @parent: Parent instance. * * The #SpiceUsbredirChannel struct is opaque and should not be accessed directly. */ diff -Nru spice-gtk-0.9/gtk/channel-usbredir-priv.h spice-gtk-0.12/gtk/channel-usbredir-priv.h --- spice-gtk-0.9/gtk/channel-usbredir-priv.h 2012-01-03 09:16:32.000000000 +0000 +++ spice-gtk-0.12/gtk/channel-usbredir-priv.h 2012-04-11 13:51:02.000000000 +0000 @@ -22,24 +22,39 @@ #define __SPICE_CLIENT_USBREDIR_CHANNEL_PRIV_H__ #include +#include #include "spice-client.h" G_BEGIN_DECLS -void spice_usbredir_channel_connect_async(SpiceUsbredirChannel *channel, - libusb_context *context, - libusb_device *device, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -gboolean spice_usbredir_channel_connect_finish(SpiceUsbredirChannel *channel, - GAsyncResult *res, - GError **err); +/* Note: this must be called before calling any other functions, and the + context should not be destroyed before the last device has been + disconnected */ +void spice_usbredir_channel_set_context(SpiceUsbredirChannel *channel, + libusb_context *context); + +/* Note the context must be set, and the channel must be brought up + (through spice_channel_connect()), before calling this. */ +void spice_usbredir_channel_connect_device_async( + SpiceUsbredirChannel *channel, + libusb_device *device, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean spice_usbredir_channel_connect_device_finish( + SpiceUsbredirChannel *channel, + GAsyncResult *res, + GError **err); -void spice_usbredir_channel_disconnect(SpiceUsbredirChannel *channel); +void spice_usbredir_channel_disconnect_device(SpiceUsbredirChannel *channel); libusb_device *spice_usbredir_channel_get_device(SpiceUsbredirChannel *channel); +void spice_usbredir_channel_get_guest_filter( + SpiceUsbredirChannel *channel, + const struct usbredirfilter_rule **rules_ret, + int *rules_count_ret); + G_END_DECLS #endif /* __SPICE_CLIENT_USBREDIR_CHANNEL_PRIV_H__ */ diff -Nru spice-gtk-0.9/gtk/continuation.c spice-gtk-0.12/gtk/continuation.c --- spice-gtk-0.9/gtk/continuation.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/continuation.c 2012-04-11 13:51:02.000000000 +0000 @@ -17,10 +17,10 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#undef _FORTIFY_SOURCE - #include +#undef _FORTIFY_SOURCE + #include "continuation.h" /* diff -Nru spice-gtk-0.9/gtk/controller/controller.c spice-gtk-0.12/gtk/controller/controller.c --- spice-gtk-0.9/gtk/controller/controller.c 2012-01-27 09:44:03.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/controller.c 2012-04-24 11:24:37.000000000 +0000 @@ -1,4 +1,4 @@ -/* controller.c generated by valac 0.14.0, the Vala compiler +/* controller.c generated by valac 0.16.0, the Vala compiler * generated from controller.vala, do not modify */ /* Copyright (C) 2011 Red Hat, Inc.*/ @@ -82,6 +82,15 @@ gint _disable_channels_length1; gint __disable_channels_size_; SpiceCtrlMenu* _menu; + gboolean _enable_smartcard; + gboolean _send_cad; + gchar** _disable_effects; + gint _disable_effects_length1; + gint __disable_effects_size_; + guint32 _color_depth; + gboolean _enable_usbredir; + gboolean _enable_usb_autoshare; + gchar* _usb_filter; GIOStream* excl_connection; gint nclients; GList* clients; @@ -285,7 +294,14 @@ SPICE_CTRL_CONTROLLER_HOTKEYS, SPICE_CTRL_CONTROLLER_SECURE_CHANNELS, SPICE_CTRL_CONTROLLER_DISABLE_CHANNELS, - SPICE_CTRL_CONTROLLER_MENU + SPICE_CTRL_CONTROLLER_MENU, + SPICE_CTRL_CONTROLLER_ENABLE_SMARTCARD, + SPICE_CTRL_CONTROLLER_SEND_CAD, + SPICE_CTRL_CONTROLLER_DISABLE_EFFECTS, + SPICE_CTRL_CONTROLLER_COLOR_DEPTH, + SPICE_CTRL_CONTROLLER_ENABLE_USBREDIR, + SPICE_CTRL_CONTROLLER_ENABLE_USB_AUTOSHARE, + SPICE_CTRL_CONTROLLER_USB_FILTER }; static void _g_object_unref0_ (gpointer var); static void _g_list_free__g_object_unref0_ (GList* self); @@ -293,7 +309,6 @@ void spice_ctrl_controller_send_msg (SpiceCtrlController* self, guint8* p, int p_length1, GAsyncReadyCallback _callback_, gpointer _user_data_); gboolean spice_ctrl_controller_send_msg_finish (SpiceCtrlController* self, GAsyncResult* _res_, GError** error); static void spice_ctrl_controller_send_msg_data_free (gpointer _data); -static guint8* _vala_array_dup1 (guint8* self, int length); static gboolean spice_ctrl_controller_send_msg_co (SpiceCtrlControllerSendMsgData* _data_); static void spice_ctrl_controller_send_msg_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); static gboolean spice_ctrl_controller_handle_message (SpiceCtrlController* self, ControllerMsg* msg); @@ -308,10 +323,17 @@ static void spice_ctrl_controller_set_host_subject (SpiceCtrlController* self, const gchar* value); static void spice_ctrl_controller_set_display_flags (SpiceCtrlController* self, unsigned int value); static void spice_ctrl_controller_set_title (SpiceCtrlController* self, const gchar* value); +static void spice_ctrl_controller_set_enable_smartcard (SpiceCtrlController* self, gboolean value); SpiceCtrlMenu* spice_ctrl_menu_new_from_string (const gchar* str); SpiceCtrlMenu* spice_ctrl_menu_construct_from_string (GType object_type, const gchar* str); static void spice_ctrl_controller_set_menu (SpiceCtrlController* self, SpiceCtrlMenu* value); +static void spice_ctrl_controller_set_send_cad (SpiceCtrlController* self, gboolean value); static void spice_ctrl_controller_set_hotkeys (SpiceCtrlController* self, const gchar* value); +static void spice_ctrl_controller_set_color_depth (SpiceCtrlController* self, guint32 value); +static void spice_ctrl_controller_set_disable_effects (SpiceCtrlController* self, gchar** value, int value_length1); +static void spice_ctrl_controller_set_enable_usbredir (SpiceCtrlController* self, gboolean value); +static void spice_ctrl_controller_set_enable_usb_autoshare (SpiceCtrlController* self, gboolean value); +static void spice_ctrl_controller_set_usb_filter (SpiceCtrlController* self, const gchar* value); static void spice_ctrl_controller_handle_client_data_free (gpointer _data); static void spice_ctrl_controller_handle_client (SpiceCtrlController* self, GIOStream* c, GAsyncReadyCallback _callback_, gpointer _user_data_); static void spice_ctrl_controller_handle_client_finish (SpiceCtrlController* self, GAsyncResult* _res_, GError** error); @@ -335,10 +357,18 @@ const gchar* spice_ctrl_controller_get_title (SpiceCtrlController* self); const gchar* spice_ctrl_controller_get_hotkeys (SpiceCtrlController* self); gchar** spice_ctrl_controller_get_secure_channels (SpiceCtrlController* self, int* result_length1); -static gchar** _vala_array_dup2 (gchar** self, int length); +static gchar** _vala_array_dup1 (gchar** self, int length); gchar** spice_ctrl_controller_get_disable_channels (SpiceCtrlController* self, int* result_length1); -static gchar** _vala_array_dup3 (gchar** self, int length); +static gchar** _vala_array_dup2 (gchar** self, int length); SpiceCtrlMenu* spice_ctrl_controller_get_menu (SpiceCtrlController* self); +gboolean spice_ctrl_controller_get_enable_smartcard (SpiceCtrlController* self); +gboolean spice_ctrl_controller_get_send_cad (SpiceCtrlController* self); +gchar** spice_ctrl_controller_get_disable_effects (SpiceCtrlController* self, int* result_length1); +static gchar** _vala_array_dup3 (gchar** self, int length); +guint32 spice_ctrl_controller_get_color_depth (SpiceCtrlController* self); +gboolean spice_ctrl_controller_get_enable_usbredir (SpiceCtrlController* self); +gboolean spice_ctrl_controller_get_enable_usb_autoshare (SpiceCtrlController* self); +const gchar* spice_ctrl_controller_get_usb_filter (SpiceCtrlController* self); static void spice_ctrl_controller_finalize (GObject* obj); static void _vala_spice_ctrl_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); static void _vala_spice_ctrl_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); @@ -353,18 +383,18 @@ static void _g_object_unref0_ (gpointer var) { -#line 77 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" (var == NULL) ? NULL : (var = (g_object_unref (var), NULL)); -#line 359 "controller.c" +#line 389 "controller.c" } static void _g_list_free__g_object_unref0_ (GList* self) { -#line 77 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_list_foreach (self, (GFunc) _g_object_unref0_, NULL); -#line 77 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_list_free (self); -#line 368 "controller.c" +#line 398 "controller.c" } @@ -377,60 +407,51 @@ guint8* p; gint p_length1; gint _p_size_; -#line 47 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 56 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_if_fail (self != NULL); -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 57 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" memset (&msg, 0, sizeof (ControllerValue)); -#line 49 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" msg.base.size = (guint32) sizeof (ControllerValue); -#line 50 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 59 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" msg.base.id = (guint32) CONTROLLER_MENU_ITEM_CLICK; -#line 51 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 60 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = item_id; -#line 51 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 60 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" msg.value = (guint32) _tmp0_; -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 61 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = msg; -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 61 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp2_ = _tmp1_.base; -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 61 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp3_ = _tmp2_.size; -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 61 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" p = ((guint8*) (&msg)) + 0; -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 61 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" p_length1 = _tmp3_ - 0; -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 61 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _p_size_ = p_length1; -#line 53 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 62 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_send_msg (self, p, p_length1, NULL, NULL); -#line 407 "controller.c" +#line 437 "controller.c" } static void spice_ctrl_controller_send_msg_data_free (gpointer _data) { SpiceCtrlControllerSendMsgData* _data_; _data_ = _data; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - _data_->p = (g_free (_data_->p), NULL); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->self); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_slice_free (SpiceCtrlControllerSendMsgData, _data_); -#line 420 "controller.c" +#line 448 "controller.c" } static gpointer _g_object_ref0 (gpointer self) { -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return self ? g_object_ref (self) : NULL; -#line 427 "controller.c" -} - - -static guint8* _vala_array_dup1 (guint8* self, int length) { -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - return g_memdup (self, length * sizeof (guint8)); -#line 434 "controller.c" +#line 455 "controller.c" } @@ -439,167 +460,159 @@ SpiceCtrlController* _tmp0_; guint8* _tmp1_; gint _tmp1__length1; - guint8* _tmp2_; - gint _tmp2__length1; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_ = g_slice_new0 (SpiceCtrlControllerSendMsgData); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, spice_ctrl_controller_send_msg); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, spice_ctrl_controller_send_msg_data_free); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = _g_object_ref0 (self); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->self = _tmp0_; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = p; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1__length1 = p_length1; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - _tmp2_ = (_tmp1_ != NULL) ? _vala_array_dup1 (_tmp1_, _tmp1__length1) : ((gpointer) _tmp1_); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - _tmp2__length1 = _tmp1__length1; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - _data_->p = _tmp2_; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - _data_->p_length1 = _tmp2__length1; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _data_->p = _tmp1_; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _data_->p_length1 = _tmp1__length1; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_send_msg_co (_data_); -#line 469 "controller.c" +#line 484 "controller.c" } gboolean spice_ctrl_controller_send_msg_finish (SpiceCtrlController* self, GAsyncResult* _res_, GError** error) { gboolean result; SpiceCtrlControllerSendMsgData* _data_; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) { -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 480 "controller.c" +#line 495 "controller.c" } -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = _data_->result; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 488 "controller.c" +#line 503 "controller.c" } static void spice_ctrl_controller_send_msg_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { SpiceCtrlControllerSendMsgData* _data_; -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_ = _user_data_; -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_source_object_ = source_object; -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_res_ = _res_; -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_send_msg_co (_data_); -#line 502 "controller.c" +#line 517 "controller.c" } static gboolean spice_ctrl_controller_send_msg_co (SpiceCtrlControllerSendMsgData* _data_) { -#line 56 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 65 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" switch (_data_->_state_) { -#line 56 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 65 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case 0: -#line 511 "controller.c" +#line 526 "controller.c" goto _state_0; -#line 56 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 65 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case 1: -#line 515 "controller.c" +#line 530 "controller.c" goto _state_1; -#line 56 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 65 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case 2: -#line 519 "controller.c" +#line 534 "controller.c" goto _state_2; default: -#line 56 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 65 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_assert_not_reached (); -#line 524 "controller.c" +#line 539 "controller.c" } _state_0: { -#line 62 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 71 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp0_ = _data_->self->priv->excl_connection; -#line 62 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 71 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp0_ != NULL) { -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp1_ = _data_->self->priv->excl_connection; -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp2_ = g_io_stream_get_output_stream (_data_->_tmp1_); -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp3_ = _data_->_tmp2_; -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp4_ = _data_->p; -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp4__length1 = _data_->p_length1; -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_state_ = 1; -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_output_stream_write_async (_data_->_tmp3_, _data_->_tmp4_, (gsize) _data_->_tmp4__length1, G_PRIORITY_DEFAULT, NULL, spice_ctrl_controller_send_msg_ready, _data_); -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 548 "controller.c" +#line 563 "controller.c" _state_1: -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_output_stream_write_finish (_data_->_tmp3_, _data_->_res_, &_data_->_inner_error_); -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_inner_error_ != NULL) { -#line 554 "controller.c" +#line 569 "controller.c" goto __catch1_g_error; } } else { -#line 65 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 74 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp5_ = _data_->self->priv->clients; -#line 560 "controller.c" +#line 575 "controller.c" { -#line 65 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 74 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->c_collection = _data_->_tmp5_; -#line 65 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - _data_->c_it = NULL; -#line 65 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 74 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" for (_data_->c_it = _data_->c_collection; _data_->c_it != NULL; _data_->c_it = _data_->c_it->next) { -#line 65 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 74 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp6_ = _g_object_ref0 ((GIOStream*) _data_->c_it->data); -#line 65 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 74 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->c = _data_->_tmp6_; -#line 572 "controller.c" +#line 585 "controller.c" { -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 75 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp7_ = _data_->c; -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 75 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp8_ = g_io_stream_get_output_stream (_data_->_tmp7_); -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 75 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp9_ = _data_->_tmp8_; -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 75 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp10_ = _data_->p; -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 75 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp10__length1 = _data_->p_length1; -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 75 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_state_ = 2; -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 75 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_output_stream_write_async (_data_->_tmp9_, _data_->_tmp10_, (gsize) _data_->_tmp10__length1, G_PRIORITY_DEFAULT, NULL, spice_ctrl_controller_send_msg_ready, _data_); -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 75 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 590 "controller.c" +#line 603 "controller.c" _state_2: -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 75 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_output_stream_write_finish (_data_->_tmp9_, _data_->_res_, &_data_->_inner_error_); -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 75 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_inner_error_ != NULL) { -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 75 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->c); -#line 598 "controller.c" +#line 611 "controller.c" goto __catch1_g_error; } -#line 65 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 74 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->c); -#line 603 "controller.c" +#line 616 "controller.c" } } } @@ -608,74 +621,74 @@ goto __finally1; __catch1_g_error: { -#line 61 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->e = _data_->_inner_error_; -#line 61 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_inner_error_ = NULL; -#line 69 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp11_ = _data_->e; -#line 69 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp12_ = _data_->_tmp11_->message; -#line 69 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - g_warning ("controller.vala:69: %s", _data_->_tmp12_); -#line 61 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_warning ("controller.vala:78: %s", _data_->_tmp12_); +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_error_free0 (_data_->e); -#line 624 "controller.c" +#line 637 "controller.c" } __finally1: -#line 61 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_inner_error_ != NULL) { -#line 61 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); -#line 61 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_error_free (_data_->_inner_error_); -#line 61 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 61 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 637 "controller.c" +#line 650 "controller.c" } else { -#line 61 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 641 "controller.c" +#line 654 "controller.c" } -#line 61 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 61 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 647 "controller.c" +#line 660 "controller.c" } -#line 72 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 81 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->result = TRUE; -#line 72 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 81 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 72 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 81 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 655 "controller.c" +#line 668 "controller.c" } else { -#line 72 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 81 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 659 "controller.c" +#line 672 "controller.c" } -#line 72 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 81 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 72 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 81 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 56 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 65 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 56 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 65 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 669 "controller.c" +#line 682 "controller.c" } else { -#line 56 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 65 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 673 "controller.c" +#line 686 "controller.c" } -#line 56 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 65 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 56 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 65 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 679 "controller.c" +#line 692 "controller.c" } @@ -689,305 +702,423 @@ const gchar* str; ControllerMsg* _tmp3_; guint32 _tmp4_; -#line 79 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 88 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_val_if_fail (self != NULL, FALSE); -#line 80 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 89 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = msg; -#line 80 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 89 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" v = (ControllerValue*) _tmp0_; -#line 81 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 90 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = msg; -#line 81 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 90 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" d = (ControllerData*) _tmp1_; -#line 82 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 91 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp2_ = d; -#line 82 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 91 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" str = (const gchar*) (&(*_tmp2_).data); -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp3_ = msg; -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp4_ = (*_tmp3_).id; -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" switch (_tmp4_) { -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_HOST: -#line 715 "controller.c" +#line 728 "controller.c" { const gchar* _tmp5_; -#line 86 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 95 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp5_ = str; -#line 86 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 95 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_host (self, _tmp5_); -#line 87 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 96 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 724 "controller.c" +#line 737 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_PORT: -#line 728 "controller.c" +#line 741 "controller.c" { ControllerValue* _tmp6_; guint32 _tmp7_; -#line 89 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 98 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp6_ = v; -#line 89 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 98 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp7_ = (*_tmp6_).value; -#line 89 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 98 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_port (self, _tmp7_); -#line 90 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 99 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 740 "controller.c" +#line 753 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_SPORT: -#line 744 "controller.c" +#line 757 "controller.c" { ControllerValue* _tmp8_; guint32 _tmp9_; -#line 92 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 101 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp8_ = v; -#line 92 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 101 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp9_ = (*_tmp8_).value; -#line 92 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 101 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_sport (self, _tmp9_); -#line 93 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 102 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 756 "controller.c" +#line 769 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_PASSWORD: -#line 760 "controller.c" +#line 773 "controller.c" { const gchar* _tmp10_; -#line 95 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 104 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp10_ = str; -#line 95 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 104 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_password (self, _tmp10_); -#line 96 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 105 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 769 "controller.c" +#line 782 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_SECURE_CHANNELS: -#line 773 "controller.c" +#line 786 "controller.c" { const gchar* _tmp11_; gchar** _tmp12_; gchar** _tmp13_ = NULL; gchar** _tmp14_; gint _tmp14__length1; -#line 99 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp11_ = str; -#line 99 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp13_ = _tmp12_ = g_strsplit (_tmp11_, ",", 0); -#line 99 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp14_ = _tmp13_; -#line 99 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp14__length1 = _vala_array_length (_tmp12_); -#line 99 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_secure_channels (self, _tmp14_, _vala_array_length (_tmp12_)); -#line 99 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp14_ = (_vala_array_free (_tmp14_, _tmp14__length1, (GDestroyNotify) g_free), NULL); -#line 100 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 109 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 794 "controller.c" +#line 807 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_DISABLE_CHANNELS: -#line 798 "controller.c" +#line 811 "controller.c" { const gchar* _tmp15_; gchar** _tmp16_; gchar** _tmp17_ = NULL; gchar** _tmp18_; gint _tmp18__length1; -#line 103 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 112 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp15_ = str; -#line 103 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 112 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp17_ = _tmp16_ = g_strsplit (_tmp15_, ",", 0); -#line 103 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 112 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp18_ = _tmp17_; -#line 103 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 112 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp18__length1 = _vala_array_length (_tmp16_); -#line 103 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 112 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_disable_channels (self, _tmp18_, _vala_array_length (_tmp16_)); -#line 103 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 112 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp18_ = (_vala_array_free (_tmp18_, _tmp18__length1, (GDestroyNotify) g_free), NULL); -#line 104 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 113 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 819 "controller.c" +#line 832 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_TLS_CIPHERS: -#line 823 "controller.c" +#line 836 "controller.c" { const gchar* _tmp19_; -#line 107 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 116 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp19_ = str; -#line 107 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 116 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_tls_ciphers (self, _tmp19_); -#line 108 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 117 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 832 "controller.c" +#line 845 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_CA_FILE: -#line 836 "controller.c" +#line 849 "controller.c" { const gchar* _tmp20_; -#line 110 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 119 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp20_ = str; -#line 110 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 119 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_ca_file (self, _tmp20_); -#line 111 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 120 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 845 "controller.c" +#line 858 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_HOST_SUBJECT: -#line 849 "controller.c" +#line 862 "controller.c" { const gchar* _tmp21_; -#line 113 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 122 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp21_ = str; -#line 113 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 122 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_host_subject (self, _tmp21_); -#line 114 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 123 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 858 "controller.c" +#line 871 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_FULL_SCREEN: -#line 862 "controller.c" +#line 875 "controller.c" { ControllerValue* _tmp22_; guint32 _tmp23_; -#line 117 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 126 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp22_ = v; -#line 117 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 126 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp23_ = (*_tmp22_).value; -#line 117 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 126 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_display_flags (self, (unsigned int) _tmp23_); -#line 118 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 127 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 874 "controller.c" +#line 887 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_SET_TITLE: -#line 878 "controller.c" +#line 891 "controller.c" { const gchar* _tmp24_; -#line 120 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 129 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp24_ = str; -#line 120 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 129 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_title (self, _tmp24_); -#line 121 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 130 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 887 "controller.c" +#line 900 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case CONTROLLER_ENABLE_SMARTCARD: +#line 904 "controller.c" + { + ControllerValue* _tmp25_; + guint32 _tmp26_; +#line 132 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp25_ = v; +#line 132 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp26_ = (*_tmp25_).value; +#line 132 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_enable_smartcard (self, (gboolean) _tmp26_); +#line 133 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 916 "controller.c" + } +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_CREATE_MENU: -#line 891 "controller.c" +#line 920 "controller.c" { - const gchar* _tmp25_; - SpiceCtrlMenu* _tmp26_; - SpiceCtrlMenu* _tmp27_; -#line 124 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - _tmp25_ = str; -#line 124 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - _tmp26_ = spice_ctrl_menu_new_from_string (_tmp25_); -#line 124 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - _tmp27_ = _tmp26_; -#line 124 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - spice_ctrl_controller_set_menu (self, _tmp27_); -#line 124 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - _g_object_unref0 (_tmp27_); -#line 125 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" + const gchar* _tmp27_; + SpiceCtrlMenu* _tmp28_; + SpiceCtrlMenu* _tmp29_; +#line 136 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp27_ = str; +#line 136 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp28_ = spice_ctrl_menu_new_from_string (_tmp27_); +#line 136 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp29_ = _tmp28_; +#line 136 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_menu (self, _tmp29_); +#line 136 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _g_object_unref0 (_tmp29_); +#line 137 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 908 "controller.c" +#line 937 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_DELETE_MENU: -#line 912 "controller.c" +#line 941 "controller.c" { -#line 127 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 139 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_menu (self, NULL); -#line 128 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 140 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 918 "controller.c" +#line 947 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case CONTROLLER_SEND_CAD: +#line 951 "controller.c" + { + ControllerValue* _tmp30_; + guint32 _tmp31_; +#line 143 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp30_ = v; +#line 143 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp31_ = (*_tmp30_).value; +#line 143 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_send_cad (self, (gboolean) _tmp31_); +#line 144 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 963 "controller.c" + } +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_HOTKEYS: -#line 922 "controller.c" +#line 967 "controller.c" { - const gchar* _tmp28_; -#line 132 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - _tmp28_ = str; -#line 132 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - spice_ctrl_controller_set_hotkeys (self, _tmp28_); -#line 133 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" + const gchar* _tmp32_; +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp32_ = str; +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_hotkeys (self, _tmp32_); +#line 148 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 976 "controller.c" + } +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case CONTROLLER_COLOR_DEPTH: +#line 980 "controller.c" + { + ControllerValue* _tmp33_; + guint32 _tmp34_; +#line 151 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp33_ = v; +#line 151 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp34_ = (*_tmp33_).value; +#line 151 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_color_depth (self, _tmp34_); +#line 152 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 931 "controller.c" +#line 992 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case CONTROLLER_DISABLE_EFFECTS: +#line 996 "controller.c" + { + const gchar* _tmp35_; + gchar** _tmp36_; + gchar** _tmp37_ = NULL; + gchar** _tmp38_; + gint _tmp38__length1; +#line 154 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp35_ = str; +#line 154 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp37_ = _tmp36_ = g_strsplit (_tmp35_, ",", 0); +#line 154 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp38_ = _tmp37_; +#line 154 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp38__length1 = _vala_array_length (_tmp36_); +#line 154 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_disable_effects (self, _tmp38_, _vala_array_length (_tmp36_)); +#line 154 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp38_ = (_vala_array_free (_tmp38_, _tmp38__length1, (GDestroyNotify) g_free), NULL); +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 1017 "controller.c" + } +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_CONNECT: -#line 935 "controller.c" +#line 1021 "controller.c" { -#line 136 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 158 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_signal_emit_by_name (self, "do-connect"); -#line 137 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 159 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 941 "controller.c" +#line 1027 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_SHOW: -#line 945 "controller.c" +#line 1031 "controller.c" { -#line 139 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 161 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_signal_emit_by_name (self, "show"); -#line 140 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 951 "controller.c" +#line 1037 "controller.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case CONTROLLER_HIDE: -#line 955 "controller.c" +#line 1041 "controller.c" { -#line 142 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 164 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_signal_emit_by_name (self, "hide"); -#line 143 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 165 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 1047 "controller.c" + } +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case CONTROLLER_ENABLE_USB: +#line 1051 "controller.c" + { + ControllerValue* _tmp39_; + guint32 _tmp40_; +#line 167 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp39_ = v; +#line 167 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp40_ = (*_tmp39_).value; +#line 167 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_enable_usbredir (self, (gboolean) _tmp40_); +#line 168 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 1063 "controller.c" + } +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case CONTROLLER_ENABLE_USB_AUTOSHARE: +#line 1067 "controller.c" + { + ControllerValue* _tmp41_; + guint32 _tmp42_; +#line 170 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp41_ = v; +#line 170 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp42_ = (*_tmp41_).value; +#line 170 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_enable_usb_autoshare (self, (gboolean) _tmp42_); +#line 171 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 1079 "controller.c" + } +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case CONTROLLER_USB_FILTER: +#line 1083 "controller.c" + { + const gchar* _tmp43_; +#line 173 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp43_ = str; +#line 173 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_usb_filter (self, _tmp43_); +#line 174 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 961 "controller.c" +#line 1092 "controller.c" } default: { -#line 145 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 176 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_warn_if_reached (); -#line 146 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 177 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = FALSE; -#line 146 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 177 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 971 "controller.c" +#line 1102 "controller.c" } } -#line 148 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 179 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = TRUE; -#line 148 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 179 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 978 "controller.c" +#line 1109 "controller.c" } static void spice_ctrl_controller_handle_client_data_free (gpointer _data) { SpiceCtrlControllerHandleClientData* _data_; _data_ = _data; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->c); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->self); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_slice_free (SpiceCtrlControllerHandleClientData, _data_); -#line 991 "controller.c" +#line 1122 "controller.c" } @@ -996,760 +1127,762 @@ SpiceCtrlController* _tmp0_; GIOStream* _tmp1_; GIOStream* _tmp2_; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_ = g_slice_new0 (SpiceCtrlControllerHandleClientData); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, spice_ctrl_controller_handle_client); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, spice_ctrl_controller_handle_client_data_free); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = _g_object_ref0 (self); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->self = _tmp0_; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = c; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp2_ = _g_object_ref0 (_tmp1_); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->c = _tmp2_; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_handle_client_co (_data_); -#line 1018 "controller.c" +#line 1149 "controller.c" } static void spice_ctrl_controller_handle_client_finish (SpiceCtrlController* self, GAsyncResult* _res_, GError** error) { SpiceCtrlControllerHandleClientData* _data_; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) { -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return; -#line 1028 "controller.c" +#line 1159 "controller.c" } -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); -#line 1032 "controller.c" +#line 1163 "controller.c" } static void spice_ctrl_controller_handle_client_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { SpiceCtrlControllerHandleClientData* _data_; -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_ = _user_data_; -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_source_object_ = source_object; -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_res_ = _res_; -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_handle_client_co (_data_); -#line 1046 "controller.c" +#line 1177 "controller.c" } static gboolean spice_ctrl_controller_handle_client_co (SpiceCtrlControllerHandleClientData* _data_) { -#line 151 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 182 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" switch (_data_->_state_) { -#line 151 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 182 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case 0: -#line 1055 "controller.c" +#line 1186 "controller.c" goto _state_0; -#line 151 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 182 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case 1: -#line 1059 "controller.c" +#line 1190 "controller.c" goto _state_1; -#line 151 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 182 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case 2: -#line 1063 "controller.c" +#line 1194 "controller.c" goto _state_2; -#line 151 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 182 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case 3: -#line 1067 "controller.c" +#line 1198 "controller.c" goto _state_3; -#line 151 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 182 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case 4: -#line 1071 "controller.c" +#line 1202 "controller.c" goto _state_4; default: -#line 151 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 182 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_assert_not_reached (); -#line 1076 "controller.c" +#line 1207 "controller.c" } _state_0: -#line 152 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 183 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" memset (&_data_->init, 0, sizeof (ControllerInit)); -#line 153 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 184 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->excl = FALSE; -#line 154 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 185 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->p = NULL; -#line 154 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 185 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->p_length1 = 0; -#line 154 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 185 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_p_size_ = _data_->p_length1; -#line 156 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - g_debug ("controller.vala:156: new socket client, reading init header"); -#line 158 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 187 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_debug ("controller.vala:187: new socket client, reading init header"); +#line 189 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->p = ((guint8*) (&_data_->init)) + 0; -#line 158 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 189 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->p_length1 = sizeof (ControllerInitHeader) - 0; -#line 158 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 189 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_p_size_ = _data_->p_length1; -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp0_ = _data_->c; -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp1_ = g_io_stream_get_input_stream (_data_->_tmp0_); -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp2_ = _data_->_tmp1_; -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp3_ = _data_->p; -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp3__length1 = _data_->p_length1; -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_state_ = 1; -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_input_stream_read_async (_data_->_tmp2_, _data_->_tmp3_, (gsize) _data_->_tmp3__length1, G_PRIORITY_DEFAULT, NULL, spice_ctrl_controller_handle_client_ready, _data_); -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1113 "controller.c" +#line 1244 "controller.c" _state_1: -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp4_ = 0L; -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp4_ = g_input_stream_read_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error_); -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->read = _data_->_tmp4_; -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_inner_error_ != NULL) { -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_error_free (_data_->_inner_error_); -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1131 "controller.c" +#line 1262 "controller.c" } else { -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1135 "controller.c" +#line 1266 "controller.c" } -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 159 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1141 "controller.c" +#line 1272 "controller.c" } -#line 160 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 191 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp5_ = _data_->read; -#line 160 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 191 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp6_ = FALSE; -#line 160 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 191 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp6_ = g_warn_if (((gulong) _data_->_tmp5_) != sizeof (ControllerInitHeader)); -#line 160 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 191 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp6_) { -#line 161 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 161 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1155 "controller.c" +#line 1286 "controller.c" } else { -#line 161 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1159 "controller.c" +#line 1290 "controller.c" } -#line 161 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 161 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1165 "controller.c" +#line 1296 "controller.c" } -#line 162 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 193 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp7_ = _data_->init; -#line 162 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 193 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp8_ = _data_->_tmp7_.base; -#line 162 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 193 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp9_ = _data_->_tmp8_.magic; -#line 162 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 193 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp10_ = FALSE; -#line 162 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 193 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp10_ = g_warn_if (_data_->_tmp9_ != CONTROLLER_MAGIC); -#line 162 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 193 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp10_) { -#line 163 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 194 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 163 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 194 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1183 "controller.c" +#line 1314 "controller.c" } else { -#line 163 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 194 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1187 "controller.c" +#line 1318 "controller.c" } -#line 163 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 194 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 163 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 194 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1193 "controller.c" +#line 1324 "controller.c" } -#line 164 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp11_ = _data_->init; -#line 164 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp12_ = _data_->_tmp11_.base; -#line 164 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp13_ = _data_->_tmp12_.version; -#line 164 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp14_ = FALSE; -#line 164 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp14_ = g_warn_if (_data_->_tmp13_ != ((guint32) CONTROLLER_VERSION)); -#line 164 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp14_) { -#line 165 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 196 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 165 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 196 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1211 "controller.c" +#line 1342 "controller.c" } else { -#line 165 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 196 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1215 "controller.c" +#line 1346 "controller.c" } -#line 165 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 196 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 165 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 196 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1221 "controller.c" +#line 1352 "controller.c" } -#line 166 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 197 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp15_ = _data_->init; -#line 166 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 197 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp16_ = _data_->_tmp15_.base; -#line 166 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 197 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp17_ = _data_->_tmp16_.size; -#line 166 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 197 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp18_ = FALSE; -#line 166 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 197 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp18_ = g_warn_if (((gulong) _data_->_tmp17_) < sizeof (ControllerInit)); -#line 166 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 197 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp18_) { -#line 167 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 167 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1239 "controller.c" +#line 1370 "controller.c" } else { -#line 167 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1243 "controller.c" +#line 1374 "controller.c" } -#line 167 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 167 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1249 "controller.c" +#line 1380 "controller.c" } -#line 169 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 200 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp19_ = _data_->init; -#line 169 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 200 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp20_ = _data_->_tmp19_.base; -#line 169 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 200 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp21_ = _data_->_tmp20_.size; -#line 169 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 200 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->p = ((guint8*) (&_data_->init.credentials)) + 0; -#line 169 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 200 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->p_length1 = (_data_->_tmp21_ - sizeof (ControllerInitHeader)) - 0; -#line 169 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 200 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_p_size_ = _data_->p_length1; -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp22_ = _data_->c; -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp23_ = g_io_stream_get_input_stream (_data_->_tmp22_); -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp24_ = _data_->_tmp23_; -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp25_ = _data_->p; -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp25__length1 = _data_->p_length1; -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_state_ = 2; -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_input_stream_read_async (_data_->_tmp24_, _data_->_tmp25_, (gsize) _data_->_tmp25__length1, G_PRIORITY_DEFAULT, NULL, spice_ctrl_controller_handle_client_ready, _data_); -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1279 "controller.c" +#line 1410 "controller.c" _state_2: -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp26_ = 0L; -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp26_ = g_input_stream_read_finish (_data_->_tmp24_, _data_->_res_, &_data_->_inner_error_); -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp27_ = _data_->_tmp26_; -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_inner_error_ != NULL) { -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_error_free (_data_->_inner_error_); -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1297 "controller.c" +#line 1428 "controller.c" } else { -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1301 "controller.c" +#line 1432 "controller.c" } -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1307 "controller.c" +#line 1438 "controller.c" } -#line 170 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->read = _data_->_tmp27_; -#line 171 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 202 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp28_ = _data_->read; -#line 171 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 202 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp29_ = _data_->init; -#line 171 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 202 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp30_ = _data_->_tmp29_.base; -#line 171 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 202 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp31_ = _data_->_tmp30_.size; -#line 171 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 202 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp32_ = FALSE; -#line 171 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 202 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp32_ = g_warn_if (((gulong) _data_->_tmp28_) != (_data_->_tmp31_ - sizeof (ControllerInitHeader))); -#line 171 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 202 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp32_) { -#line 172 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 172 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1329 "controller.c" +#line 1460 "controller.c" } else { -#line 172 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1333 "controller.c" +#line 1464 "controller.c" } -#line 172 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 172 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1339 "controller.c" +#line 1470 "controller.c" } -#line 173 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 204 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp33_ = _data_->init; -#line 173 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 204 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp34_ = _data_->_tmp33_.credentials; -#line 173 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 204 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp35_ = FALSE; -#line 173 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 204 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp35_ = g_warn_if (_data_->_tmp34_ != ((guint64) 0)); -#line 173 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 204 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp35_) { -#line 174 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 205 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 174 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 205 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1355 "controller.c" +#line 1486 "controller.c" } else { -#line 174 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 205 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1359 "controller.c" +#line 1490 "controller.c" } -#line 174 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 205 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 174 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 205 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1365 "controller.c" +#line 1496 "controller.c" } -#line 175 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 206 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp36_ = _data_->self->priv->excl_connection; -#line 175 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 206 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp37_ = FALSE; -#line 175 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 206 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp37_ = g_warn_if (_data_->_tmp36_ != NULL); -#line 175 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 206 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp37_) { -#line 176 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 207 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 176 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 207 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1379 "controller.c" +#line 1510 "controller.c" } else { -#line 176 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 207 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1383 "controller.c" +#line 1514 "controller.c" } -#line 176 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 207 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 176 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 207 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1389 "controller.c" +#line 1520 "controller.c" } -#line 178 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 209 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp38_ = _data_->init; -#line 178 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 209 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp39_ = _data_->_tmp38_.flags; -#line 178 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 209 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->excl = (gboolean) (_data_->_tmp39_ & CONTROLLER_FLAG_EXCLUSIVE); -#line 179 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 210 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp40_ = _data_->excl; -#line 179 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 210 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp40_) { -#line 180 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 211 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp41_ = _data_->self->priv->nclients; -#line 180 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 211 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp41_ > 1) { -#line 181 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 212 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp42_ = _data_->self->priv->nclients; -#line 181 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 212 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp43_ = NULL; -#line 181 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 212 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp43_ = g_strdup_printf ("%i", _data_->_tmp42_); -#line 181 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 212 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp44_ = _data_->_tmp43_; -#line 181 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 212 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp45_ = NULL; -#line 181 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 212 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp45_ = g_strconcat ("Can't make the client exclusive, there is already ", _data_->_tmp44_, " connected clients", NULL); -#line 181 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 212 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp46_ = _data_->_tmp45_; -#line 181 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - g_warning ("controller.vala:181: %s", _data_->_tmp46_); -#line 181 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 212 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_warning ("controller.vala:212: %s", _data_->_tmp46_); +#line 212 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (_data_->_tmp46_); -#line 181 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 212 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (_data_->_tmp44_); -#line 182 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 213 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 182 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 213 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1429 "controller.c" +#line 1560 "controller.c" } else { -#line 182 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 213 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1433 "controller.c" +#line 1564 "controller.c" } -#line 182 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 213 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 182 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 213 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1439 "controller.c" +#line 1570 "controller.c" } -#line 184 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 215 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp47_ = _data_->c; -#line 184 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 215 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp48_ = _g_object_ref0 (_data_->_tmp47_); -#line 184 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 215 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->self->priv->excl_connection); -#line 184 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 215 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->self->priv->excl_connection = _data_->_tmp48_; -#line 1449 "controller.c" +#line 1580 "controller.c" } -#line 187 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 218 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_signal_emit_by_name (_data_->self, "client-connected"); +#line 220 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp49_ = NULL; -#line 187 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 220 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp49_ = g_new0 (guint8, sizeof (ControllerMsg)); -#line 187 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 220 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->t = _data_->_tmp49_; -#line 187 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 220 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->t_length1 = sizeof (ControllerMsg); -#line 187 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 220 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_t_size_ = _data_->t_length1; -#line 1461 "controller.c" +#line 1594 "controller.c" { -#line 188 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 221 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp50_ = TRUE; -#line 188 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 221 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" while (TRUE) { -#line 188 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 221 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp51_ = _data_->_tmp50_; -#line 188 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 221 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (!_data_->_tmp51_) { -#line 1471 "controller.c" +#line 1604 "controller.c" } -#line 188 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 221 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp50_ = FALSE; -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp52_ = _data_->c; -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp53_ = g_io_stream_get_input_stream (_data_->_tmp52_); -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp54_ = _data_->_tmp53_; -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp55_ = _data_->t; -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp55__length1 = _data_->t_length1; -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_state_ = 3; -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_input_stream_read_async (_data_->_tmp54_, _data_->_tmp55_ + 0, (gsize) (sizeof (ControllerMsg) - 0), G_PRIORITY_DEFAULT, NULL, spice_ctrl_controller_handle_client_ready, _data_); -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1491 "controller.c" +#line 1624 "controller.c" _state_3: -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp56_ = 0L; -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp56_ = g_input_stream_read_finish (_data_->_tmp54_, _data_->_res_, &_data_->_inner_error_); -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp57_ = _data_->_tmp56_; -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_inner_error_ != NULL) { -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_error_free (_data_->_inner_error_); -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->t = (g_free (_data_->t), NULL); -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1511 "controller.c" +#line 1644 "controller.c" } else { -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1515 "controller.c" +#line 1648 "controller.c" } -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1521 "controller.c" +#line 1654 "controller.c" } -#line 189 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 222 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->read = _data_->_tmp57_; -#line 190 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 223 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp58_ = _data_->read; -#line 190 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 223 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp58_ == ((gssize) 0)) { -#line 191 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 224 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 1531 "controller.c" +#line 1664 "controller.c" } -#line 193 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 226 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp59_ = _data_->read; -#line 193 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 226 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp60_ = FALSE; -#line 193 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 226 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp60_ = g_warn_if (((gulong) _data_->_tmp59_) != sizeof (ControllerMsg)); -#line 193 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 226 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp60_) { -#line 194 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 227 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp61_ = _data_->read; -#line 194 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 227 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp62_ = NULL; -#line 194 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 227 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp62_ = g_strdup_printf ("%" G_GSSIZE_FORMAT, _data_->_tmp61_); -#line 194 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 227 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp63_ = _data_->_tmp62_; -#line 194 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 227 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp64_ = g_strconcat ("read only: ", _data_->_tmp63_, NULL); -#line 194 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 227 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp65_ = _data_->_tmp64_; -#line 194 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - g_warning ("controller.vala:194: %s", _data_->_tmp65_); -#line 194 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 227 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_warning ("controller.vala:227: %s", _data_->_tmp65_); +#line 227 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (_data_->_tmp65_); -#line 194 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 227 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (_data_->_tmp63_); -#line 195 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 228 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 1561 "controller.c" +#line 1694 "controller.c" } -#line 198 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 231 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp66_ = _data_->t; -#line 198 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 231 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp66__length1 = _data_->t_length1; -#line 198 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 231 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->msg = (ControllerMsg*) _data_->_tmp66_; -#line 199 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 232 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp67_ = _data_->msg; -#line 199 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 232 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp68_ = (*_data_->_tmp67_).size; -#line 199 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 232 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp69_ = FALSE; -#line 199 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 232 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp69_ = g_warn_if (((gulong) _data_->_tmp68_) < sizeof (ControllerMsg)); -#line 199 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 232 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp69_) { -#line 200 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 233 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 1581 "controller.c" +#line 1714 "controller.c" } -#line 202 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 235 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp70_ = _data_->msg; -#line 202 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 235 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp71_ = (*_data_->_tmp70_).size; -#line 202 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 235 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (((gulong) _data_->_tmp71_) > sizeof (ControllerMsg)) { -#line 203 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 236 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp72_ = _data_->msg; -#line 203 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 236 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp73_ = (*_data_->_tmp72_).size; -#line 203 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 236 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp74_ = 0; -#line 203 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 236 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp74_ = (gint) _data_->_tmp73_; -#line 203 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 236 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->t = g_renew (guint8, _data_->t, (gint) _data_->_tmp73_); -#line 203 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 236 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" (_data_->_tmp74_ > _data_->t_length1) ? memset (_data_->t + _data_->t_length1, 0, sizeof (guint8) * (_data_->_tmp74_ - _data_->t_length1)) : NULL; -#line 203 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 236 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->t_length1 = _data_->_tmp74_; -#line 203 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 236 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_t_size_ = _data_->_tmp74_; -#line 204 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 237 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp75_ = _data_->t; -#line 204 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 237 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp75__length1 = _data_->t_length1; -#line 204 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 237 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->msg = (ControllerMsg*) _data_->_tmp75_; -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp76_ = _data_->c; -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp77_ = g_io_stream_get_input_stream (_data_->_tmp76_); -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp78_ = _data_->_tmp77_; -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp79_ = _data_->t; -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp79__length1 = _data_->t_length1; -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp80_ = _data_->msg; -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp81_ = (*_data_->_tmp80_).size; -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_state_ = 4; -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_input_stream_read_async (_data_->_tmp78_, _data_->_tmp79_ + sizeof (ControllerMsg), (gsize) (_data_->_tmp81_ - sizeof (ControllerMsg)), G_PRIORITY_DEFAULT, NULL, spice_ctrl_controller_handle_client_ready, _data_); -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1631 "controller.c" +#line 1764 "controller.c" _state_4: -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp82_ = 0L; -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp82_ = g_input_stream_read_finish (_data_->_tmp78_, _data_->_res_, &_data_->_inner_error_); -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp83_ = _data_->_tmp82_; -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_inner_error_ != NULL) { -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_error_free (_data_->_inner_error_); -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->t = (g_free (_data_->t), NULL); -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1651 "controller.c" +#line 1784 "controller.c" } else { -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1655 "controller.c" +#line 1788 "controller.c" } -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1661 "controller.c" +#line 1794 "controller.c" } -#line 205 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 238 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->read = _data_->_tmp83_; -#line 206 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 239 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp84_ = _data_->read; -#line 206 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 239 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp84_ == ((gssize) 0)) { -#line 207 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 240 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 1671 "controller.c" +#line 1804 "controller.c" } -#line 208 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 241 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp85_ = _data_->read; -#line 208 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 241 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp86_ = _data_->msg; -#line 208 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 241 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp87_ = (*_data_->_tmp86_).size; -#line 208 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 241 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp88_ = FALSE; -#line 208 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 241 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp88_ = g_warn_if (((gulong) _data_->_tmp85_) != (_data_->_tmp87_ - sizeof (ControllerMsg))); -#line 208 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 241 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp88_) { -#line 209 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 242 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 1687 "controller.c" +#line 1820 "controller.c" } } -#line 212 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 245 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp89_ = _data_->msg; -#line 212 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 245 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_handle_message (_data_->self, _data_->_tmp89_); -#line 1694 "controller.c" +#line 1827 "controller.c" } } -#line 215 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 248 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp90_ = _data_->excl; -#line 215 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 248 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_tmp90_) { -#line 216 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 249 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->self->priv->excl_connection); -#line 216 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 249 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->self->priv->excl_connection = NULL; -#line 1705 "controller.c" +#line 1838 "controller.c" } -#line 151 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 182 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->t = (g_free (_data_->t), NULL); -#line 151 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 182 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 151 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 182 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1713 "controller.c" +#line 1846 "controller.c" } else { -#line 151 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 182 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1717 "controller.c" +#line 1850 "controller.c" } -#line 151 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 182 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 151 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 182 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1723 "controller.c" +#line 1856 "controller.c" } SpiceCtrlController* spice_ctrl_controller_construct (GType object_type) { SpiceCtrlController * self = NULL; -#line 219 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 252 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self = (SpiceCtrlController*) g_object_new (object_type, NULL); -#line 219 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 252 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return self; -#line 1733 "controller.c" +#line 1866 "controller.c" } SpiceCtrlController* spice_ctrl_controller_new (void) { -#line 219 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 252 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return spice_ctrl_controller_construct (SPICE_CTRL_TYPE_CONTROLLER); -#line 1740 "controller.c" +#line 1873 "controller.c" } static void spice_ctrl_controller_listen_data_free (gpointer _data) { SpiceCtrlControllerListenData* _data_; _data_ = _data; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (_data_->addr); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->self); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_slice_free (SpiceCtrlControllerListenData, _data_); -#line 1753 "controller.c" +#line 1886 "controller.c" } @@ -1757,622 +1890,622 @@ SpiceCtrlControllerListenData* _data_; SpiceCtrlController* _tmp0_; const gchar* _tmp1_; - const gchar* _tmp2_; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" + gchar* _tmp2_; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_ = g_slice_new0 (SpiceCtrlControllerListenData); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, spice_ctrl_controller_listen); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, spice_ctrl_controller_listen_data_free); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = _g_object_ref0 (self); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->self = _tmp0_; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = addr; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp2_ = g_strdup (_tmp1_); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->addr = _tmp2_; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_listen_co (_data_); -#line 1780 "controller.c" +#line 1913 "controller.c" } void spice_ctrl_controller_listen_finish (SpiceCtrlController* self, GAsyncResult* _res_, GError** error) { SpiceCtrlControllerListenData* _data_; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) { -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return; -#line 1790 "controller.c" +#line 1923 "controller.c" } -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); -#line 1794 "controller.c" +#line 1927 "controller.c" } static void spice_ctrl_controller_listen_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { SpiceCtrlControllerListenData* _data_; -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_ = _user_data_; -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_source_object_ = source_object; -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_res_ = _res_; -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_listen_co (_data_); -#line 1808 "controller.c" +#line 1941 "controller.c" } static gboolean spice_ctrl_controller_listen_co (SpiceCtrlControllerListenData* _data_) { -#line 222 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 255 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" switch (_data_->_state_) { -#line 222 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 255 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case 0: -#line 1817 "controller.c" +#line 1950 "controller.c" goto _state_0; -#line 222 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 255 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case 1: -#line 1821 "controller.c" +#line 1954 "controller.c" goto _state_1; -#line 222 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 255 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case 2: -#line 1825 "controller.c" +#line 1958 "controller.c" goto _state_2; default: -#line 222 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 255 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_assert_not_reached (); -#line 1830 "controller.c" +#line 1963 "controller.c" } _state_0: -#line 224 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 257 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp0_ = _data_->addr; -#line 224 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 257 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp1_ = NULL; -#line 224 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 257 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp1_ = spice_controller_listener_new (_data_->_tmp0_, &_data_->_inner_error_); -#line 224 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 257 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->listener = _data_->_tmp1_; -#line 224 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 257 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_inner_error_ != NULL) { -#line 224 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 257 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); -#line 224 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 257 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_error_free (_data_->_inner_error_); -#line 224 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 257 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 224 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 257 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1851 "controller.c" +#line 1984 "controller.c" } else { -#line 224 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 257 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1855 "controller.c" +#line 1988 "controller.c" } -#line 224 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 257 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 224 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 257 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1861 "controller.c" +#line 1994 "controller.c" } { -#line 226 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 259 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp2_ = TRUE; -#line 226 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 259 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" while (TRUE) { -#line 226 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 259 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp3_ = _data_->_tmp2_; -#line 226 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 259 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (!_data_->_tmp3_) { -#line 1872 "controller.c" +#line 2005 "controller.c" } -#line 226 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 259 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp2_ = FALSE; -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp4_ = _data_->listener; -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_state_ = 1; -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_controller_listener_accept_async (_data_->_tmp4_, NULL, spice_ctrl_controller_listen_ready, _data_); -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1884 "controller.c" +#line 2017 "controller.c" _state_1: -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp5_ = NULL; -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp5_ = spice_controller_listener_accept_finish (_data_->_tmp4_, _data_->_res_, NULL, &_data_->_inner_error_); -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp6_ = _g_object_ref0 (_data_->_tmp5_); -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->c = _data_->_tmp6_; -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_inner_error_ != NULL) { -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_error_free (_data_->_inner_error_); -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->listener); -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1906 "controller.c" +#line 2039 "controller.c" } else { -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1910 "controller.c" +#line 2043 "controller.c" } -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 227 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 260 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1916 "controller.c" +#line 2049 "controller.c" } -#line 228 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 261 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp7_ = _data_->self->priv->nclients; -#line 228 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 261 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->self->priv->nclients = _data_->_tmp7_ + 1; -#line 229 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 262 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp8_ = _data_->c; -#line 229 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 262 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp9_ = _g_object_ref0 (_data_->_tmp8_); -#line 229 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 262 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->self->priv->clients = g_list_append (_data_->self->priv->clients, _data_->_tmp9_); -#line 1928 "controller.c" +#line 2061 "controller.c" { -#line 231 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 264 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp10_ = _data_->c; -#line 231 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 264 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_state_ = 2; -#line 231 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 264 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_handle_client (_data_->self, _data_->_tmp10_, spice_ctrl_controller_listen_ready, _data_); -#line 231 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 264 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1938 "controller.c" +#line 2071 "controller.c" _state_2: -#line 231 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 264 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_handle_client_finish (_data_->self, _data_->_res_, &_data_->_inner_error_); -#line 231 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 264 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_inner_error_ != NULL) { -#line 1944 "controller.c" +#line 2077 "controller.c" goto __catch2_g_error; } } goto __finally2; __catch2_g_error: { -#line 230 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 263 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->e = _data_->_inner_error_; -#line 230 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 263 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_inner_error_ = NULL; -#line 233 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 266 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp11_ = _data_->e; -#line 233 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 266 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp12_ = _data_->_tmp11_->message; -#line 233 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - g_warning ("controller.vala:233: %s", _data_->_tmp12_); -#line 230 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 266 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_warning ("controller.vala:266: %s", _data_->_tmp12_); +#line 263 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_error_free0 (_data_->e); -#line 1963 "controller.c" +#line 2096 "controller.c" } __finally2: -#line 230 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 263 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_inner_error_ != NULL) { -#line 230 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 263 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); -#line 230 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 263 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_error_free (_data_->_inner_error_); -#line 230 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 263 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->c); -#line 230 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 263 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->listener); -#line 230 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 263 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 230 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 263 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 1980 "controller.c" +#line 2113 "controller.c" } else { -#line 230 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 263 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 1984 "controller.c" +#line 2117 "controller.c" } -#line 230 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 263 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 230 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 263 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 1990 "controller.c" +#line 2123 "controller.c" } -#line 235 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 268 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp13_ = _data_->c; -#line 235 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 268 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_io_stream_close (_data_->_tmp13_, NULL, &_data_->_inner_error_); -#line 235 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 268 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_inner_error_ != NULL) { -#line 235 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 268 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); -#line 235 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 268 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_error_free (_data_->_inner_error_); -#line 235 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 268 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->c); -#line 235 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 268 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->listener); -#line 235 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 268 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 235 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 268 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 2010 "controller.c" +#line 2143 "controller.c" } else { -#line 235 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 268 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 2014 "controller.c" +#line 2147 "controller.c" } -#line 235 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 268 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 235 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 268 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 2020 "controller.c" +#line 2153 "controller.c" } -#line 236 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 269 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp14_ = _data_->c; -#line 236 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 269 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->self->priv->clients = g_list_remove (_data_->self->priv->clients, _data_->_tmp14_); -#line 237 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 270 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->_tmp15_ = _data_->self->priv->nclients; -#line 237 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 270 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _data_->self->priv->nclients = _data_->_tmp15_ - 1; -#line 226 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 259 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->c); -#line 2032 "controller.c" +#line 2165 "controller.c" } } -#line 222 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 255 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (_data_->listener); -#line 222 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 255 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (_data_->_state_ == 0) { -#line 222 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 255 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete_in_idle (_data_->_async_result); -#line 2041 "controller.c" +#line 2174 "controller.c" } else { -#line 222 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 255 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_simple_async_result_complete (_data_->_async_result); -#line 2045 "controller.c" +#line 2178 "controller.c" } -#line 222 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 255 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_unref (_data_->_async_result); -#line 222 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 255 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return FALSE; -#line 2051 "controller.c" +#line 2184 "controller.c" } const gchar* spice_ctrl_controller_get_host (SpiceCtrlController* self) { const gchar* result; const gchar* _tmp0_; -#line 29 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 29 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_val_if_fail (self != NULL, NULL); -#line 29 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 29 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = self->priv->_host; -#line 29 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 29 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = _tmp0_; -#line 29 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 29 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2066 "controller.c" +#line 2199 "controller.c" } static void spice_ctrl_controller_set_host (SpiceCtrlController* self, const gchar* value) { const gchar* _tmp0_; gchar* _tmp1_; -#line 29 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 29 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_if_fail (self != NULL); -#line 29 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 29 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = value; -#line 29 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 29 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = g_strdup (_tmp0_); -#line 29 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 29 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (self->priv->_host); -#line 29 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 29 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_host = _tmp1_; -#line 29 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 29 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_notify ((GObject *) self, "host"); -#line 2085 "controller.c" +#line 2218 "controller.c" } guint32 spice_ctrl_controller_get_port (SpiceCtrlController* self) { guint32 result; guint32 _tmp0_; -#line 30 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 30 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_val_if_fail (self != NULL, 0U); -#line 30 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 30 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = self->priv->_port; -#line 30 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 30 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = _tmp0_; -#line 30 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 30 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2100 "controller.c" +#line 2233 "controller.c" } static void spice_ctrl_controller_set_port (SpiceCtrlController* self, guint32 value) { guint32 _tmp0_; -#line 30 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 30 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_if_fail (self != NULL); -#line 30 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 30 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = value; -#line 30 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 30 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_port = _tmp0_; -#line 30 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 30 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_notify ((GObject *) self, "port"); -#line 2114 "controller.c" +#line 2247 "controller.c" } guint32 spice_ctrl_controller_get_sport (SpiceCtrlController* self) { guint32 result; guint32 _tmp0_; -#line 31 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_val_if_fail (self != NULL, 0U); -#line 31 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = self->priv->_sport; -#line 31 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = _tmp0_; -#line 31 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2129 "controller.c" +#line 2262 "controller.c" } static void spice_ctrl_controller_set_sport (SpiceCtrlController* self, guint32 value) { guint32 _tmp0_; -#line 31 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_if_fail (self != NULL); -#line 31 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = value; -#line 31 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_sport = _tmp0_; -#line 31 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_notify ((GObject *) self, "sport"); -#line 2143 "controller.c" +#line 2276 "controller.c" } const gchar* spice_ctrl_controller_get_password (SpiceCtrlController* self) { const gchar* result; const gchar* _tmp0_; -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 32 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_val_if_fail (self != NULL, NULL); -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 32 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = self->priv->_password; -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 32 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = _tmp0_; -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 32 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2158 "controller.c" +#line 2291 "controller.c" } static void spice_ctrl_controller_set_password (SpiceCtrlController* self, const gchar* value) { const gchar* _tmp0_; gchar* _tmp1_; -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 32 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_if_fail (self != NULL); -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 32 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = value; -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 32 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = g_strdup (_tmp0_); -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 32 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (self->priv->_password); -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 32 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_password = _tmp1_; -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 32 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_notify ((GObject *) self, "password"); -#line 2177 "controller.c" +#line 2310 "controller.c" } unsigned int spice_ctrl_controller_get_display_flags (SpiceCtrlController* self) { unsigned int result; unsigned int _tmp0_; -#line 33 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 33 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_val_if_fail (self != NULL, 0); -#line 33 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 33 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = self->priv->_display_flags; -#line 33 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 33 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = _tmp0_; -#line 33 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 33 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2192 "controller.c" +#line 2325 "controller.c" } static void spice_ctrl_controller_set_display_flags (SpiceCtrlController* self, unsigned int value) { unsigned int _tmp0_; -#line 33 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 33 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_if_fail (self != NULL); -#line 33 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 33 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = value; -#line 33 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 33 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_display_flags = _tmp0_; -#line 33 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 33 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_notify ((GObject *) self, "display-flags"); -#line 2206 "controller.c" +#line 2339 "controller.c" } const gchar* spice_ctrl_controller_get_tls_ciphers (SpiceCtrlController* self) { const gchar* result; const gchar* _tmp0_; -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 34 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_val_if_fail (self != NULL, NULL); -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 34 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = self->priv->_tls_ciphers; -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 34 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = _tmp0_; -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 34 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2221 "controller.c" +#line 2354 "controller.c" } static void spice_ctrl_controller_set_tls_ciphers (SpiceCtrlController* self, const gchar* value) { const gchar* _tmp0_; gchar* _tmp1_; -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 34 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_if_fail (self != NULL); -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 34 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = value; -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 34 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = g_strdup (_tmp0_); -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 34 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (self->priv->_tls_ciphers); -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 34 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_tls_ciphers = _tmp1_; -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 34 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_notify ((GObject *) self, "tls-ciphers"); -#line 2240 "controller.c" +#line 2373 "controller.c" } const gchar* spice_ctrl_controller_get_host_subject (SpiceCtrlController* self) { const gchar* result; const gchar* _tmp0_; -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_val_if_fail (self != NULL, NULL); -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = self->priv->_host_subject; -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = _tmp0_; -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2255 "controller.c" +#line 2388 "controller.c" } static void spice_ctrl_controller_set_host_subject (SpiceCtrlController* self, const gchar* value) { const gchar* _tmp0_; gchar* _tmp1_; -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_if_fail (self != NULL); -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = value; -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = g_strdup (_tmp0_); -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (self->priv->_host_subject); -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_host_subject = _tmp1_; -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_notify ((GObject *) self, "host-subject"); -#line 2274 "controller.c" +#line 2407 "controller.c" } const gchar* spice_ctrl_controller_get_ca_file (SpiceCtrlController* self) { const gchar* result; const gchar* _tmp0_; -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 36 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_val_if_fail (self != NULL, NULL); -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 36 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = self->priv->_ca_file; -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 36 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = _tmp0_; -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 36 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2289 "controller.c" +#line 2422 "controller.c" } static void spice_ctrl_controller_set_ca_file (SpiceCtrlController* self, const gchar* value) { const gchar* _tmp0_; gchar* _tmp1_; -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 36 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_if_fail (self != NULL); -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 36 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = value; -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 36 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = g_strdup (_tmp0_); -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 36 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (self->priv->_ca_file); -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 36 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_ca_file = _tmp1_; -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 36 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_notify ((GObject *) self, "ca-file"); -#line 2308 "controller.c" +#line 2441 "controller.c" } const gchar* spice_ctrl_controller_get_title (SpiceCtrlController* self) { const gchar* result; const gchar* _tmp0_; -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_val_if_fail (self != NULL, NULL); -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = self->priv->_title; -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = _tmp0_; -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2323 "controller.c" +#line 2456 "controller.c" } static void spice_ctrl_controller_set_title (SpiceCtrlController* self, const gchar* value) { const gchar* _tmp0_; gchar* _tmp1_; -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_if_fail (self != NULL); -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = value; -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = g_strdup (_tmp0_); -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (self->priv->_title); -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_title = _tmp1_; -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_notify ((GObject *) self, "title"); -#line 2342 "controller.c" +#line 2475 "controller.c" } const gchar* spice_ctrl_controller_get_hotkeys (SpiceCtrlController* self) { const gchar* result; const gchar* _tmp0_; -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_val_if_fail (self != NULL, NULL); -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = self->priv->_hotkeys; -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = _tmp0_; -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2357 "controller.c" +#line 2490 "controller.c" } static void spice_ctrl_controller_set_hotkeys (SpiceCtrlController* self, const gchar* value) { const gchar* _tmp0_; gchar* _tmp1_; -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_if_fail (self != NULL); -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = value; -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = g_strdup (_tmp0_); -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (self->priv->_hotkeys); -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_hotkeys = _tmp1_; -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_notify ((GObject *) self, "hotkeys"); -#line 2376 "controller.c" +#line 2509 "controller.c" } @@ -2382,48 +2515,48 @@ gint _tmp0__length1; gchar** _tmp1_; gint _tmp1__length1; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_val_if_fail (self != NULL, NULL); -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = self->priv->_secure_channels; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0__length1 = self->priv->_secure_channels_length1; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = _tmp0_; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1__length1 = _tmp0__length1; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (result_length1) { -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" *result_length1 = _tmp1__length1; -#line 2400 "controller.c" +#line 2533 "controller.c" } -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = _tmp1_; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2406 "controller.c" +#line 2539 "controller.c" } -static gchar** _vala_array_dup2 (gchar** self, int length) { +static gchar** _vala_array_dup1 (gchar** self, int length) { gchar** result; int i; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = g_new0 (gchar*, length + 1); -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" for (i = 0; i < length; i++) { -#line 2417 "controller.c" +#line 2550 "controller.c" gchar* _tmp0_; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = g_strdup (self[i]); -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result[i] = _tmp0_; -#line 2423 "controller.c" +#line 2556 "controller.c" } -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2427 "controller.c" +#line 2560 "controller.c" } @@ -2432,27 +2565,27 @@ gint _tmp0__length1; gchar** _tmp1_; gint _tmp1__length1; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_if_fail (self != NULL); -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = value; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0__length1 = value_length1; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup2 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_); -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup1 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_); +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1__length1 = _tmp0__length1; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_secure_channels = (_vala_array_free (self->priv->_secure_channels, self->priv->_secure_channels_length1, (GDestroyNotify) g_free), NULL); -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_secure_channels = _tmp1_; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_secure_channels_length1 = _tmp1__length1; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->__secure_channels_size_ = self->priv->_secure_channels_length1; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_notify ((GObject *) self, "secure-channels"); -#line 2456 "controller.c" +#line 2589 "controller.c" } @@ -2462,48 +2595,48 @@ gint _tmp0__length1; gchar** _tmp1_; gint _tmp1__length1; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_val_if_fail (self != NULL, NULL); -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = self->priv->_disable_channels; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0__length1 = self->priv->_disable_channels_length1; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = _tmp0_; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1__length1 = _tmp0__length1; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" if (result_length1) { -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" *result_length1 = _tmp1__length1; -#line 2480 "controller.c" +#line 2613 "controller.c" } -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = _tmp1_; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2486 "controller.c" +#line 2619 "controller.c" } -static gchar** _vala_array_dup3 (gchar** self, int length) { +static gchar** _vala_array_dup2 (gchar** self, int length) { gchar** result; int i; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = g_new0 (gchar*, length + 1); -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" for (i = 0; i < length; i++) { -#line 2497 "controller.c" +#line 2630 "controller.c" gchar* _tmp0_; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = g_strdup (self[i]); -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result[i] = _tmp0_; -#line 2503 "controller.c" +#line 2636 "controller.c" } -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2507 "controller.c" +#line 2640 "controller.c" } @@ -2512,149 +2645,428 @@ gint _tmp0__length1; gchar** _tmp1_; gint _tmp1__length1; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_if_fail (self != NULL); -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = value; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0__length1 = value_length1; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" - _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup3 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_); -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup2 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_); +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1__length1 = _tmp0__length1; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_disable_channels = (_vala_array_free (self->priv->_disable_channels, self->priv->_disable_channels_length1, (GDestroyNotify) g_free), NULL); -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_disable_channels = _tmp1_; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_disable_channels_length1 = _tmp1__length1; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->__disable_channels_size_ = self->priv->_disable_channels_length1; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_notify ((GObject *) self, "disable-channels"); -#line 2536 "controller.c" +#line 2669 "controller.c" } SpiceCtrlMenu* spice_ctrl_controller_get_menu (SpiceCtrlController* self) { SpiceCtrlMenu* result; SpiceCtrlMenu* _tmp0_; -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_val_if_fail (self != NULL, NULL); -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = self->priv->_menu; -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" result = _tmp0_; -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" return result; -#line 2551 "controller.c" +#line 2684 "controller.c" } static void spice_ctrl_controller_set_menu (SpiceCtrlController* self, SpiceCtrlMenu* value) { SpiceCtrlMenu* _tmp0_; SpiceCtrlMenu* _tmp1_; -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_return_if_fail (self != NULL); -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp0_ = value; -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _tmp1_ = _g_object_ref0 (_tmp0_); -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (self->priv->_menu); -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_menu = _tmp1_; -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_notify ((GObject *) self, "menu"); -#line 2570 "controller.c" +#line 2703 "controller.c" +} + + +gboolean spice_ctrl_controller_get_enable_smartcard (SpiceCtrlController* self) { + gboolean result; + gboolean _tmp0_; +#line 42 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 42 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = self->priv->_enable_smartcard; +#line 42 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + result = _tmp0_; +#line 42 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + return result; +#line 2718 "controller.c" +} + + +static void spice_ctrl_controller_set_enable_smartcard (SpiceCtrlController* self, gboolean value) { + gboolean _tmp0_; +#line 42 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_return_if_fail (self != NULL); +#line 42 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = value; +#line 42 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + self->priv->_enable_smartcard = _tmp0_; +#line 42 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_object_notify ((GObject *) self, "enable-smartcard"); +#line 2732 "controller.c" +} + + +gboolean spice_ctrl_controller_get_send_cad (SpiceCtrlController* self) { + gboolean result; + gboolean _tmp0_; +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = self->priv->_send_cad; +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + result = _tmp0_; +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + return result; +#line 2747 "controller.c" +} + + +static void spice_ctrl_controller_set_send_cad (SpiceCtrlController* self, gboolean value) { + gboolean _tmp0_; +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_return_if_fail (self != NULL); +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = value; +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + self->priv->_send_cad = _tmp0_; +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_object_notify ((GObject *) self, "send-cad"); +#line 2761 "controller.c" +} + + +gchar** spice_ctrl_controller_get_disable_effects (SpiceCtrlController* self, int* result_length1) { + gchar** result; + gchar** _tmp0_; + gint _tmp0__length1; + gchar** _tmp1_; + gint _tmp1__length1; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = self->priv->_disable_effects; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0__length1 = self->priv->_disable_effects_length1; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp1_ = _tmp0_; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp1__length1 = _tmp0__length1; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + if (result_length1) { +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + *result_length1 = _tmp1__length1; +#line 2785 "controller.c" + } +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + result = _tmp1_; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + return result; +#line 2791 "controller.c" +} + + +static gchar** _vala_array_dup3 (gchar** self, int length) { + gchar** result; + int i; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + result = g_new0 (gchar*, length + 1); +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + for (i = 0; i < length; i++) { +#line 2802 "controller.c" + gchar* _tmp0_; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = g_strdup (self[i]); +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + result[i] = _tmp0_; +#line 2808 "controller.c" + } +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + return result; +#line 2812 "controller.c" +} + + +static void spice_ctrl_controller_set_disable_effects (SpiceCtrlController* self, gchar** value, int value_length1) { + gchar** _tmp0_; + gint _tmp0__length1; + gchar** _tmp1_; + gint _tmp1__length1; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_return_if_fail (self != NULL); +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = value; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0__length1 = value_length1; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup3 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_); +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp1__length1 = _tmp0__length1; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + self->priv->_disable_effects = (_vala_array_free (self->priv->_disable_effects, self->priv->_disable_effects_length1, (GDestroyNotify) g_free), NULL); +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + self->priv->_disable_effects = _tmp1_; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + self->priv->_disable_effects_length1 = _tmp1__length1; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + self->priv->__disable_effects_size_ = self->priv->_disable_effects_length1; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_object_notify ((GObject *) self, "disable-effects"); +#line 2841 "controller.c" +} + + +guint32 spice_ctrl_controller_get_color_depth (SpiceCtrlController* self) { + guint32 result; + guint32 _tmp0_; +#line 45 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_return_val_if_fail (self != NULL, 0U); +#line 45 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = self->priv->_color_depth; +#line 45 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + result = _tmp0_; +#line 45 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + return result; +#line 2856 "controller.c" +} + + +static void spice_ctrl_controller_set_color_depth (SpiceCtrlController* self, guint32 value) { + guint32 _tmp0_; +#line 45 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_return_if_fail (self != NULL); +#line 45 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = value; +#line 45 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + self->priv->_color_depth = _tmp0_; +#line 45 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_object_notify ((GObject *) self, "color-depth"); +#line 2870 "controller.c" +} + + +gboolean spice_ctrl_controller_get_enable_usbredir (SpiceCtrlController* self) { + gboolean result; + gboolean _tmp0_; +#line 46 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 46 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = self->priv->_enable_usbredir; +#line 46 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + result = _tmp0_; +#line 46 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + return result; +#line 2885 "controller.c" +} + + +static void spice_ctrl_controller_set_enable_usbredir (SpiceCtrlController* self, gboolean value) { + gboolean _tmp0_; +#line 46 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_return_if_fail (self != NULL); +#line 46 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = value; +#line 46 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + self->priv->_enable_usbredir = _tmp0_; +#line 46 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_object_notify ((GObject *) self, "enable-usbredir"); +#line 2899 "controller.c" +} + + +gboolean spice_ctrl_controller_get_enable_usb_autoshare (SpiceCtrlController* self) { + gboolean result; + gboolean _tmp0_; +#line 47 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 47 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = self->priv->_enable_usb_autoshare; +#line 47 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + result = _tmp0_; +#line 47 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + return result; +#line 2914 "controller.c" +} + + +static void spice_ctrl_controller_set_enable_usb_autoshare (SpiceCtrlController* self, gboolean value) { + gboolean _tmp0_; +#line 47 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_return_if_fail (self != NULL); +#line 47 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = value; +#line 47 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + self->priv->_enable_usb_autoshare = _tmp0_; +#line 47 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_object_notify ((GObject *) self, "enable-usb-autoshare"); +#line 2928 "controller.c" +} + + +const gchar* spice_ctrl_controller_get_usb_filter (SpiceCtrlController* self) { + const gchar* result; + const gchar* _tmp0_; +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = self->priv->_usb_filter; +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + result = _tmp0_; +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + return result; +#line 2943 "controller.c" +} + + +static void spice_ctrl_controller_set_usb_filter (SpiceCtrlController* self, const gchar* value) { + const gchar* _tmp0_; + gchar* _tmp1_; +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_return_if_fail (self != NULL); +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp0_ = value; +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _tmp1_ = g_strdup (_tmp0_); +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _g_free0 (self->priv->_usb_filter); +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + self->priv->_usb_filter = _tmp1_; +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_object_notify ((GObject *) self, "usb-filter"); +#line 2962 "controller.c" } static void spice_ctrl_controller_class_init (SpiceCtrlControllerClass * klass) { -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_parent_class = g_type_class_peek_parent (klass); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_type_class_add_private (klass, sizeof (SpiceCtrlControllerPrivate)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" G_OBJECT_CLASS (klass)->get_property = _vala_spice_ctrl_controller_get_property; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" G_OBJECT_CLASS (klass)->set_property = _vala_spice_ctrl_controller_set_property; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" G_OBJECT_CLASS (klass)->finalize = spice_ctrl_controller_finalize; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_PORT, g_param_spec_uint ("port", "port", "port", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_SPORT, g_param_spec_uint ("sport", "sport", "sport", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_PASSWORD, g_param_spec_string ("password", "password", "password", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_DISPLAY_FLAGS, g_param_spec_uint ("display-flags", "display-flags", "display-flags", 0, G_MAXUINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_TLS_CIPHERS, g_param_spec_string ("tls-ciphers", "tls-ciphers", "tls-ciphers", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_HOST_SUBJECT, g_param_spec_string ("host-subject", "host-subject", "host-subject", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_CA_FILE, g_param_spec_string ("ca-file", "ca-file", "ca-file", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_TITLE, g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_HOTKEYS, g_param_spec_string ("hotkeys", "hotkeys", "hotkeys", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_SECURE_CHANNELS, g_param_spec_boxed ("secure-channels", "secure-channels", "secure-channels", G_TYPE_STRV, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_DISABLE_CHANNELS, g_param_spec_boxed ("disable-channels", "disable-channels", "disable-channels", G_TYPE_STRV, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_MENU, g_param_spec_object ("menu", "menu", "menu", SPICE_CTRL_TYPE_MENU, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_ENABLE_SMARTCARD, g_param_spec_boolean ("enable-smartcard", "enable-smartcard", "enable-smartcard", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_SEND_CAD, g_param_spec_boolean ("send-cad", "send-cad", "send-cad", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_DISABLE_EFFECTS, g_param_spec_boxed ("disable-effects", "disable-effects", "disable-effects", G_TYPE_STRV, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_COLOR_DEPTH, g_param_spec_uint ("color-depth", "color-depth", "color-depth", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_ENABLE_USBREDIR, g_param_spec_boolean ("enable-usbredir", "enable-usbredir", "enable-usbredir", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_ENABLE_USB_AUTOSHARE, g_param_spec_boolean ("enable-usb-autoshare", "enable-usb-autoshare", "enable-usb-autoshare", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_CONTROLLER_USB_FILTER, g_param_spec_string ("usb-filter", "usb-filter", "usb-filter", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_signal_new ("do_connect", SPICE_CTRL_TYPE_CONTROLLER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_signal_new ("show", SPICE_CTRL_TYPE_CONTROLLER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_signal_new ("hide", SPICE_CTRL_TYPE_CONTROLLER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); -#line 2617 "controller.c" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_signal_new ("client_connected", SPICE_CTRL_TYPE_CONTROLLER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); +#line 3025 "controller.c" } static void spice_ctrl_controller_instance_init (SpiceCtrlController * self) { -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv = SPICE_CTRL_CONTROLLER_GET_PRIVATE (self); -#line 2624 "controller.c" +#line 3032 "controller.c" } static void spice_ctrl_controller_finalize (GObject* obj) { SpiceCtrlController * self; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self = SPICE_CTRL_CONTROLLER (obj); -#line 29 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 29 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (self->priv->_host); -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 32 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (self->priv->_password); -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 34 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (self->priv->_tls_ciphers); -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (self->priv->_host_subject); -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 36 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (self->priv->_ca_file); -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (self->priv->_title); -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_free0 (self->priv->_hotkeys); -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_secure_channels = (_vala_array_free (self->priv->_secure_channels, self->priv->_secure_channels_length1, (GDestroyNotify) g_free), NULL); -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" self->priv->_disable_channels = (_vala_array_free (self->priv->_disable_channels, self->priv->_disable_channels_length1, (GDestroyNotify) g_free), NULL); -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (self->priv->_menu); -#line 75 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + self->priv->_disable_effects = (_vala_array_free (self->priv->_disable_effects, self->priv->_disable_effects_length1, (GDestroyNotify) g_free), NULL); +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + _g_free0 (self->priv->_usb_filter); +#line 84 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" _g_object_unref0 (self->priv->excl_connection); -#line 77 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" __g_list_free__g_object_unref0_0 (self->priv->clients); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" G_OBJECT_CLASS (spice_ctrl_controller_parent_class)->finalize (obj); -#line 2658 "controller.c" +#line 3070 "controller.c" } @@ -2673,103 +3085,150 @@ static void _vala_spice_ctrl_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { SpiceCtrlController * self; self = SPICE_CTRL_CONTROLLER (object); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" switch (property_id) { -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_HOST: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_value_set_string (value, spice_ctrl_controller_get_host (self)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_PORT: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_value_set_uint (value, spice_ctrl_controller_get_port (self)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_SPORT: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_value_set_uint (value, spice_ctrl_controller_get_sport (self)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_PASSWORD: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_value_set_string (value, spice_ctrl_controller_get_password (self)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_DISPLAY_FLAGS: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_value_set_uint (value, spice_ctrl_controller_get_display_flags (self)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_TLS_CIPHERS: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_value_set_string (value, spice_ctrl_controller_get_tls_ciphers (self)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_HOST_SUBJECT: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_value_set_string (value, spice_ctrl_controller_get_host_subject (self)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_CA_FILE: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_value_set_string (value, spice_ctrl_controller_get_ca_file (self)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_TITLE: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_value_set_string (value, spice_ctrl_controller_get_title (self)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_HOTKEYS: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_value_set_string (value, spice_ctrl_controller_get_hotkeys (self)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_SECURE_CHANNELS: -#line 2741 "controller.c" +#line 3153 "controller.c" { int length; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_value_set_boxed (value, spice_ctrl_controller_get_secure_channels (self, &length)); -#line 2746 "controller.c" +#line 3158 "controller.c" } -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_DISABLE_CHANNELS: -#line 2752 "controller.c" +#line 3164 "controller.c" { int length; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_value_set_boxed (value, spice_ctrl_controller_get_disable_channels (self, &length)); -#line 2757 "controller.c" +#line 3169 "controller.c" } -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_MENU: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" g_value_set_object (value, spice_ctrl_controller_get_menu (self)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case SPICE_CTRL_CONTROLLER_ENABLE_SMARTCARD: +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_value_set_boolean (value, spice_ctrl_controller_get_enable_smartcard (self)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case SPICE_CTRL_CONTROLLER_SEND_CAD: +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_value_set_boolean (value, spice_ctrl_controller_get_send_cad (self)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case SPICE_CTRL_CONTROLLER_DISABLE_EFFECTS: +#line 3193 "controller.c" + { + int length; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_value_set_boxed (value, spice_ctrl_controller_get_disable_effects (self, &length)); +#line 3198 "controller.c" + } +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case SPICE_CTRL_CONTROLLER_COLOR_DEPTH: +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_value_set_uint (value, spice_ctrl_controller_get_color_depth (self)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case SPICE_CTRL_CONTROLLER_ENABLE_USBREDIR: +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_value_set_boolean (value, spice_ctrl_controller_get_enable_usbredir (self)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case SPICE_CTRL_CONTROLLER_ENABLE_USB_AUTOSHARE: +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_value_set_boolean (value, spice_ctrl_controller_get_enable_usb_autoshare (self)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case SPICE_CTRL_CONTROLLER_USB_FILTER: +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + g_value_set_string (value, spice_ctrl_controller_get_usb_filter (self)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 2767 "controller.c" +#line 3226 "controller.c" default: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 2773 "controller.c" +#line 3232 "controller.c" } } @@ -2777,107 +3236,156 @@ static void _vala_spice_ctrl_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { SpiceCtrlController * self; self = SPICE_CTRL_CONTROLLER (object); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" switch (property_id) { -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_HOST: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_host (self, g_value_get_string (value)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_PORT: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_port (self, g_value_get_uint (value)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_SPORT: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_sport (self, g_value_get_uint (value)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_PASSWORD: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_password (self, g_value_get_string (value)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_DISPLAY_FLAGS: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_display_flags (self, g_value_get_uint (value)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_TLS_CIPHERS: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_tls_ciphers (self, g_value_get_string (value)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_HOST_SUBJECT: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_host_subject (self, g_value_get_string (value)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_CA_FILE: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_ca_file (self, g_value_get_string (value)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_TITLE: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_title (self, g_value_get_string (value)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_HOTKEYS: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_hotkeys (self, g_value_get_string (value)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_SECURE_CHANNELS: -#line 2845 "controller.c" +#line 3304 "controller.c" { gpointer boxed; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" boxed = g_value_get_boxed (value); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_secure_channels (self, boxed, g_strv_length (boxed)); -#line 2852 "controller.c" +#line 3311 "controller.c" } -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_DISABLE_CHANNELS: -#line 2858 "controller.c" +#line 3317 "controller.c" { gpointer boxed; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" boxed = g_value_get_boxed (value); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_disable_channels (self, boxed, g_strv_length (boxed)); -#line 2865 "controller.c" +#line 3324 "controller.c" } -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" case SPICE_CTRL_CONTROLLER_MENU: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" spice_ctrl_controller_set_menu (self, g_value_get_object (value)); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case SPICE_CTRL_CONTROLLER_ENABLE_SMARTCARD: +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_enable_smartcard (self, g_value_get_boolean (value)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case SPICE_CTRL_CONTROLLER_SEND_CAD: +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_send_cad (self, g_value_get_boolean (value)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case SPICE_CTRL_CONTROLLER_DISABLE_EFFECTS: +#line 3348 "controller.c" + { + gpointer boxed; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + boxed = g_value_get_boxed (value); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_disable_effects (self, boxed, g_strv_length (boxed)); +#line 3355 "controller.c" + } +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case SPICE_CTRL_CONTROLLER_COLOR_DEPTH: +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_color_depth (self, g_value_get_uint (value)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case SPICE_CTRL_CONTROLLER_ENABLE_USBREDIR: +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_enable_usbredir (self, g_value_get_boolean (value)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case SPICE_CTRL_CONTROLLER_ENABLE_USB_AUTOSHARE: +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_enable_usb_autoshare (self, g_value_get_boolean (value)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + break; +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + case SPICE_CTRL_CONTROLLER_USB_FILTER: +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" + spice_ctrl_controller_set_usb_filter (self, g_value_get_string (value)); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 2875 "controller.c" +#line 3383 "controller.c" default: -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/controller.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/controller.vala" break; -#line 2881 "controller.c" +#line 3389 "controller.c" } } diff -Nru spice-gtk-0.9/gtk/controller/controller.vala spice-gtk-0.12/gtk/controller/controller.vala --- spice-gtk-0.9/gtk/controller/controller.vala 2012-01-27 08:56:56.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/controller.vala 2012-04-11 13:51:02.000000000 +0000 @@ -39,11 +39,20 @@ public string[] secure_channels { private set; get; } public string[] disable_channels { private set; get; } public SpiceCtrl.Menu? menu { private set; get; } + public bool enable_smartcard { private set; get; } + public bool send_cad { private set; get; } + public string[] disable_effects {private set; get; } + public uint32 color_depth {private set; get; } + public bool enable_usbredir { private set; get; } + public bool enable_usb_autoshare { private set; get; } + public string usb_filter { private set; get; } public signal void do_connect (); public signal void show (); public signal void hide (); + public signal void client_connected (); + public void menu_item_click_msg (int32 item_id) { var msg = SpiceProtocol.Controller.MsgValue (); msg.base.size = (uint32)sizeof (SpiceProtocol.Controller.MsgValue); @@ -119,6 +128,9 @@ case SpiceProtocol.Controller.MsgId.SET_TITLE: title = str; break; + case SpiceProtocol.Controller.MsgId.ENABLE_SMARTCARD: + enable_smartcard = (bool)v.value; + break; case SpiceProtocol.Controller.MsgId.CREATE_MENU: menu = new SpiceCtrl.Menu.from_string (str); @@ -127,11 +139,21 @@ menu = null; break; - // ignore SEND_CAD + case SpiceProtocol.Controller.MsgId.SEND_CAD: + send_cad = (bool)v.value; + break; + case SpiceProtocol.Controller.MsgId.HOTKEYS: hotkeys = str; break; + case SpiceProtocol.Controller.MsgId.COLOR_DEPTH: + color_depth = v.value; + break; + case SpiceProtocol.Controller.MsgId.DISABLE_EFFECTS: + disable_effects = str.split(","); + break; + case SpiceProtocol.Controller.MsgId.CONNECT: do_connect (); break; @@ -141,6 +163,15 @@ case SpiceProtocol.Controller.MsgId.HIDE: hide (); break; + case SpiceProtocol.Controller.MsgId.ENABLE_USB: + enable_usbredir = (bool)v.value; + break; + case SpiceProtocol.Controller.MsgId.ENABLE_USB_AUTOSHARE: + enable_usb_autoshare = (bool)v.value; + break; + case SpiceProtocol.Controller.MsgId.USB_FILTER: + usb_filter = str; + break; default: warn_if_reached (); return false; @@ -184,6 +215,8 @@ excl_connection = c; } + client_connected (); + var t = new uint8[sizeof(SpiceProtocol.Controller.Msg)]; for (;;) { read = yield c.input_stream.read_async (t[0:sizeof(SpiceProtocol.Controller.Msg)]); diff -Nru spice-gtk-0.9/gtk/controller/custom.vapi spice-gtk-0.12/gtk/controller/custom.vapi --- spice-gtk-0.9/gtk/controller/custom.vapi 2012-01-27 08:56:56.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/custom.vapi 2012-04-11 13:51:02.000000000 +0000 @@ -16,4 +16,13 @@ [CCode (cname = "spice_controller_listener_accept_async", cheader_filename = "spice-controller-listener.h")] public async unowned GLib.IOStream accept_async (GLib.Cancellable? cancellable = null, out GLib.Object? source_object = null) throws GLib.Error; } + + [CCode (cname = "GObject", ref_function = "g_object_ref", unref_function = "g_object_unref", free_function = "")] + class ForeignMenuListener { + [CCode (cname = "spice_foreign_menu_listener_new", cheader_filename = "spice-foreign-menu-listener.h")] + public static ForeignMenuListener new_listener (string addr) throws GLib.Error; + + [CCode (cname = "spice_foreign_menu_listener_accept_async", cheader_filename = "spice-foreign-menu-listener.h")] + public async unowned GLib.IOStream accept_async (GLib.Cancellable? cancellable = null, out GLib.Object? source_object = null) throws GLib.Error; + } } diff -Nru spice-gtk-0.9/gtk/controller/dump.c spice-gtk-0.12/gtk/controller/dump.c --- spice-gtk-0.9/gtk/controller/dump.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/dump.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,117 @@ +/* Copyright (C) 2011 Red Hat, Inc. */ + +/* This library is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Lesser General Public */ +/* License as published by the Free Software Foundation; either */ +/* version 2.1 of the License, or (at your option) any later version. */ + +/* This library is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ +/* Lesser General Public License for more details. */ + +/* You should have received a copy of the GNU Lesser General Public */ +/* License along with this library; if not, see . */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#ifdef WIN32 +#include +#else +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "spice-controller.h" + +SpiceCtrlController *ctrl = NULL; +SpiceCtrlForeignMenu *menu = NULL; +GMainLoop *loop = NULL; + +void signaled (GObject *gobject, const gchar *signal_name) +{ + g_message ("signaled: %s", signal_name); +} + +void notified (GObject *gobject, GParamSpec *pspec, + gpointer user_data) +{ + GValue value = { 0, }; + GValue strvalue = { 0, }; + + g_return_if_fail (gobject != NULL); + g_return_if_fail (pspec != NULL); + + g_value_init (&value, pspec->value_type); + g_value_init (&strvalue, G_TYPE_STRING); + g_object_get_property (gobject, pspec->name, &value); + + if (pspec->value_type == G_TYPE_STRV) { + gchar** p = (gchar **)g_value_get_boxed (&value); + g_message ("notify::%s == ", pspec->name); + while (*p) + g_message ("%s", *p++); + } else if (G_TYPE_IS_OBJECT(pspec->value_type)) { + GObject *o = g_value_get_object (&value); + g_message ("notify::%s == %s", pspec->name, o ? G_OBJECT_TYPE_NAME (o) : "null"); + } else { + g_value_transform (&value, &strvalue); + g_message ("notify::%s = %s", pspec->name, g_value_get_string (&strvalue)); + } + + g_value_unset (&value); + g_value_unset (&strvalue); +} + +void connect_signals (gpointer obj) +{ + guint i, n_ids = 0; + guint *ids = NULL; + GType type = G_OBJECT_TYPE (obj); + + ids = g_signal_list_ids (type, &n_ids); + for (i = 0; i < n_ids; i++) { + const gchar *name = g_signal_name (ids[i]); + g_signal_connect (obj, name, G_CALLBACK (signaled), (gpointer)name); + } +} + +int main (int argc, char *argv[]) +{ + g_type_init (); + loop = g_main_loop_new (NULL, FALSE); + + if (argc > 1 && g_str_equal(argv[1], "--menu")) { + menu = spice_ctrl_foreign_menu_new (); + g_signal_connect (menu, "notify", G_CALLBACK (notified), NULL); + connect_signals (menu); + + spice_ctrl_foreign_menu_listen (menu, NULL, NULL, NULL); + } else { + ctrl = spice_ctrl_controller_new (); + g_signal_connect (ctrl, "notify", G_CALLBACK (notified), NULL); + connect_signals (ctrl); + + spice_ctrl_controller_listen (ctrl, NULL, NULL, NULL); + } + + g_main_loop_run (loop); + + if (ctrl != NULL) + g_object_unref (ctrl); + if (menu != NULL) + g_object_unref (menu); + + return 0; +} + diff -Nru spice-gtk-0.9/gtk/controller/foreign-menu.c spice-gtk-0.12/gtk/controller/foreign-menu.c --- spice-gtk-0.9/gtk/controller/foreign-menu.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/foreign-menu.c 2012-04-24 11:24:37.000000000 +0000 @@ -0,0 +1,2197 @@ +/* foreign-menu.c generated by valac 0.16.0, the Vala compiler + * generated from foreign-menu.vala, do not modify */ + +/* Copyright (C) 2012 Red Hat, Inc.*/ +/* This library is free software; you can redistribute it and/or*/ +/* modify it under the terms of the GNU Lesser General Public*/ +/* License as published by the Free Software Foundation; either*/ +/* version 2.1 of the License, or (at your option) any later version.*/ +/* This library is distributed in the hope that it will be useful,*/ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of*/ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU*/ +/* Lesser General Public License for more details.*/ +/* You should have received a copy of the GNU Lesser General Public*/ +/* License along with this library; if not, see .*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define SPICE_CTRL_TYPE_FOREIGN_MENU (spice_ctrl_foreign_menu_get_type ()) +#define SPICE_CTRL_FOREIGN_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPICE_CTRL_TYPE_FOREIGN_MENU, SpiceCtrlForeignMenu)) +#define SPICE_CTRL_FOREIGN_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SPICE_CTRL_TYPE_FOREIGN_MENU, SpiceCtrlForeignMenuClass)) +#define SPICE_CTRL_IS_FOREIGN_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SPICE_CTRL_TYPE_FOREIGN_MENU)) +#define SPICE_CTRL_IS_FOREIGN_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SPICE_CTRL_TYPE_FOREIGN_MENU)) +#define SPICE_CTRL_FOREIGN_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SPICE_CTRL_TYPE_FOREIGN_MENU, SpiceCtrlForeignMenuClass)) + +typedef struct _SpiceCtrlForeignMenu SpiceCtrlForeignMenu; +typedef struct _SpiceCtrlForeignMenuClass SpiceCtrlForeignMenuClass; +typedef struct _SpiceCtrlForeignMenuPrivate SpiceCtrlForeignMenuPrivate; + +#define SPICE_CTRL_TYPE_MENU (spice_ctrl_menu_get_type ()) +#define SPICE_CTRL_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPICE_CTRL_TYPE_MENU, SpiceCtrlMenu)) +#define SPICE_CTRL_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SPICE_CTRL_TYPE_MENU, SpiceCtrlMenuClass)) +#define SPICE_CTRL_IS_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SPICE_CTRL_TYPE_MENU)) +#define SPICE_CTRL_IS_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SPICE_CTRL_TYPE_MENU)) +#define SPICE_CTRL_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SPICE_CTRL_TYPE_MENU, SpiceCtrlMenuClass)) + +typedef struct _SpiceCtrlMenu SpiceCtrlMenu; +typedef struct _SpiceCtrlMenuClass SpiceCtrlMenuClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL))) +#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) +typedef struct _SpiceCtrlForeignMenuSendMsgData SpiceCtrlForeignMenuSendMsgData; +typedef struct _SpiceCtrlMenuPrivate SpiceCtrlMenuPrivate; + +#define SPICE_CTRL_TYPE_MENU_ITEM (spice_ctrl_menu_item_get_type ()) +#define SPICE_CTRL_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPICE_CTRL_TYPE_MENU_ITEM, SpiceCtrlMenuItem)) +#define SPICE_CTRL_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SPICE_CTRL_TYPE_MENU_ITEM, SpiceCtrlMenuItemClass)) +#define SPICE_CTRL_IS_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SPICE_CTRL_TYPE_MENU_ITEM)) +#define SPICE_CTRL_IS_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SPICE_CTRL_TYPE_MENU_ITEM)) +#define SPICE_CTRL_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SPICE_CTRL_TYPE_MENU_ITEM, SpiceCtrlMenuItemClass)) + +typedef struct _SpiceCtrlMenuItem SpiceCtrlMenuItem; +typedef struct _SpiceCtrlMenuItemClass SpiceCtrlMenuItemClass; +typedef struct _SpiceCtrlForeignMenuHandleClientData SpiceCtrlForeignMenuHandleClientData; +typedef struct _SpiceCtrlForeignMenuListenData SpiceCtrlForeignMenuListenData; + +struct _SpiceCtrlForeignMenu { + GObject parent_instance; + SpiceCtrlForeignMenuPrivate * priv; +}; + +struct _SpiceCtrlForeignMenuClass { + GObjectClass parent_class; +}; + +struct _SpiceCtrlForeignMenuPrivate { + SpiceCtrlMenu* _menu; + gchar* _title; + gint nclients; + GList* clients; +}; + +struct _SpiceCtrlForeignMenuSendMsgData { + int _state_; + GObject* _source_object_; + GAsyncResult* _res_; + GSimpleAsyncResult* _async_result; + SpiceCtrlForeignMenu* self; + guint8* p; + gint p_length1; + gboolean result; + GList* _tmp0_; + GList* c_collection; + GList* c_it; + GIOStream* _tmp1_; + GIOStream* c; + GIOStream* _tmp2_; + GOutputStream* _tmp3_; + GOutputStream* _tmp4_; + guint8* _tmp5_; + gint _tmp5__length1; + GError* e; + GError* _tmp6_; + const gchar* _tmp7_; + GError * _inner_error_; +}; + +struct _SpiceCtrlMenu { + GObject parent_instance; + SpiceCtrlMenuPrivate * priv; + GList* items; +}; + +struct _SpiceCtrlMenuClass { + GObjectClass parent_class; +}; + +struct _SpiceCtrlForeignMenuHandleClientData { + int _state_; + GObject* _source_object_; + GAsyncResult* _res_; + GSimpleAsyncResult* _async_result; + SpiceCtrlForeignMenu* self; + GIOStream* c; + FrgMenuInitHeader header; + guint8* p; + gint p_length1; + gint _p_size_; + GIOStream* _tmp0_; + GInputStream* _tmp1_; + GInputStream* _tmp2_; + guint8* _tmp3_; + gint _tmp3__length1; + gssize _tmp4_; + gssize read; + gssize _tmp5_; + gboolean _tmp6_; + FrgMenuInitHeader _tmp7_; + guint32 _tmp8_; + gboolean _tmp9_; + FrgMenuInitHeader _tmp10_; + guint32 _tmp11_; + gboolean _tmp12_; + FrgMenuInitHeader _tmp13_; + guint32 _tmp14_; + gboolean _tmp15_; + guint64 credentials; + GIOStream* _tmp16_; + GInputStream* _tmp17_; + GInputStream* _tmp18_; + guint8* _tmp19_; + gint _tmp19__length1; + gssize _tmp20_; + gssize _tmp21_; + gssize _tmp22_; + gboolean _tmp23_; + guint64 _tmp24_; + gboolean _tmp25_; + FrgMenuInitHeader _tmp26_; + guint32 _tmp27_; + gulong title_size; + gulong _tmp28_; + guint8* _tmp29_; + guint8* title; + gint title_length1; + gint _title_size_; + GIOStream* _tmp30_; + GInputStream* _tmp31_; + GInputStream* _tmp32_; + guint8* _tmp33_; + gint _tmp33__length1; + gulong _tmp34_; + gssize _tmp35_; + gssize _tmp36_; + guint8* _tmp37_; + gint _tmp37__length1; + guint8* _tmp38_; + guint8* t; + gint t_length1; + gint _t_size_; + gboolean _tmp39_; + gboolean _tmp40_; + GIOStream* _tmp41_; + GInputStream* _tmp42_; + GInputStream* _tmp43_; + guint8* _tmp44_; + gint _tmp44__length1; + gssize _tmp45_; + gssize _tmp46_; + gssize _tmp47_; + gssize _tmp48_; + gboolean _tmp49_; + gssize _tmp50_; + gchar* _tmp51_; + gchar* _tmp52_; + gchar* _tmp53_; + gchar* _tmp54_; + guint8* _tmp55_; + gint _tmp55__length1; + FrgMenuMsg* msg; + FrgMenuMsg* _tmp56_; + guint32 _tmp57_; + gboolean _tmp58_; + FrgMenuMsg* _tmp59_; + guint32 _tmp60_; + FrgMenuMsg* _tmp61_; + guint32 _tmp62_; + gint _tmp63_; + guint8* _tmp64_; + gint _tmp64__length1; + GIOStream* _tmp65_; + GInputStream* _tmp66_; + GInputStream* _tmp67_; + guint8* _tmp68_; + gint _tmp68__length1; + FrgMenuMsg* _tmp69_; + guint32 _tmp70_; + gssize _tmp71_; + gssize _tmp72_; + gssize _tmp73_; + gssize _tmp74_; + FrgMenuMsg* _tmp75_; + guint32 _tmp76_; + gboolean _tmp77_; + FrgMenuMsg* _tmp78_; + GError * _inner_error_; +}; + +typedef enum { + SPICE_CTRL_ERROR_VALUE +} SpiceCtrlError; +#define SPICE_CTRL_ERROR spice_ctrl_error_quark () +struct _SpiceCtrlForeignMenuListenData { + int _state_; + GObject* _source_object_; + GAsyncResult* _res_; + GSimpleAsyncResult* _async_result; + SpiceCtrlForeignMenu* self; + gchar* addr; + const gchar* _tmp0_; + GObject* _tmp1_; + GObject* listener; + gboolean _tmp2_; + gboolean _tmp3_; + GObject* _tmp4_; + GIOStream* _tmp5_; + GIOStream* _tmp6_; + GIOStream* c; + gint _tmp7_; + GIOStream* _tmp8_; + GIOStream* _tmp9_; + GIOStream* _tmp10_; + GError* e; + GError* _tmp11_; + const gchar* _tmp12_; + GIOStream* _tmp13_; + GIOStream* _tmp14_; + gint _tmp15_; + GError * _inner_error_; +}; + + +static gpointer spice_ctrl_foreign_menu_parent_class = NULL; + +GType spice_ctrl_foreign_menu_get_type (void) G_GNUC_CONST; +GType spice_ctrl_menu_get_type (void) G_GNUC_CONST; +#define SPICE_CTRL_FOREIGN_MENU_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SPICE_CTRL_TYPE_FOREIGN_MENU, SpiceCtrlForeignMenuPrivate)) +enum { + SPICE_CTRL_FOREIGN_MENU_DUMMY_PROPERTY, + SPICE_CTRL_FOREIGN_MENU_MENU, + SPICE_CTRL_FOREIGN_MENU_TITLE +}; +static void _g_object_unref0_ (gpointer var); +static void _g_list_free__g_object_unref0_ (GList* self); +SpiceCtrlForeignMenu* spice_ctrl_foreign_menu_new (void); +SpiceCtrlForeignMenu* spice_ctrl_foreign_menu_construct (GType object_type); +SpiceCtrlMenu* spice_ctrl_menu_new (void); +SpiceCtrlMenu* spice_ctrl_menu_construct (GType object_type); +static void spice_ctrl_foreign_menu_set_menu (SpiceCtrlForeignMenu* self, SpiceCtrlMenu* value); +void spice_ctrl_foreign_menu_menu_item_click_msg (SpiceCtrlForeignMenu* self, gint32 item_id); +void spice_ctrl_foreign_menu_send_msg (SpiceCtrlForeignMenu* self, guint8* p, int p_length1, GAsyncReadyCallback _callback_, gpointer _user_data_); +gboolean spice_ctrl_foreign_menu_send_msg_finish (SpiceCtrlForeignMenu* self, GAsyncResult* _res_, GError** error); +void spice_ctrl_foreign_menu_menu_item_checked_msg (SpiceCtrlForeignMenu* self, gint32 item_id, gboolean checked); +void spice_ctrl_foreign_menu_app_activated_msg (SpiceCtrlForeignMenu* self, gboolean activated); +static void spice_ctrl_foreign_menu_send_msg_data_free (gpointer _data); +static gboolean spice_ctrl_foreign_menu_send_msg_co (SpiceCtrlForeignMenuSendMsgData* _data_); +static void spice_ctrl_foreign_menu_send_msg_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); +static unsigned int spice_ctrl_foreign_menu_get_menu_flags (SpiceCtrlForeignMenu* self, guint32 type); +static gboolean spice_ctrl_foreign_menu_handle_message (SpiceCtrlForeignMenu* self, FrgMenuMsg* msg); +static void spice_ctrl_foreign_menu_set_title (SpiceCtrlForeignMenu* self, const gchar* value); +SpiceCtrlMenu* spice_ctrl_foreign_menu_get_menu (SpiceCtrlForeignMenu* self); +GType spice_ctrl_menu_item_get_type (void) G_GNUC_CONST; +SpiceCtrlMenuItem* spice_ctrl_menu_item_new (gint id, const gchar* text, unsigned int flags); +SpiceCtrlMenuItem* spice_ctrl_menu_item_construct (GType object_type, gint id, const gchar* text, unsigned int flags); +static void spice_ctrl_foreign_menu_handle_client_data_free (gpointer _data); +static void spice_ctrl_foreign_menu_handle_client (SpiceCtrlForeignMenu* self, GIOStream* c, GAsyncReadyCallback _callback_, gpointer _user_data_); +static void spice_ctrl_foreign_menu_handle_client_finish (SpiceCtrlForeignMenu* self, GAsyncResult* _res_, GError** error); +static gboolean spice_ctrl_foreign_menu_handle_client_co (SpiceCtrlForeignMenuHandleClientData* _data_); +static void spice_ctrl_foreign_menu_handle_client_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); +static void spice_ctrl_foreign_menu_listen_data_free (gpointer _data); +GQuark spice_ctrl_error_quark (void); +void spice_ctrl_foreign_menu_listen (SpiceCtrlForeignMenu* self, const gchar* addr, GAsyncReadyCallback _callback_, gpointer _user_data_); +void spice_ctrl_foreign_menu_listen_finish (SpiceCtrlForeignMenu* self, GAsyncResult* _res_, GError** error); +static gboolean spice_ctrl_foreign_menu_listen_co (SpiceCtrlForeignMenuListenData* _data_); +static void spice_ctrl_foreign_menu_listen_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); +const gchar* spice_ctrl_foreign_menu_get_title (SpiceCtrlForeignMenu* self); +static void spice_ctrl_foreign_menu_finalize (GObject* obj); +static void _vala_spice_ctrl_foreign_menu_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_spice_ctrl_foreign_menu_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +static void _g_object_unref0_ (gpointer var) { +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + (var == NULL) ? NULL : (var = (g_object_unref (var), NULL)); +#line 315 "foreign-menu.c" +} + + +static void _g_list_free__g_object_unref0_ (GList* self) { +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_list_foreach (self, (GFunc) _g_object_unref0_, NULL); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_list_free (self); +#line 324 "foreign-menu.c" +} + + +SpiceCtrlForeignMenu* spice_ctrl_foreign_menu_construct (GType object_type) { + SpiceCtrlForeignMenu * self = NULL; + SpiceCtrlMenu* _tmp0_; + SpiceCtrlMenu* _tmp1_; +#line 30 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + self = (SpiceCtrlForeignMenu*) g_object_new (object_type, NULL); +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = spice_ctrl_menu_new (); +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp1_ = _tmp0_; +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_set_menu (self, _tmp1_); +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_tmp1_); +#line 30 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return self; +#line 344 "foreign-menu.c" +} + + +SpiceCtrlForeignMenu* spice_ctrl_foreign_menu_new (void) { +#line 30 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return spice_ctrl_foreign_menu_construct (SPICE_CTRL_TYPE_FOREIGN_MENU); +#line 351 "foreign-menu.c" +} + + +void spice_ctrl_foreign_menu_menu_item_click_msg (SpiceCtrlForeignMenu* self, gint32 item_id) { + gint32 _tmp0_; + gchar* _tmp1_ = NULL; + gchar* _tmp2_; + FrgMenuEvent msg = {0}; + gint32 _tmp3_; + FrgMenuEvent _tmp4_; + FrgMenuMsg _tmp5_; + guint32 _tmp6_; + guint8* p; + gint p_length1; + gint _p_size_; +#line 34 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_return_if_fail (self != NULL); +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = item_id; +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp1_ = g_strdup_printf ("clicked id: %d", (gint) _tmp0_); +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp2_ = _tmp1_; +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_debug ("foreign-menu.vala:35: %s", _tmp2_); +#line 35 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_free0 (_tmp2_); +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + memset (&msg, 0, sizeof (FrgMenuEvent)); +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + msg.base.size = (guint32) sizeof (FrgMenuEvent); +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + msg.base.id = (guint32) FOREIGN_MENU_ITEM_EVENT; +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp3_ = item_id; +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + msg.id = (guint32) _tmp3_; +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + msg.action = (guint32) FOREIGN_MENU_EVENT_CLICK; +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp4_ = msg; +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp5_ = _tmp4_.base; +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp6_ = _tmp5_.size; +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + p = ((guint8*) (&msg)) + 0; +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + p_length1 = _tmp6_ - 0; +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _p_size_ = p_length1; +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_send_msg (self, p, p_length1, NULL, NULL); +#line 405 "foreign-menu.c" +} + + +void spice_ctrl_foreign_menu_menu_item_checked_msg (SpiceCtrlForeignMenu* self, gint32 item_id, gboolean checked) { + const gchar* _tmp0_ = NULL; + gboolean _tmp1_; + const gchar* _tmp2_; + gint32 _tmp3_; + gchar* _tmp4_ = NULL; + gchar* _tmp5_; + FrgMenuEvent msg = {0}; + gint32 _tmp6_; + int _tmp7_ = 0; + gboolean _tmp8_; + int _tmp9_; + FrgMenuEvent _tmp10_; + FrgMenuMsg _tmp11_; + guint32 _tmp12_; + guint8* p; + gint p_length1; + gint _p_size_; +#line 47 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_return_if_fail (self != NULL); +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp1_ = checked; +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_tmp1_) { +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = ""; +#line 435 "foreign-menu.c" + } else { +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = "un"; +#line 439 "foreign-menu.c" + } +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp2_ = _tmp0_; +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp3_ = item_id; +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp4_ = g_strdup_printf ("%schecked id: %d", _tmp2_, (gint) _tmp3_); +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp5_ = _tmp4_; +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_debug ("foreign-menu.vala:48: %s", _tmp5_); +#line 48 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_free0 (_tmp5_); +#line 50 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + memset (&msg, 0, sizeof (FrgMenuEvent)); +#line 51 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + msg.base.size = (guint32) sizeof (FrgMenuEvent); +#line 52 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + msg.base.id = (guint32) FOREIGN_MENU_ITEM_EVENT; +#line 53 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp6_ = item_id; +#line 53 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + msg.id = (guint32) _tmp6_; +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp8_ = checked; +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_tmp8_) { +#line 55 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp7_ = FOREIGN_MENU_EVENT_CHECKED; +#line 469 "foreign-menu.c" + } else { +#line 56 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp7_ = FOREIGN_MENU_EVENT_UNCHECKED; +#line 473 "foreign-menu.c" + } +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp9_ = _tmp7_; +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + msg.action = (guint32) _tmp9_; +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp10_ = msg; +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp11_ = _tmp10_.base; +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp12_ = _tmp11_.size; +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + p = ((guint8*) (&msg)) + 0; +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + p_length1 = _tmp12_ - 0; +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _p_size_ = p_length1; +#line 59 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_send_msg (self, p, p_length1, NULL, NULL); +#line 493 "foreign-menu.c" +} + + +void spice_ctrl_foreign_menu_app_activated_msg (SpiceCtrlForeignMenu* self, gboolean activated) { + FrgMenuMsg msg = {0}; + int _tmp0_ = 0; + gboolean _tmp1_; + int _tmp2_; + FrgMenuMsg _tmp3_; + guint32 _tmp4_; + guint8* p; + gint p_length1; + gint _p_size_; +#line 62 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_return_if_fail (self != NULL); +#line 63 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + memset (&msg, 0, sizeof (FrgMenuMsg)); +#line 64 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + msg.size = (guint32) sizeof (FrgMenuEvent); +#line 65 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp1_ = activated; +#line 65 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_tmp1_) { +#line 66 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = FOREIGN_MENU_APP_ACTIVATED; +#line 519 "foreign-menu.c" + } else { +#line 67 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = FOREIGN_MENU_APP_DEACTIVATED; +#line 523 "foreign-menu.c" + } +#line 65 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp2_ = _tmp0_; +#line 65 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + msg.id = (guint32) _tmp2_; +#line 69 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp3_ = msg; +#line 69 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp4_ = _tmp3_.size; +#line 69 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + p = ((guint8*) (&msg)) + 0; +#line 69 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + p_length1 = _tmp4_ - 0; +#line 69 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _p_size_ = p_length1; +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_send_msg (self, p, p_length1, NULL, NULL); +#line 541 "foreign-menu.c" +} + + +static void spice_ctrl_foreign_menu_send_msg_data_free (gpointer _data) { + SpiceCtrlForeignMenuSendMsgData* _data_; + _data_ = _data; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_data_->self); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_slice_free (SpiceCtrlForeignMenuSendMsgData, _data_); +#line 552 "foreign-menu.c" +} + + +static gpointer _g_object_ref0 (gpointer self) { +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return self ? g_object_ref (self) : NULL; +#line 559 "foreign-menu.c" +} + + +void spice_ctrl_foreign_menu_send_msg (SpiceCtrlForeignMenu* self, guint8* p, int p_length1, GAsyncReadyCallback _callback_, gpointer _user_data_) { + SpiceCtrlForeignMenuSendMsgData* _data_; + SpiceCtrlForeignMenu* _tmp0_; + guint8* _tmp1_; + gint _tmp1__length1; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_ = g_slice_new0 (SpiceCtrlForeignMenuSendMsgData); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, spice_ctrl_foreign_menu_send_msg); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, spice_ctrl_foreign_menu_send_msg_data_free); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = _g_object_ref0 (self); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->self = _tmp0_; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp1_ = p; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp1__length1 = p_length1; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->p = _tmp1_; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->p_length1 = _tmp1__length1; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_send_msg_co (_data_); +#line 588 "foreign-menu.c" +} + + +gboolean spice_ctrl_foreign_menu_send_msg_finish (SpiceCtrlForeignMenu* self, GAsyncResult* _res_, GError** error) { + gboolean result; + SpiceCtrlForeignMenuSendMsgData* _data_; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) { +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 599 "foreign-menu.c" + } +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + result = _data_->result; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return result; +#line 607 "foreign-menu.c" +} + + +static void spice_ctrl_foreign_menu_send_msg_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { + SpiceCtrlForeignMenuSendMsgData* _data_; +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_ = _user_data_; +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_source_object_ = source_object; +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_res_ = _res_; +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_send_msg_co (_data_); +#line 621 "foreign-menu.c" +} + + +static gboolean spice_ctrl_foreign_menu_send_msg_co (SpiceCtrlForeignMenuSendMsgData* _data_) { +#line 73 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + switch (_data_->_state_) { +#line 73 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case 0: +#line 630 "foreign-menu.c" + goto _state_0; +#line 73 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case 1: +#line 634 "foreign-menu.c" + goto _state_1; + default: +#line 73 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_assert_not_reached (); +#line 639 "foreign-menu.c" + } + _state_0: + { +#line 79 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp0_ = _data_->self->priv->clients; +#line 645 "foreign-menu.c" + { +#line 79 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->c_collection = _data_->_tmp0_; +#line 79 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + for (_data_->c_it = _data_->c_collection; _data_->c_it != NULL; _data_->c_it = _data_->c_it->next) { +#line 79 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp1_ = _g_object_ref0 ((GIOStream*) _data_->c_it->data); +#line 79 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->c = _data_->_tmp1_; +#line 655 "foreign-menu.c" + { +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp2_ = _data_->c; +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp3_ = g_io_stream_get_output_stream (_data_->_tmp2_); +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp4_ = _data_->_tmp3_; +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp5_ = _data_->p; +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp5__length1 = _data_->p_length1; +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_state_ = 1; +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_output_stream_write_async (_data_->_tmp4_, _data_->_tmp5_, (gsize) _data_->_tmp5__length1, G_PRIORITY_DEFAULT, NULL, spice_ctrl_foreign_menu_send_msg_ready, _data_); +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 673 "foreign-menu.c" + _state_1: +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_output_stream_write_finish (_data_->_tmp4_, _data_->_res_, &_data_->_inner_error_); +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_inner_error_ != NULL) { +#line 80 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_data_->c); +#line 681 "foreign-menu.c" + goto __catch3_g_error; + } +#line 79 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_data_->c); +#line 686 "foreign-menu.c" + } + } + } + } + goto __finally3; + __catch3_g_error: + { +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->e = _data_->_inner_error_; +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_inner_error_ = NULL; +#line 82 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp6_ = _data_->e; +#line 82 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp7_ = _data_->_tmp6_->message; +#line 82 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_warning ("foreign-menu.vala:82: %s", _data_->_tmp7_); +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_error_free0 (_data_->e); +#line 706 "foreign-menu.c" + } + __finally3: +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_inner_error_ != NULL) { +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_error_free (_data_->_inner_error_); +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 719 "foreign-menu.c" + } else { +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 723 "foreign-menu.c" + } +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 729 "foreign-menu.c" + } +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->result = TRUE; +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 737 "foreign-menu.c" + } else { +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 741 "foreign-menu.c" + } +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 73 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 73 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 751 "foreign-menu.c" + } else { +#line 73 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 755 "foreign-menu.c" + } +#line 73 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 73 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 761 "foreign-menu.c" +} + + +static unsigned int spice_ctrl_foreign_menu_get_menu_flags (SpiceCtrlForeignMenu* self, guint32 type) { + unsigned int result = 0; + unsigned int flags; + guint32 _tmp0_; + guint32 _tmp2_; +#line 88 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_return_val_if_fail (self != NULL, 0); +#line 89 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + flags = 0; +#line 91 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = type; +#line 91 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if ((FOREIGN_MENU_ITEM_TYPE_CHECKED & _tmp0_) != 0) { +#line 778 "foreign-menu.c" + unsigned int _tmp1_; +#line 92 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp1_ = flags; +#line 92 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + flags = _tmp1_ | CONTROLLER_MENU_FLAGS_CHECKED; +#line 784 "foreign-menu.c" + } +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp2_ = type; +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if ((FOREIGN_MENU_ITEM_TYPE_DIM & _tmp2_) != 0) { +#line 790 "foreign-menu.c" + unsigned int _tmp3_; +#line 94 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp3_ = flags; +#line 94 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + flags = _tmp3_ | CONTROLLER_MENU_FLAGS_GRAYED; +#line 796 "foreign-menu.c" + } +#line 96 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + result = flags; +#line 96 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return result; +#line 802 "foreign-menu.c" +} + + +static gboolean spice_ctrl_foreign_menu_handle_message (SpiceCtrlForeignMenu* self, FrgMenuMsg* msg) { + gboolean result = FALSE; + FrgMenuMsg* _tmp0_; + guint32 _tmp1_; +#line 99 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 100 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = msg; +#line 100 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp1_ = (*_tmp0_).id; +#line 100 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + switch (_tmp1_) { +#line 100 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case FOREIGN_MENU_SET_TITLE: +#line 820 "foreign-menu.c" + { + FrgMenuMsg* _tmp2_; + FrgMenuSetTitle* t; + FrgMenuSetTitle* _tmp3_; + const gchar* _tmp4_; +#line 102 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp2_ = msg; +#line 102 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + t = (FrgMenuSetTitle*) _tmp2_; +#line 103 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp3_ = t; +#line 103 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp4_ = (*_tmp3_).string; +#line 103 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_set_title (self, _tmp4_); +#line 104 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 838 "foreign-menu.c" + } +#line 100 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case FOREIGN_MENU_ADD_ITEM: +#line 842 "foreign-menu.c" + { + FrgMenuMsg* _tmp5_; + FrgMenuAddItem* i; + FrgMenuAddItem* _tmp6_; + guint32 _tmp7_; + FrgMenuAddItem* _tmp8_; + guint32 _tmp9_; + FrgMenuAddItem* _tmp10_; + guint32 _tmp11_; + FrgMenuAddItem* _tmp12_; + const gchar* _tmp13_; + SpiceCtrlMenu* _tmp14_; + FrgMenuAddItem* _tmp15_; + guint32 _tmp16_; + FrgMenuAddItem* _tmp17_; + const gchar* _tmp18_; + FrgMenuAddItem* _tmp19_; + guint32 _tmp20_; + unsigned int _tmp21_ = 0; + SpiceCtrlMenuItem* _tmp22_; +#line 106 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp5_ = msg; +#line 106 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + i = (FrgMenuAddItem*) _tmp5_; +#line 107 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp6_ = i; +#line 107 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp7_ = (*_tmp6_).id; +#line 107 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp8_ = i; +#line 107 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp9_ = (*_tmp8_).type; +#line 107 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp10_ = i; +#line 107 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp11_ = (*_tmp10_).position; +#line 107 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp12_ = i; +#line 107 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp13_ = (*_tmp12_).string; +#line 107 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_debug ("foreign-menu.vala:107: add id:%u type:%u position:%u title:%s", (guint) _tmp7_, (guint) _tmp9_, (guint) _tmp11_, _tmp13_); +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp14_ = self->priv->_menu; +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp15_ = i; +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp16_ = (*_tmp15_).id; +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp17_ = i; +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp18_ = (*_tmp17_).string; +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp19_ = i; +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp20_ = (*_tmp19_).type; +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp21_ = spice_ctrl_foreign_menu_get_menu_flags (self, _tmp20_); +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp22_ = spice_ctrl_menu_item_new ((gint) _tmp16_, _tmp18_, _tmp21_); +#line 108 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp14_->items = g_list_append (_tmp14_->items, _tmp22_); +#line 109 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_notify ((GObject*) self, "menu"); +#line 110 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 909 "foreign-menu.c" + } +#line 100 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case FOREIGN_MENU_MODIFY_ITEM: +#line 913 "foreign-menu.c" + { +#line 112 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_debug ("foreign-menu.vala:112: deprecated: modify item"); +#line 113 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 919 "foreign-menu.c" + } +#line 100 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case FOREIGN_MENU_REMOVE_ITEM: +#line 923 "foreign-menu.c" + { + FrgMenuMsg* _tmp23_; + FrgMenuRmItem* i; + FrgMenuRmItem* _tmp24_; + guint32 _tmp25_; + gchar* _tmp26_ = NULL; + gchar* _tmp27_; +#line 115 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp23_ = msg; +#line 115 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + i = (FrgMenuRmItem*) _tmp23_; +#line 116 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp24_ = i; +#line 116 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp25_ = (*_tmp24_).id; +#line 116 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp26_ = g_strdup_printf ("not implemented: remove id:%u", (guint) _tmp25_); +#line 116 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp27_ = _tmp26_; +#line 116 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_debug ("foreign-menu.vala:116: %s", _tmp27_); +#line 116 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_free0 (_tmp27_); +#line 117 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 949 "foreign-menu.c" + } +#line 100 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case FOREIGN_MENU_CLEAR: +#line 953 "foreign-menu.c" + { + SpiceCtrlMenu* _tmp28_; + SpiceCtrlMenu* _tmp29_; +#line 119 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp28_ = spice_ctrl_menu_new (); +#line 119 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp29_ = _tmp28_; +#line 119 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_set_menu (self, _tmp29_); +#line 119 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_tmp29_); +#line 120 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 967 "foreign-menu.c" + } + default: + { +#line 122 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_warn_if_reached (); +#line 123 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + result = FALSE; +#line 123 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return result; +#line 977 "foreign-menu.c" + } + } +#line 125 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + result = TRUE; +#line 125 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return result; +#line 984 "foreign-menu.c" +} + + +static void spice_ctrl_foreign_menu_handle_client_data_free (gpointer _data) { + SpiceCtrlForeignMenuHandleClientData* _data_; + _data_ = _data; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_data_->c); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_data_->self); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_slice_free (SpiceCtrlForeignMenuHandleClientData, _data_); +#line 997 "foreign-menu.c" +} + + +static void spice_ctrl_foreign_menu_handle_client (SpiceCtrlForeignMenu* self, GIOStream* c, GAsyncReadyCallback _callback_, gpointer _user_data_) { + SpiceCtrlForeignMenuHandleClientData* _data_; + SpiceCtrlForeignMenu* _tmp0_; + GIOStream* _tmp1_; + GIOStream* _tmp2_; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_ = g_slice_new0 (SpiceCtrlForeignMenuHandleClientData); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, spice_ctrl_foreign_menu_handle_client); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, spice_ctrl_foreign_menu_handle_client_data_free); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = _g_object_ref0 (self); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->self = _tmp0_; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp1_ = c; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp2_ = _g_object_ref0 (_tmp1_); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->c = _tmp2_; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_handle_client_co (_data_); +#line 1024 "foreign-menu.c" +} + + +static void spice_ctrl_foreign_menu_handle_client_finish (SpiceCtrlForeignMenu* self, GAsyncResult* _res_, GError** error) { + SpiceCtrlForeignMenuHandleClientData* _data_; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) { +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return; +#line 1034 "foreign-menu.c" + } +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); +#line 1038 "foreign-menu.c" +} + + +static void spice_ctrl_foreign_menu_handle_client_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { + SpiceCtrlForeignMenuHandleClientData* _data_; +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_ = _user_data_; +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_source_object_ = source_object; +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_res_ = _res_; +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_handle_client_co (_data_); +#line 1052 "foreign-menu.c" +} + + +static gboolean spice_ctrl_foreign_menu_handle_client_co (SpiceCtrlForeignMenuHandleClientData* _data_) { +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + switch (_data_->_state_) { +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case 0: +#line 1061 "foreign-menu.c" + goto _state_0; +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case 1: +#line 1065 "foreign-menu.c" + goto _state_1; +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case 2: +#line 1069 "foreign-menu.c" + goto _state_2; +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case 3: +#line 1073 "foreign-menu.c" + goto _state_3; +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case 4: +#line 1077 "foreign-menu.c" + goto _state_4; +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case 5: +#line 1081 "foreign-menu.c" + goto _state_5; + default: +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_assert_not_reached (); +#line 1086 "foreign-menu.c" + } + _state_0: +#line 129 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + memset (&_data_->header, 0, sizeof (FrgMenuInitHeader)); +#line 130 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->p = NULL; +#line 130 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->p_length1 = 0; +#line 130 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_p_size_ = _data_->p_length1; +#line 132 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_debug ("foreign-menu.vala:132: new socket client, reading init header"); +#line 134 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->p = ((guint8*) (&_data_->header)) + 0; +#line 134 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->p_length1 = sizeof (FrgMenuInitHeader) - 0; +#line 134 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_p_size_ = _data_->p_length1; +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp0_ = _data_->c; +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp1_ = g_io_stream_get_input_stream (_data_->_tmp0_); +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp2_ = _data_->_tmp1_; +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp3_ = _data_->p; +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp3__length1 = _data_->p_length1; +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_state_ = 1; +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_input_stream_read_async (_data_->_tmp2_, _data_->_tmp3_, (gsize) _data_->_tmp3__length1, G_PRIORITY_DEFAULT, NULL, spice_ctrl_foreign_menu_handle_client_ready, _data_); +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1121 "foreign-menu.c" + _state_1: +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp4_ = 0L; +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp4_ = g_input_stream_read_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error_); +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->read = _data_->_tmp4_; +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_inner_error_ != NULL) { +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_error_free (_data_->_inner_error_); +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1139 "foreign-menu.c" + } else { +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1143 "foreign-menu.c" + } +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 135 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1149 "foreign-menu.c" + } +#line 136 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp5_ = _data_->read; +#line 136 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp6_ = FALSE; +#line 136 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp6_ = g_warn_if (((gulong) _data_->_tmp5_) != sizeof (FrgMenuInitHeader)); +#line 136 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_tmp6_) { +#line 137 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 137 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1163 "foreign-menu.c" + } else { +#line 137 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1167 "foreign-menu.c" + } +#line 137 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 137 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1173 "foreign-menu.c" + } +#line 138 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp7_ = _data_->header; +#line 138 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp8_ = _data_->_tmp7_.magic; +#line 138 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp9_ = FALSE; +#line 138 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp9_ = g_warn_if (_data_->_tmp8_ != FOREIGN_MENU_MAGIC); +#line 138 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_tmp9_) { +#line 139 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 139 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1189 "foreign-menu.c" + } else { +#line 139 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1193 "foreign-menu.c" + } +#line 139 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 139 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1199 "foreign-menu.c" + } +#line 140 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp10_ = _data_->header; +#line 140 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp11_ = _data_->_tmp10_.version; +#line 140 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp12_ = FALSE; +#line 140 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp12_ = g_warn_if (_data_->_tmp11_ != ((guint32) FOREIGN_MENU_VERSION)); +#line 140 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_tmp12_) { +#line 141 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 141 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1215 "foreign-menu.c" + } else { +#line 141 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1219 "foreign-menu.c" + } +#line 141 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 141 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1225 "foreign-menu.c" + } +#line 142 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp13_ = _data_->header; +#line 142 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp14_ = _data_->_tmp13_.size; +#line 142 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp15_ = FALSE; +#line 142 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp15_ = g_warn_if (((gulong) _data_->_tmp14_) < sizeof (FrgMenuInit)); +#line 142 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_tmp15_) { +#line 143 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 143 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1241 "foreign-menu.c" + } else { +#line 143 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1245 "foreign-menu.c" + } +#line 143 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 143 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1251 "foreign-menu.c" + } +#line 145 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->credentials = (guint64) 0; +#line 146 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->p = ((guint8*) (&_data_->credentials)) + 0; +#line 146 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->p_length1 = sizeof (guint64) - 0; +#line 146 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_p_size_ = _data_->p_length1; +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp16_ = _data_->c; +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp17_ = g_io_stream_get_input_stream (_data_->_tmp16_); +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp18_ = _data_->_tmp17_; +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp19_ = _data_->p; +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp19__length1 = _data_->p_length1; +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_state_ = 2; +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_input_stream_read_async (_data_->_tmp18_, _data_->_tmp19_, (gsize) _data_->_tmp19__length1, G_PRIORITY_DEFAULT, NULL, spice_ctrl_foreign_menu_handle_client_ready, _data_); +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1277 "foreign-menu.c" + _state_2: +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp20_ = 0L; +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp20_ = g_input_stream_read_finish (_data_->_tmp18_, _data_->_res_, &_data_->_inner_error_); +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp21_ = _data_->_tmp20_; +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_inner_error_ != NULL) { +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_error_free (_data_->_inner_error_); +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1295 "foreign-menu.c" + } else { +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1299 "foreign-menu.c" + } +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1305 "foreign-menu.c" + } +#line 147 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->read = _data_->_tmp21_; +#line 148 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp22_ = _data_->read; +#line 148 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp23_ = FALSE; +#line 148 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp23_ = g_warn_if (((gulong) _data_->_tmp22_) != sizeof (guint64)); +#line 148 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_tmp23_) { +#line 149 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 149 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1321 "foreign-menu.c" + } else { +#line 149 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1325 "foreign-menu.c" + } +#line 149 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 149 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1331 "foreign-menu.c" + } +#line 150 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp24_ = _data_->credentials; +#line 150 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp25_ = FALSE; +#line 150 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp25_ = g_warn_if (_data_->_tmp24_ != ((guint64) 0)); +#line 150 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_tmp25_) { +#line 151 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 151 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1345 "foreign-menu.c" + } else { +#line 151 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1349 "foreign-menu.c" + } +#line 151 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 151 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1355 "foreign-menu.c" + } +#line 153 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp26_ = _data_->header; +#line 153 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp27_ = _data_->_tmp26_.size; +#line 153 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->title_size = _data_->_tmp27_ - sizeof (FrgMenuInit); +#line 154 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp28_ = _data_->title_size; +#line 154 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp29_ = NULL; +#line 154 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp29_ = g_new0 (guint8, _data_->_tmp28_ + 1); +#line 154 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->title = _data_->_tmp29_; +#line 154 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->title_length1 = _data_->_tmp28_ + 1; +#line 154 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_title_size_ = _data_->title_length1; +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp30_ = _data_->c; +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp31_ = g_io_stream_get_input_stream (_data_->_tmp30_); +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp32_ = _data_->_tmp31_; +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp33_ = _data_->title; +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp33__length1 = _data_->title_length1; +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp34_ = _data_->title_size; +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_state_ = 3; +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_input_stream_read_async (_data_->_tmp32_, _data_->_tmp33_ + 0, (gsize) (_data_->_tmp34_ - 0), G_PRIORITY_DEFAULT, NULL, spice_ctrl_foreign_menu_handle_client_ready, _data_); +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1393 "foreign-menu.c" + _state_3: +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp35_ = 0L; +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp35_ = g_input_stream_read_finish (_data_->_tmp32_, _data_->_res_, &_data_->_inner_error_); +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp36_ = _data_->_tmp35_; +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_inner_error_ != NULL) { +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_error_free (_data_->_inner_error_); +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->title = (g_free (_data_->title), NULL); +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1413 "foreign-menu.c" + } else { +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1417 "foreign-menu.c" + } +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1423 "foreign-menu.c" + } +#line 155 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->read = _data_->_tmp36_; +#line 156 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp37_ = _data_->title; +#line 156 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp37__length1 = _data_->title_length1; +#line 156 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_set_title (_data_->self, (const gchar*) _data_->_tmp37_); +#line 158 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_signal_emit_by_name (_data_->self, "client-connected"); +#line 160 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp38_ = NULL; +#line 160 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp38_ = g_new0 (guint8, sizeof (FrgMenuMsg)); +#line 160 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->t = _data_->_tmp38_; +#line 160 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->t_length1 = sizeof (FrgMenuMsg); +#line 160 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_t_size_ = _data_->t_length1; +#line 1445 "foreign-menu.c" + { +#line 161 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp39_ = TRUE; +#line 161 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + while (TRUE) { +#line 161 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp40_ = _data_->_tmp39_; +#line 161 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (!_data_->_tmp40_) { +#line 1455 "foreign-menu.c" + } +#line 161 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp39_ = FALSE; +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp41_ = _data_->c; +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp42_ = g_io_stream_get_input_stream (_data_->_tmp41_); +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp43_ = _data_->_tmp42_; +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp44_ = _data_->t; +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp44__length1 = _data_->t_length1; +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_state_ = 4; +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_input_stream_read_async (_data_->_tmp43_, _data_->_tmp44_ + 0, (gsize) (sizeof (FrgMenuMsg) - 0), G_PRIORITY_DEFAULT, NULL, spice_ctrl_foreign_menu_handle_client_ready, _data_); +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1475 "foreign-menu.c" + _state_4: +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp45_ = 0L; +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp45_ = g_input_stream_read_finish (_data_->_tmp43_, _data_->_res_, &_data_->_inner_error_); +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp46_ = _data_->_tmp45_; +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_inner_error_ != NULL) { +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_error_free (_data_->_inner_error_); +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->t = (g_free (_data_->t), NULL); +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->title = (g_free (_data_->title), NULL); +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1497 "foreign-menu.c" + } else { +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1501 "foreign-menu.c" + } +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1507 "foreign-menu.c" + } +#line 162 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->read = _data_->_tmp46_; +#line 163 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp47_ = _data_->read; +#line 163 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_tmp47_ == ((gssize) 0)) { +#line 164 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 1517 "foreign-menu.c" + } +#line 166 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp48_ = _data_->read; +#line 166 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp49_ = FALSE; +#line 166 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp49_ = g_warn_if (((gulong) _data_->_tmp48_) != sizeof (FrgMenuMsg)); +#line 166 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_tmp49_) { +#line 167 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp50_ = _data_->read; +#line 167 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp51_ = NULL; +#line 167 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp51_ = g_strdup_printf ("%" G_GSSIZE_FORMAT, _data_->_tmp50_); +#line 167 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp52_ = _data_->_tmp51_; +#line 167 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp53_ = g_strconcat ("read only: ", _data_->_tmp52_, NULL); +#line 167 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp54_ = _data_->_tmp53_; +#line 167 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_warning ("foreign-menu.vala:167: %s", _data_->_tmp54_); +#line 167 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_free0 (_data_->_tmp54_); +#line 167 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_free0 (_data_->_tmp52_); +#line 168 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 1547 "foreign-menu.c" + } +#line 171 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp55_ = _data_->t; +#line 171 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp55__length1 = _data_->t_length1; +#line 171 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->msg = (FrgMenuMsg*) _data_->_tmp55_; +#line 172 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp56_ = _data_->msg; +#line 172 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp57_ = (*_data_->_tmp56_).size; +#line 172 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp58_ = FALSE; +#line 172 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp58_ = g_warn_if (((gulong) _data_->_tmp57_) < sizeof (FrgMenuMsg)); +#line 172 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_tmp58_) { +#line 173 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 1567 "foreign-menu.c" + } +#line 175 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp59_ = _data_->msg; +#line 175 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp60_ = (*_data_->_tmp59_).size; +#line 175 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (((gulong) _data_->_tmp60_) > sizeof (FrgMenuMsg)) { +#line 176 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp61_ = _data_->msg; +#line 176 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp62_ = (*_data_->_tmp61_).size; +#line 176 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp63_ = 0; +#line 176 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp63_ = (gint) _data_->_tmp62_; +#line 176 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->t = g_renew (guint8, _data_->t, (gint) _data_->_tmp62_); +#line 176 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + (_data_->_tmp63_ > _data_->t_length1) ? memset (_data_->t + _data_->t_length1, 0, sizeof (guint8) * (_data_->_tmp63_ - _data_->t_length1)) : NULL; +#line 176 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->t_length1 = _data_->_tmp63_; +#line 176 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_t_size_ = _data_->_tmp63_; +#line 177 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp64_ = _data_->t; +#line 177 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp64__length1 = _data_->t_length1; +#line 177 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->msg = (FrgMenuMsg*) _data_->_tmp64_; +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp65_ = _data_->c; +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp66_ = g_io_stream_get_input_stream (_data_->_tmp65_); +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp67_ = _data_->_tmp66_; +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp68_ = _data_->t; +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp68__length1 = _data_->t_length1; +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp69_ = _data_->msg; +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp70_ = (*_data_->_tmp69_).size; +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_state_ = 5; +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_input_stream_read_async (_data_->_tmp67_, _data_->_tmp68_ + sizeof (FrgMenuMsg), (gsize) (_data_->_tmp70_ - sizeof (FrgMenuMsg)), G_PRIORITY_DEFAULT, NULL, spice_ctrl_foreign_menu_handle_client_ready, _data_); +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1617 "foreign-menu.c" + _state_5: +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp71_ = 0L; +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp71_ = g_input_stream_read_finish (_data_->_tmp67_, _data_->_res_, &_data_->_inner_error_); +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp72_ = _data_->_tmp71_; +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_inner_error_ != NULL) { +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_error_free (_data_->_inner_error_); +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->t = (g_free (_data_->t), NULL); +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->title = (g_free (_data_->title), NULL); +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1639 "foreign-menu.c" + } else { +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1643 "foreign-menu.c" + } +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1649 "foreign-menu.c" + } +#line 178 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->read = _data_->_tmp72_; +#line 179 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp73_ = _data_->read; +#line 179 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_tmp73_ == ((gssize) 0)) { +#line 180 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 1659 "foreign-menu.c" + } +#line 181 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp74_ = _data_->read; +#line 181 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp75_ = _data_->msg; +#line 181 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp76_ = (*_data_->_tmp75_).size; +#line 181 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp77_ = FALSE; +#line 181 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp77_ = g_warn_if (((gulong) _data_->_tmp74_) != (_data_->_tmp76_ - sizeof (FrgMenuMsg))); +#line 181 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_tmp77_) { +#line 182 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 1675 "foreign-menu.c" + } + } +#line 185 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp78_ = _data_->msg; +#line 185 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_handle_message (_data_->self, _data_->_tmp78_); +#line 1682 "foreign-menu.c" + } + } +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->t = (g_free (_data_->t), NULL); +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->title = (g_free (_data_->title), NULL); +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1693 "foreign-menu.c" + } else { +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1697 "foreign-menu.c" + } +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 128 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1703 "foreign-menu.c" +} + + +static void spice_ctrl_foreign_menu_listen_data_free (gpointer _data) { + SpiceCtrlForeignMenuListenData* _data_; + _data_ = _data; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_free0 (_data_->addr); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_data_->self); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_slice_free (SpiceCtrlForeignMenuListenData, _data_); +#line 1716 "foreign-menu.c" +} + + +void spice_ctrl_foreign_menu_listen (SpiceCtrlForeignMenu* self, const gchar* addr, GAsyncReadyCallback _callback_, gpointer _user_data_) { + SpiceCtrlForeignMenuListenData* _data_; + SpiceCtrlForeignMenu* _tmp0_; + const gchar* _tmp1_; + gchar* _tmp2_; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_ = g_slice_new0 (SpiceCtrlForeignMenuListenData); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, spice_ctrl_foreign_menu_listen); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, spice_ctrl_foreign_menu_listen_data_free); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = _g_object_ref0 (self); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->self = _tmp0_; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp1_ = addr; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp2_ = g_strdup (_tmp1_); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->addr = _tmp2_; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_listen_co (_data_); +#line 1743 "foreign-menu.c" +} + + +void spice_ctrl_foreign_menu_listen_finish (SpiceCtrlForeignMenu* self, GAsyncResult* _res_, GError** error) { + SpiceCtrlForeignMenuListenData* _data_; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) { +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return; +#line 1753 "foreign-menu.c" + } +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_)); +#line 1757 "foreign-menu.c" +} + + +static void spice_ctrl_foreign_menu_listen_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { + SpiceCtrlForeignMenuListenData* _data_; +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_ = _user_data_; +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_source_object_ = source_object; +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_res_ = _res_; +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_listen_co (_data_); +#line 1771 "foreign-menu.c" +} + + +static gboolean spice_ctrl_foreign_menu_listen_co (SpiceCtrlForeignMenuListenData* _data_) { +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + switch (_data_->_state_) { +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case 0: +#line 1780 "foreign-menu.c" + goto _state_0; +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case 1: +#line 1784 "foreign-menu.c" + goto _state_1; +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case 2: +#line 1788 "foreign-menu.c" + goto _state_2; + default: +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_assert_not_reached (); +#line 1793 "foreign-menu.c" + } + _state_0: +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp0_ = _data_->addr; +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp1_ = NULL; +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp1_ = spice_foreign_menu_listener_new (_data_->_tmp0_, &_data_->_inner_error_); +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->listener = _data_->_tmp1_; +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_inner_error_ != NULL) { +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_error_free (_data_->_inner_error_); +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1814 "foreign-menu.c" + } else { +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1818 "foreign-menu.c" + } +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 192 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1824 "foreign-menu.c" + } + { +#line 194 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp2_ = TRUE; +#line 194 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + while (TRUE) { +#line 194 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp3_ = _data_->_tmp2_; +#line 194 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (!_data_->_tmp3_) { +#line 1835 "foreign-menu.c" + } +#line 194 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp2_ = FALSE; +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp4_ = _data_->listener; +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_state_ = 1; +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_foreign_menu_listener_accept_async (_data_->_tmp4_, NULL, spice_ctrl_foreign_menu_listen_ready, _data_); +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1847 "foreign-menu.c" + _state_1: +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp5_ = NULL; +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp5_ = spice_foreign_menu_listener_accept_finish (_data_->_tmp4_, _data_->_res_, NULL, &_data_->_inner_error_); +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp6_ = _g_object_ref0 (_data_->_tmp5_); +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->c = _data_->_tmp6_; +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_inner_error_ != NULL) { +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_error_free (_data_->_inner_error_); +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_data_->listener); +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1869 "foreign-menu.c" + } else { +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1873 "foreign-menu.c" + } +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 195 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1879 "foreign-menu.c" + } +#line 196 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp7_ = _data_->self->priv->nclients; +#line 196 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->self->priv->nclients = _data_->_tmp7_ + 1; +#line 197 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp8_ = _data_->c; +#line 197 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp9_ = _g_object_ref0 (_data_->_tmp8_); +#line 197 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->self->priv->clients = g_list_append (_data_->self->priv->clients, _data_->_tmp9_); +#line 1891 "foreign-menu.c" + { +#line 199 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp10_ = _data_->c; +#line 199 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_state_ = 2; +#line 199 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_handle_client (_data_->self, _data_->_tmp10_, spice_ctrl_foreign_menu_listen_ready, _data_); +#line 199 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1901 "foreign-menu.c" + _state_2: +#line 199 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_handle_client_finish (_data_->self, _data_->_res_, &_data_->_inner_error_); +#line 199 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_inner_error_ != NULL) { +#line 1907 "foreign-menu.c" + goto __catch4_g_error; + } + } + goto __finally4; + __catch4_g_error: + { +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->e = _data_->_inner_error_; +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_inner_error_ = NULL; +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp11_ = _data_->e; +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp12_ = _data_->_tmp11_->message; +#line 201 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_warning ("foreign-menu.vala:201: %s", _data_->_tmp12_); +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_error_free0 (_data_->e); +#line 1926 "foreign-menu.c" + } + __finally4: +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_inner_error_ != NULL) { +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_error_free (_data_->_inner_error_); +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_data_->c); +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_data_->listener); +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1943 "foreign-menu.c" + } else { +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1947 "foreign-menu.c" + } +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 198 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1953 "foreign-menu.c" + } +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp13_ = _data_->c; +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_io_stream_close (_data_->_tmp13_, NULL, &_data_->_inner_error_); +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_inner_error_ != NULL) { +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_); +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_error_free (_data_->_inner_error_); +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_data_->c); +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_data_->listener); +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 1973 "foreign-menu.c" + } else { +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 1977 "foreign-menu.c" + } +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 203 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 1983 "foreign-menu.c" + } +#line 204 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp14_ = _data_->c; +#line 204 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->self->priv->clients = g_list_remove (_data_->self->priv->clients, _data_->_tmp14_); +#line 205 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->_tmp15_ = _data_->self->priv->nclients; +#line 205 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _data_->self->priv->nclients = _data_->_tmp15_ - 1; +#line 194 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_data_->c); +#line 1995 "foreign-menu.c" + } + } +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (_data_->listener); +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + if (_data_->_state_ == 0) { +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete_in_idle (_data_->_async_result); +#line 2004 "foreign-menu.c" + } else { +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_simple_async_result_complete (_data_->_async_result); +#line 2008 "foreign-menu.c" + } +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_unref (_data_->_async_result); +#line 190 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return FALSE; +#line 2014 "foreign-menu.c" +} + + +SpiceCtrlMenu* spice_ctrl_foreign_menu_get_menu (SpiceCtrlForeignMenu* self) { + SpiceCtrlMenu* result; + SpiceCtrlMenu* _tmp0_; +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = self->priv->_menu; +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + result = _tmp0_; +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return result; +#line 2029 "foreign-menu.c" +} + + +static void spice_ctrl_foreign_menu_set_menu (SpiceCtrlForeignMenu* self, SpiceCtrlMenu* value) { + SpiceCtrlMenu* _tmp0_; + SpiceCtrlMenu* _tmp1_; +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_return_if_fail (self != NULL); +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = value; +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp1_ = _g_object_ref0 (_tmp0_); +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (self->priv->_menu); +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + self->priv->_menu = _tmp1_; +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_notify ((GObject *) self, "menu"); +#line 2048 "foreign-menu.c" +} + + +const gchar* spice_ctrl_foreign_menu_get_title (SpiceCtrlForeignMenu* self) { + const gchar* result; + const gchar* _tmp0_; +#line 23 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 23 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = self->priv->_title; +#line 23 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + result = _tmp0_; +#line 23 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + return result; +#line 2063 "foreign-menu.c" +} + + +static void spice_ctrl_foreign_menu_set_title (SpiceCtrlForeignMenu* self, const gchar* value) { + const gchar* _tmp0_; + gchar* _tmp1_; +#line 23 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_return_if_fail (self != NULL); +#line 23 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp0_ = value; +#line 23 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _tmp1_ = g_strdup (_tmp0_); +#line 23 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_free0 (self->priv->_title); +#line 23 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + self->priv->_title = _tmp1_; +#line 23 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_notify ((GObject *) self, "title"); +#line 2082 "foreign-menu.c" +} + + +static void spice_ctrl_foreign_menu_class_init (SpiceCtrlForeignMenuClass * klass) { +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_parent_class = g_type_class_peek_parent (klass); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_type_class_add_private (klass, sizeof (SpiceCtrlForeignMenuPrivate)); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + G_OBJECT_CLASS (klass)->get_property = _vala_spice_ctrl_foreign_menu_get_property; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + G_OBJECT_CLASS (klass)->set_property = _vala_spice_ctrl_foreign_menu_set_property; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + G_OBJECT_CLASS (klass)->finalize = spice_ctrl_foreign_menu_finalize; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_FOREIGN_MENU_MENU, g_param_spec_object ("menu", "menu", "menu", SPICE_CTRL_TYPE_MENU, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), SPICE_CTRL_FOREIGN_MENU_TITLE, g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_signal_new ("client_connected", SPICE_CTRL_TYPE_FOREIGN_MENU, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); +#line 2103 "foreign-menu.c" +} + + +static void spice_ctrl_foreign_menu_instance_init (SpiceCtrlForeignMenu * self) { +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + self->priv = SPICE_CTRL_FOREIGN_MENU_GET_PRIVATE (self); +#line 2110 "foreign-menu.c" +} + + +static void spice_ctrl_foreign_menu_finalize (GObject* obj) { + SpiceCtrlForeignMenu * self; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + self = SPICE_CTRL_FOREIGN_MENU (obj); +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_object_unref0 (self->priv->_menu); +#line 23 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + _g_free0 (self->priv->_title); +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + __g_list_free__g_object_unref0_0 (self->priv->clients); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + G_OBJECT_CLASS (spice_ctrl_foreign_menu_parent_class)->finalize (obj); +#line 2126 "foreign-menu.c" +} + + +GType spice_ctrl_foreign_menu_get_type (void) { + static volatile gsize spice_ctrl_foreign_menu_type_id__volatile = 0; + if (g_once_init_enter (&spice_ctrl_foreign_menu_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (SpiceCtrlForeignMenuClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) spice_ctrl_foreign_menu_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SpiceCtrlForeignMenu), 0, (GInstanceInitFunc) spice_ctrl_foreign_menu_instance_init, NULL }; + GType spice_ctrl_foreign_menu_type_id; + spice_ctrl_foreign_menu_type_id = g_type_register_static (G_TYPE_OBJECT, "SpiceCtrlForeignMenu", &g_define_type_info, 0); + g_once_init_leave (&spice_ctrl_foreign_menu_type_id__volatile, spice_ctrl_foreign_menu_type_id); + } + return spice_ctrl_foreign_menu_type_id__volatile; +} + + +static void _vala_spice_ctrl_foreign_menu_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + SpiceCtrlForeignMenu * self; + self = SPICE_CTRL_FOREIGN_MENU (object); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + switch (property_id) { +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case SPICE_CTRL_FOREIGN_MENU_MENU: +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_value_set_object (value, spice_ctrl_foreign_menu_get_menu (self)); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case SPICE_CTRL_FOREIGN_MENU_TITLE: +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + g_value_set_string (value, spice_ctrl_foreign_menu_get_title (self)); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 2159 "foreign-menu.c" + default: +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 2165 "foreign-menu.c" + } +} + + +static void _vala_spice_ctrl_foreign_menu_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + SpiceCtrlForeignMenu * self; + self = SPICE_CTRL_FOREIGN_MENU (object); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + switch (property_id) { +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case SPICE_CTRL_FOREIGN_MENU_MENU: +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_set_menu (self, g_value_get_object (value)); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + case SPICE_CTRL_FOREIGN_MENU_TITLE: +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + spice_ctrl_foreign_menu_set_title (self, g_value_get_string (value)); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 2187 "foreign-menu.c" + default: +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 20 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/foreign-menu.vala" + break; +#line 2193 "foreign-menu.c" + } +} + + + diff -Nru spice-gtk-0.9/gtk/controller/foreign-menu.vala spice-gtk-0.12/gtk/controller/foreign-menu.vala --- spice-gtk-0.9/gtk/controller/foreign-menu.vala 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/foreign-menu.vala 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,211 @@ +// Copyright (C) 2012 Red Hat, Inc. + +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. + +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, see . + +using Custom; + +namespace SpiceCtrl { + +public class ForeignMenu: Object { + + public Menu menu { get; private set; } + public string title { get; private set; } + + public signal void client_connected (); + + private int nclients; + private List clients; + + public ForeignMenu() { + menu = new Menu (); + } + + public void menu_item_click_msg (int32 item_id) { + debug ("clicked id: %d".printf (item_id)); + + var msg = SpiceProtocol.ForeignMenu.Event (); + msg.base.size = (uint32)sizeof (SpiceProtocol.ForeignMenu.Event); + msg.base.id = SpiceProtocol.ForeignMenu.MsgId.ITEM_EVENT; + msg.id = item_id; + msg.action = SpiceProtocol.ForeignMenu.EventType.CLICK; + + unowned uint8[] p = ((uint8[])(&msg))[0:msg.base.size]; + send_msg (p); + } + + public void menu_item_checked_msg (int32 item_id, bool checked = true) { + debug ("%schecked id: %d".printf (checked ? "" : "un", item_id)); + + var msg = SpiceProtocol.ForeignMenu.Event (); + msg.base.size = (uint32)sizeof (SpiceProtocol.ForeignMenu.Event); + msg.base.id = SpiceProtocol.ForeignMenu.MsgId.ITEM_EVENT; + msg.id = item_id; + msg.action = checked ? + SpiceProtocol.ForeignMenu.EventType.CHECKED : + SpiceProtocol.ForeignMenu.EventType.UNCHECKED; + + unowned uint8[] p = ((uint8[])(&msg))[0:msg.base.size]; + send_msg (p); + } + + public void app_activated_msg (bool activated = true) { + var msg = SpiceProtocol.ForeignMenu.Msg (); + msg.size = (uint32)sizeof (SpiceProtocol.ForeignMenu.Event); + msg.id = activated ? + SpiceProtocol.ForeignMenu.MsgId.APP_ACTIVATED : + SpiceProtocol.ForeignMenu.MsgId.APP_DEACTIVATED; + + unowned uint8[] p = ((uint8[])(&msg))[0:msg.size]; + send_msg (p); + } + + public async bool send_msg (uint8[] p) throws GLib.Error { + // vala FIXME: pass Controller.Msg instead + // vala doesn't keep reference on the struct in async methods + // it copies only base, which is not enough to transmit the whole + // message. + try { + foreach (var c in clients) + yield c.output_stream.write_async (p); + } catch (GLib.Error e) { + warning (e.message); + } + + return true; + } + + SpiceProtocol.Controller.MenuFlags get_menu_flags (uint32 type) { + SpiceProtocol.Controller.MenuFlags flags = 0; + + if ((SpiceProtocol.ForeignMenu.MenuFlags.CHECKED & type) != 0) + flags |= SpiceProtocol.Controller.MenuFlags.CHECKED; + if ((SpiceProtocol.ForeignMenu.MenuFlags.DIM & type) != 0) + flags |= SpiceProtocol.Controller.MenuFlags.GRAYED; + + return flags; + } + + private bool handle_message (SpiceProtocol.ForeignMenu.Msg* msg) { + switch (msg.id) { + case SpiceProtocol.ForeignMenu.MsgId.SET_TITLE: + var t = (SpiceProtocol.ForeignMenu.SetTitle*)(msg); + title = t.string; + break; + case SpiceProtocol.ForeignMenu.MsgId.ADD_ITEM: + var i = (SpiceProtocol.ForeignMenu.AddItem*)(msg); + debug ("add id:%u type:%u position:%u title:%s", i.id, i.type, i.position, i.string); + menu.items.append (new MenuItem ((int)i.id, i.string, get_menu_flags (i.type))); + notify_property ("menu"); + break; + case SpiceProtocol.ForeignMenu.MsgId.MODIFY_ITEM: + debug ("deprecated: modify item"); + break; + case SpiceProtocol.ForeignMenu.MsgId.REMOVE_ITEM: + var i = (SpiceProtocol.ForeignMenu.RmItem*)(msg); + debug ("not implemented: remove id:%u".printf (i.id)); + break; + case SpiceProtocol.ForeignMenu.MsgId.CLEAR: + menu = new Menu (); + break; + default: + warn_if_reached (); + return false; + } + return true; + } + + private async void handle_client (IOStream c) throws GLib.Error { + var header = SpiceProtocol.ForeignMenu.InitHeader (); + unowned uint8[] p = null; + + debug ("new socket client, reading init header"); + + p = ((uint8[])(&header))[0:sizeof(SpiceProtocol.ForeignMenu.InitHeader)]; // FIXME vala + var read = yield c.input_stream.read_async (p); + if (warn_if (read != sizeof (SpiceProtocol.ForeignMenu.InitHeader))) + return; + if (warn_if (header.magic != SpiceProtocol.ForeignMenu.MAGIC)) + return; + if (warn_if (header.version != SpiceProtocol.ForeignMenu.VERSION)) + return; + if (warn_if (header.size < sizeof (SpiceProtocol.ForeignMenu.Init))) + return; + + uint64 credentials = 0; + p = ((uint8[])(&credentials))[0:sizeof(uint64)]; + read = yield c.input_stream.read_async (p); + if (warn_if (read != sizeof(uint64))) + return; + if (warn_if (credentials != 0)) + return; + + var title_size = header.size - sizeof(SpiceProtocol.ForeignMenu.Init); + var title = new uint8[title_size + 1]; + read = yield c.input_stream.read_async (title[0:title_size]); + this.title = (string)title; + + client_connected (); + + var t = new uint8[sizeof(SpiceProtocol.ForeignMenu.Msg)]; + for (;;) { + read = yield c.input_stream.read_async (t[0:sizeof(SpiceProtocol.ForeignMenu.Msg)]); + if (read == 0) + break; + + if (warn_if (read != sizeof (SpiceProtocol.ForeignMenu.Msg))) { + warning ("read only: " + read.to_string ()); + break; + } + + var msg = (SpiceProtocol.ForeignMenu.Msg*)t; + if (warn_if (msg.size < sizeof (SpiceProtocol.ForeignMenu.Msg))) + break; + + if (msg.size > sizeof (SpiceProtocol.ForeignMenu.Msg)) { + t.resize ((int)msg.size); + msg = (SpiceProtocol.ForeignMenu.Msg*)t; + read = yield c.input_stream.read_async (t[sizeof(SpiceProtocol.ForeignMenu.Msg):msg.size]); + if (read == 0) + break; + if (warn_if (read != msg.size - sizeof(SpiceProtocol.ForeignMenu.Msg))) + break; + } + + handle_message (msg); + } + + } + + public async void listen (string? addr = null) throws GLib.Error, SpiceCtrl.Error + { + var listener = Spice.ForeignMenuListener.new_listener (addr); + + for (;;) { + var c = yield listener.accept_async (); + nclients += 1; + clients.append (c); + try { + yield handle_client (c); + } catch (GLib.Error e) { + warning (e.message); + } + c.close (); + clients.remove (c); + nclients -= 1; + } + } + +} + +} // SpiceCtrl diff -Nru spice-gtk-0.9/gtk/controller/Makefile.am spice-gtk-0.12/gtk/controller/Makefile.am --- spice-gtk-0.9/gtk/controller/Makefile.am 2012-01-27 08:56:56.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/Makefile.am 2012-04-11 13:51:02.000000000 +0000 @@ -1,6 +1,11 @@ NULL = -AM_CPPFLAGS = $(GIO_CFLAGS) $(PROTOCOL_CFLAGS) +AM_CPPFLAGS = \ + -DG_LOG_DOMAIN=\"GSpiceController\" \ + $(GIO_CFLAGS) \ + $(COMMON_CFLAGS) \ + $(NULL) + # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html AM_LDFLAGS = \ -no-undefined \ @@ -15,19 +20,31 @@ $(NULL) lib_LTLIBRARIES = libspice-controller.la -noinst_PROGRAMS = test-controller - -BUILT_SOURCES = controller.vala.stamp +noinst_PROGRAMS = test-controller spice-controller-dump libspice_controller_la_VALASOURCES = \ menu.vala \ controller.vala \ + foreign-menu.vala \ + $(NULL) + +libspice_controller_la_BUILT_SOURCES = \ + $(libspice_controller_la_VALASOURCES:.vala=.c) \ + spice-controller.h \ $(NULL) -libspice_controller_la_SOURCES = \ - custom.h \ - spice-controller-listener.c \ - spice-controller-listener.h \ - $(libspice_controller_la_VALASOURCES:.vala=.c) \ + +BUILT_SOURCES = \ + $(libspice_controller_la_BUILT_SOURCES) \ + controller.vala.stamp \ + $(NULL) + +libspice_controller_la_SOURCES = \ + $(libspice_controller_la_BUILT_SOURCES) \ + custom.h \ + spice-controller-listener.c \ + spice-controller-listener.h \ + spice-foreign-menu-listener.c \ + spice-foreign-menu-listener.h \ $(NULL) if OS_WIN32 @@ -42,7 +59,7 @@ endif libspice_controller_la_LDFLAGS = \ $(AM_LDFLAGS) \ - -version-number 0:0:0 \ + -version-info 0:0:0 \ $(NULL) libspice_controllerincludedir = $(includedir)/spice-controller @@ -52,6 +69,9 @@ test_controller_SOURCES = test.c test_controller_LDADD = libspice-controller.la +spice_controller_dump_SOURCES = dump.c +spice_controller_dump_LDADD = libspice-controller.la + controller.vala.stamp: $(libspice_controller_la_VALASOURCES) custom.vapi @if test -z "$(VALAC)"; then \ echo "" ; \ @@ -63,18 +83,13 @@ $(VALA_V)$(VALAC) $(VALAFLAGS) $(AM_VALAFLAGS) $(libspice_controller_la_VALASOURCES) -H spice-controller.h @touch $@ -spice-controller.h: controller.vala.stamp -menu.c: controller.vala.stamp -controller.c: controller.vala.stamp +$(libspice_controller_la_BUILT_SOURCES): controller.vala.stamp EXTRA_DIST = \ $(libspice_controller_la_VALASOURCES) \ controller.vala.stamp \ custom.vapi \ gio-windows-2.0.vapi \ - spice-controller.h \ $(NULL) -vala-clean: - rm -f `find . -name "*.stamp"` - +-include $(top_srcdir)/git.mk diff -Nru spice-gtk-0.9/gtk/controller/Makefile.in spice-gtk-0.12/gtk/controller/Makefile.in --- spice-gtk-0.9/gtk/controller/Makefile.in 2012-01-31 10:22:59.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/Makefile.in 2012-04-24 11:21:03.000000000 +0000 @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -36,7 +36,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = test-controller$(EXEEXT) +noinst_PROGRAMS = test-controller$(EXEEXT) \ + spice-controller-dump$(EXEEXT) @OS_WIN32_TRUE@am__append_1 = \ @OS_WIN32_TRUE@ namedpipe.c \ @OS_WIN32_TRUE@ namedpipe.h \ @@ -51,11 +52,13 @@ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/check_python.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/intltool.m4 \ - $(top_srcdir)/m4/ld-version.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/ld-version.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/manywarnings.m4 \ + $(top_srcdir)/m4/spice-compile-warnings.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -83,29 +86,42 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(libdir)" \ "$(DESTDIR)$(libspice_controllerincludedir)" LTLIBRARIES = $(lib_LTLIBRARIES) libspice_controller_la_LIBADD = -am__libspice_controller_la_SOURCES_DIST = custom.h \ - spice-controller-listener.c spice-controller-listener.h menu.c \ - controller.c namedpipe.c namedpipe.h namedpipeconnection.c \ +am__libspice_controller_la_SOURCES_DIST = menu.c controller.c \ + foreign-menu.c spice-controller.h custom.h \ + spice-controller-listener.c spice-controller-listener.h \ + spice-foreign-menu-listener.c spice-foreign-menu-listener.h \ + namedpipe.c namedpipe.h namedpipeconnection.c \ namedpipeconnection.h namedpipelistener.c namedpipelistener.h am__objects_1 = -am__objects_2 = menu.lo controller.lo $(am__objects_1) -@OS_WIN32_TRUE@am__objects_3 = namedpipe.lo namedpipeconnection.lo \ +am__objects_2 = menu.lo controller.lo foreign-menu.lo $(am__objects_1) +am__objects_3 = $(am__objects_2) $(am__objects_1) +@OS_WIN32_TRUE@am__objects_4 = namedpipe.lo namedpipeconnection.lo \ @OS_WIN32_TRUE@ namedpipelistener.lo $(am__objects_1) -am_libspice_controller_la_OBJECTS = spice-controller-listener.lo \ - $(am__objects_2) $(am__objects_1) $(am__objects_3) +am_libspice_controller_la_OBJECTS = $(am__objects_3) \ + spice-controller-listener.lo spice-foreign-menu-listener.lo \ + $(am__objects_1) $(am__objects_4) libspice_controller_la_OBJECTS = $(am_libspice_controller_la_OBJECTS) -AM_V_lt = $(am__v_lt_$(V)) -am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent libspice_controller_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libspice_controller_la_LDFLAGS) \ $(LDFLAGS) -o $@ PROGRAMS = $(noinst_PROGRAMS) +am_spice_controller_dump_OBJECTS = dump.$(OBJEXT) +spice_controller_dump_OBJECTS = $(am_spice_controller_dump_OBJECTS) +spice_controller_dump_DEPENDENCIES = libspice-controller.la am_test_controller_OBJECTS = test.$(OBJEXT) test_controller_OBJECTS = $(am_test_controller_OBJECTS) test_controller_DEPENDENCIES = libspice-controller.la @@ -119,25 +135,26 @@ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_$(V)) -am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_$(V)) -am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; -SOURCES = $(libspice_controller_la_SOURCES) $(test_controller_SOURCES) +SOURCES = $(libspice_controller_la_SOURCES) \ + $(spice_controller_dump_SOURCES) $(test_controller_SOURCES) DIST_SOURCES = $(am__libspice_controller_la_SOURCES_DIST) \ - $(test_controller_SOURCES) + $(spice_controller_dump_SOURCES) $(test_controller_SOURCES) HEADERS = $(libspice_controllerinclude_HEADERS) ETAGS = etags CTAGS = ctags @@ -163,6 +180,7 @@ CELT051_LIBDIR = @CELT051_LIBDIR@ CELT051_LIBS = @CELT051_LIBS@ CFLAGS = @CFLAGS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ @@ -213,6 +231,10 @@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ @@ -268,8 +290,6 @@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PROTOCOL_CFLAGS = @PROTOCOL_CFLAGS@ -PROTOCOL_LIBS = @PROTOCOL_LIBS@ PULSE_CFLAGS = @PULSE_CFLAGS@ PULSE_LIBS = @PULSE_LIBS@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ @@ -289,7 +309,6 @@ SMARTCARD_CFLAGS = @SMARTCARD_CFLAGS@ SMARTCARD_LIBS = @SMARTCARD_LIBS@ SPICE_CFLAGS = @SPICE_CFLAGS@ -SPICE_COMMON_SRCDIR = @SPICE_COMMON_SRCDIR@ SPICE_GLIB_CFLAGS = @SPICE_GLIB_CFLAGS@ SPICE_GLIB_REQUIRES = @SPICE_GLIB_REQUIRES@ SPICE_GTK_API_VERSION = @SPICE_GTK_API_VERSION@ @@ -298,14 +317,19 @@ SPICE_GTK_REQUIRES = @SPICE_GTK_REQUIRES@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ +STOW = @STOW@ STRIP = @STRIP@ USBREDIR_CFLAGS = @USBREDIR_CFLAGS@ USBREDIR_LIBS = @USBREDIR_LIBS@ +USB_IDS = @USB_IDS@ USE_NLS = @USE_NLS@ VALAC = @VALAC@ VAPIDIR = @VAPIDIR@ VAPIGEN = @VAPIGEN@ VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_LDFLAGS = @WARN_LDFLAGS@ +WARN_PYFLAGS = @WARN_PYFLAGS@ XGETTEXT = @XGETTEXT@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ @@ -343,6 +367,8 @@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ @@ -361,13 +387,20 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ NULL = -AM_CPPFLAGS = $(GIO_CFLAGS) $(PROTOCOL_CFLAGS) +AM_CPPFLAGS = \ + -DG_LOG_DOMAIN=\"GSpiceController\" \ + $(GIO_CFLAGS) \ + $(COMMON_CFLAGS) \ + $(NULL) + + # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html AM_LDFLAGS = \ -no-undefined \ @@ -382,19 +415,30 @@ $(NULL) lib_LTLIBRARIES = libspice-controller.la -BUILT_SOURCES = controller.vala.stamp libspice_controller_la_VALASOURCES = \ menu.vala \ controller.vala \ + foreign-menu.vala \ + $(NULL) + +libspice_controller_la_BUILT_SOURCES = \ + $(libspice_controller_la_VALASOURCES:.vala=.c) \ + spice-controller.h \ + $(NULL) + +BUILT_SOURCES = \ + $(libspice_controller_la_BUILT_SOURCES) \ + controller.vala.stamp \ $(NULL) -libspice_controller_la_SOURCES = custom.h spice-controller-listener.c \ - spice-controller-listener.h \ - $(libspice_controller_la_VALASOURCES:.vala=.c) $(NULL) \ - $(am__append_1) +libspice_controller_la_SOURCES = \ + $(libspice_controller_la_BUILT_SOURCES) custom.h \ + spice-controller-listener.c spice-controller-listener.h \ + spice-foreign-menu-listener.c spice-foreign-menu-listener.h \ + $(NULL) $(am__append_1) libspice_controller_la_LDFLAGS = \ $(AM_LDFLAGS) \ - -version-number 0:0:0 \ + -version-info 0:0:0 \ $(NULL) libspice_controllerincludedir = $(includedir)/spice-controller @@ -403,12 +447,13 @@ test_controller_SOURCES = test.c test_controller_LDADD = libspice-controller.la +spice_controller_dump_SOURCES = dump.c +spice_controller_dump_LDADD = libspice-controller.la EXTRA_DIST = \ $(libspice_controller_la_VALASOURCES) \ controller.vala.stamp \ custom.vapi \ gio-windows-2.0.vapi \ - spice-controller.h \ $(NULL) all: $(BUILT_SOURCES) @@ -477,7 +522,7 @@ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libspice-controller.la: $(libspice_controller_la_OBJECTS) $(libspice_controller_la_DEPENDENCIES) +libspice-controller.la: $(libspice_controller_la_OBJECTS) $(libspice_controller_la_DEPENDENCIES) $(EXTRA_libspice_controller_la_DEPENDENCIES) $(AM_V_CCLD)$(libspice_controller_la_LINK) -rpath $(libdir) $(libspice_controller_la_OBJECTS) $(libspice_controller_la_LIBADD) $(LIBS) clean-noinstPROGRAMS: @@ -488,7 +533,10 @@ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list -test-controller$(EXEEXT): $(test_controller_OBJECTS) $(test_controller_DEPENDENCIES) +spice-controller-dump$(EXEEXT): $(spice_controller_dump_OBJECTS) $(spice_controller_dump_DEPENDENCIES) $(EXTRA_spice_controller_dump_DEPENDENCIES) + @rm -f spice-controller-dump$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(spice_controller_dump_OBJECTS) $(spice_controller_dump_LDADD) $(LIBS) +test-controller$(EXEEXT): $(test_controller_OBJECTS) $(test_controller_DEPENDENCIES) $(EXTRA_test_controller_DEPENDENCIES) @rm -f test-controller$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_controller_OBJECTS) $(test_controller_LDADD) $(LIBS) @@ -499,36 +547,36 @@ -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/controller.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/foreign-menu.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/namedpipe.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/namedpipeconnection.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/namedpipelistener.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spice-controller-listener.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spice-foreign-menu-listener.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -552,9 +600,7 @@ @$(NORMAL_UNINSTALL) @list='$(libspice_controllerinclude_HEADERS)'; test -n "$(libspice_controllerincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(libspice_controllerincludedir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(libspice_controllerincludedir)" && rm -f $$files + dir='$(DESTDIR)$(libspice_controllerincludedir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -657,10 +703,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -776,12 +827,9 @@ $(VALA_V)$(VALAC) $(VALAFLAGS) $(AM_VALAFLAGS) $(libspice_controller_la_VALASOURCES) -H spice-controller.h @touch $@ -spice-controller.h: controller.vala.stamp -menu.c: controller.vala.stamp -controller.c: controller.vala.stamp +$(libspice_controller_la_BUILT_SOURCES): controller.vala.stamp -vala-clean: - rm -f `find . -name "*.stamp"` +-include $(top_srcdir)/git.mk # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru spice-gtk-0.9/gtk/controller/menu.c spice-gtk-0.12/gtk/controller/menu.c --- spice-gtk-0.9/gtk/controller/menu.c 2011-10-10 09:39:24.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/menu.c 2012-04-24 11:24:37.000000000 +0000 @@ -1,4 +1,4 @@ -/* menu.c generated by valac 0.14.0, the Vala compiler +/* menu.c generated by valac 0.16.0, the Vala compiler * generated from menu.vala, do not modify */ /* Copyright (C) 2011 Red Hat, Inc.*/ @@ -85,6 +85,8 @@ enum { SPICE_CTRL_MENU_ITEM_DUMMY_PROPERTY }; +SpiceCtrlMenuItem* spice_ctrl_menu_item_new (gint id, const gchar* text, unsigned int flags); +SpiceCtrlMenuItem* spice_ctrl_menu_item_construct (GType object_type, gint id, const gchar* text, unsigned int flags); GQuark spice_ctrl_error_quark (void); SpiceCtrlMenuItem* spice_ctrl_menu_item_new_from_string (const gchar* str, GError** error); SpiceCtrlMenuItem* spice_ctrl_menu_item_construct_from_string (GType object_type, const gchar* str, GError** error); @@ -94,8 +96,6 @@ gchar* spice_ctrl_menu_to_string (SpiceCtrlMenu* self); const gchar* spice_protocol_controller_menu_flags_to_string (unsigned int self); static const char* _spice_protocol_controller_menu_flags_to_string (unsigned int value); -SpiceCtrlMenuItem* spice_ctrl_menu_item_new (void); -SpiceCtrlMenuItem* spice_ctrl_menu_item_construct (GType object_type); static void spice_ctrl_menu_item_finalize (GObject* obj); enum { SPICE_CTRL_MENU_DUMMY_PROPERTY @@ -111,6 +111,45 @@ static gint _vala_array_length (gpointer array); +SpiceCtrlMenuItem* spice_ctrl_menu_item_construct (GType object_type, gint id, const gchar* text, unsigned int flags) { + SpiceCtrlMenuItem * self = NULL; + gint _tmp0_; + const gchar* _tmp1_; + gchar* _tmp2_; + unsigned int _tmp3_; +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" + g_return_val_if_fail (text != NULL, NULL); +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" + self = (SpiceCtrlMenuItem*) g_object_new (object_type, NULL); +#line 32 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" + _tmp0_ = id; +#line 32 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" + self->id = _tmp0_; +#line 33 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" + _tmp1_ = text; +#line 33 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" + _tmp2_ = g_strdup (_tmp1_); +#line 33 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" + _g_free0 (self->text); +#line 33 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" + self->text = _tmp2_; +#line 34 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" + _tmp3_ = flags; +#line 34 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" + self->flags = _tmp3_; +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" + return self; +#line 143 "menu.c" +} + + +SpiceCtrlMenuItem* spice_ctrl_menu_item_new (gint id, const gchar* text, unsigned int flags) { +#line 31 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" + return spice_ctrl_menu_item_construct (SPICE_CTRL_TYPE_MENU_ITEM, id, text, flags); +#line 150 "menu.c" +} + + SpiceCtrlMenuItem* spice_ctrl_menu_item_construct_from_string (GType object_type, const gchar* str, GError** error) { SpiceCtrlMenuItem * self = NULL; const gchar* _tmp0_; @@ -151,203 +190,203 @@ gint _tmp26_ = 0; SpiceCtrlMenu* _tmp27_; GError * _inner_error_ = NULL; -#line 31 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_return_val_if_fail (str != NULL, NULL); -#line 31 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" self = (SpiceCtrlMenuItem*) g_object_new (object_type, NULL); -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp0_ = str; -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp1_ = CONTROLLER_MENU_PARAM_DELIMITER; -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp3_ = _tmp2_ = g_strsplit (_tmp0_, _tmp1_, 0); -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" params = _tmp3_; -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" params_length1 = _vala_array_length (_tmp2_); -#line 32 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 38 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _params_size_ = params_length1; -#line 33 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp4_ = params; -#line 33 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp4__length1 = params_length1; -#line 33 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp5_ = g_warn_if (_tmp4__length1 != 5); -#line 33 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 39 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" if (_tmp5_) { -#line 179 "menu.c" +#line 218 "menu.c" GError* _tmp6_; -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp6_ = g_error_new_literal (SPICE_CTRL_ERROR, SPICE_CTRL_ERROR_VALUE, ""); -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _inner_error_ = _tmp6_; -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" if (_inner_error_->domain == SPICE_CTRL_ERROR) { -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_propagate_error (error, _inner_error_); -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" params = (_vala_array_free (params, params_length1, (GDestroyNotify) g_free), NULL); -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_object_unref0 (self); -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return NULL; -#line 195 "menu.c" +#line 234 "menu.c" } else { -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" params = (_vala_array_free (params, params_length1, (GDestroyNotify) g_free), NULL); -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_clear_error (&_inner_error_); -#line 34 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 40 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return NULL; -#line 205 "menu.c" +#line 244 "menu.c" } } -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp7_ = params; -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp7__length1 = params_length1; -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp8_ = _tmp7_[0]; -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp9_ = atoi (_tmp8_); -#line 35 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 41 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" self->parent_id = _tmp9_; -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 42 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp10_ = params; -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 42 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp10__length1 = params_length1; -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 42 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp11_ = _tmp10_[1]; -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 42 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp12_ = atoi (_tmp11_); -#line 36 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 42 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" self->id = _tmp12_; -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp13_ = params; -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp13__length1 = params_length1; -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp14_ = _tmp13_[2]; -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp16_ = _tmp15_ = g_strsplit (_tmp14_, "\t", 0); -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" textaccel = _tmp16_; -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" textaccel_length1 = _vala_array_length (_tmp15_); -#line 37 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 43 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _textaccel_size_ = textaccel_length1; -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp17_ = textaccel; -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp17__length1 = textaccel_length1; -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp18_ = _tmp17_[0]; -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp19_ = g_strdup (_tmp18_); -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (self->text); -#line 38 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 44 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" self->text = _tmp19_; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 45 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp20_ = textaccel; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 45 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp20__length1 = textaccel_length1; -#line 39 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 45 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" if (_tmp20__length1 > 1) { -#line 260 "menu.c" +#line 299 "menu.c" gchar** _tmp21_; gint _tmp21__length1; const gchar* _tmp22_; gchar* _tmp23_; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 46 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp21_ = textaccel; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 46 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp21__length1 = textaccel_length1; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 46 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp22_ = _tmp21_[1]; -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 46 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp23_ = g_strdup (_tmp22_); -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 46 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (self->accel); -#line 40 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 46 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" self->accel = _tmp23_; -#line 277 "menu.c" +#line 316 "menu.c" } -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 47 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp24_ = params; -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 47 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp24__length1 = params_length1; -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 47 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp25_ = _tmp24_[3]; -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 47 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp26_ = atoi (_tmp25_); -#line 41 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 47 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" self->flags = (unsigned int) _tmp26_; -#line 43 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 49 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp27_ = spice_ctrl_menu_new (); -#line 43 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 49 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_object_unref0 (self->submenu); -#line 43 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 49 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" self->submenu = _tmp27_; -#line 31 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" textaccel = (_vala_array_free (textaccel, textaccel_length1, (GDestroyNotify) g_free), NULL); -#line 31 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" params = (_vala_array_free (params, params_length1, (GDestroyNotify) g_free), NULL); -#line 31 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return self; -#line 301 "menu.c" +#line 340 "menu.c" } SpiceCtrlMenuItem* spice_ctrl_menu_item_new_from_string (const gchar* str, GError** error) { -#line 31 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 37 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return spice_ctrl_menu_item_construct_from_string (SPICE_CTRL_TYPE_MENU_ITEM, str, error); -#line 308 "menu.c" +#line 347 "menu.c" } static const gchar* string_to_string (const gchar* self) { const gchar* result = NULL; -#line 1418 "/usr/share/vala-0.14/vapi/glib-2.0.vapi" +#line 1421 "/usr/share/vala-0.16/vapi/glib-2.0.vapi" g_return_val_if_fail (self != NULL, NULL); -#line 1419 "/usr/share/vala-0.14/vapi/glib-2.0.vapi" +#line 1422 "/usr/share/vala-0.16/vapi/glib-2.0.vapi" result = self; -#line 1419 "/usr/share/vala-0.14/vapi/glib-2.0.vapi" +#line 1422 "/usr/share/vala-0.16/vapi/glib-2.0.vapi" return result; -#line 320 "menu.c" +#line 359 "menu.c" } static const char* _spice_protocol_controller_menu_flags_to_string (unsigned int value) { -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" switch (value) { -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" case CONTROLLER_MENU_FLAGS_SEPARATOR: -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return "CONTROLLER_MENU_FLAGS_SEPARATOR"; -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" case CONTROLLER_MENU_FLAGS_DISABLED: -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return "CONTROLLER_MENU_FLAGS_DISABLED"; -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" case CONTROLLER_MENU_FLAGS_POPUP: -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return "CONTROLLER_MENU_FLAGS_POPUP"; -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" case CONTROLLER_MENU_FLAGS_CHECKED: -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return "CONTROLLER_MENU_FLAGS_CHECKED"; -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" case CONTROLLER_MENU_FLAGS_GRAYED: -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return "CONTROLLER_MENU_FLAGS_GRAYED"; -#line 347 "menu.c" +#line 386 "menu.c" } -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return NULL; -#line 351 "menu.c" +#line 390 "menu.c" } @@ -373,70 +412,70 @@ const gchar* _tmp15_ = NULL; gchar** _tmp16_; gchar** _tmp17_ = NULL; -#line 46 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 52 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_return_val_if_fail (self != NULL, NULL); -#line 47 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 53 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp0_ = self->submenu; -#line 47 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 53 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp1_ = spice_ctrl_menu_to_string (_tmp0_); -#line 47 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 53 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" sub = _tmp1_; -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp2_ = self->parent_id; -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp3_ = g_strdup_printf ("%i", _tmp2_); -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp4_ = _tmp3_; -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp5_ = self->id; -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp6_ = g_strdup_printf ("%i", _tmp5_); -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp7_ = _tmp6_; -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp8_ = self->text; -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp9_ = string_to_string (_tmp8_); -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp10_ = self->flags; -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp11_ = _spice_protocol_controller_menu_flags_to_string (_tmp10_); -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp12_ = g_strconcat ("pid: ", _tmp4_, ", id: ", _tmp7_, ", text: \"", _tmp9_, "\", flags: ", _tmp11_, NULL); -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp13_ = _tmp12_; -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (_tmp7_); -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (_tmp4_); -#line 48 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 54 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" str = _tmp13_; -#line 49 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 55 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp14_ = sub; -#line 49 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 55 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp15_ = string_to_string (_tmp14_); -#line 49 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 55 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp17_ = _tmp16_ = g_strsplit (_tmp15_, "\n", 0); -#line 421 "menu.c" +#line 460 "menu.c" { gchar** l_collection = NULL; gint l_collection_length1 = 0; gint _l_collection_size_ = 0; gint l_it = 0; -#line 49 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 55 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" l_collection = _tmp17_; -#line 49 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 55 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" l_collection_length1 = _vala_array_length (_tmp16_); -#line 49 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 55 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" for (l_it = 0; l_it < _vala_array_length (_tmp16_); l_it = l_it + 1) { -#line 433 "menu.c" +#line 472 "menu.c" gchar* _tmp18_; gchar* l = NULL; -#line 49 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 55 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp18_ = g_strdup (l_collection[l_it]); -#line 49 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 55 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" l = _tmp18_; -#line 440 "menu.c" +#line 479 "menu.c" { const gchar* _tmp19_; const gchar* _tmp20_; @@ -445,76 +484,59 @@ gchar* _tmp23_ = NULL; gchar* _tmp24_; gchar* _tmp25_; -#line 50 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 56 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp19_ = l; -#line 50 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 56 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" if (g_strcmp0 (_tmp19_, "") == 0) { -#line 51 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 57 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (l); -#line 51 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 57 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" continue; -#line 457 "menu.c" +#line 496 "menu.c" } -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp20_ = str; -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp21_ = l; -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp22_ = string_to_string (_tmp21_); -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp23_ = g_strconcat ("\n ", _tmp22_, NULL); -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp24_ = _tmp23_; -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp25_ = g_strconcat (_tmp20_, _tmp24_, NULL); -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (str); -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" str = _tmp25_; -#line 52 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 58 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (_tmp24_); -#line 49 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 55 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (l); -#line 479 "menu.c" +#line 518 "menu.c" } } -#line 49 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 55 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" l_collection = (_vala_array_free (l_collection, l_collection_length1, (GDestroyNotify) g_free), NULL); -#line 484 "menu.c" +#line 523 "menu.c" } -#line 54 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 60 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" result = str; -#line 54 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 60 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (sub); -#line 54 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 60 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return result; -#line 492 "menu.c" -} - - -SpiceCtrlMenuItem* spice_ctrl_menu_item_construct (GType object_type) { - SpiceCtrlMenuItem * self = NULL; -#line 22 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" - self = (SpiceCtrlMenuItem*) g_object_new (object_type, NULL); -#line 22 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" - return self; -#line 502 "menu.c" -} - - -SpiceCtrlMenuItem* spice_ctrl_menu_item_new (void) { -#line 22 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" - return spice_ctrl_menu_item_construct (SPICE_CTRL_TYPE_MENU_ITEM); -#line 509 "menu.c" +#line 531 "menu.c" } static void spice_ctrl_menu_item_class_init (SpiceCtrlMenuItemClass * klass) { -#line 22 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" spice_ctrl_menu_item_parent_class = g_type_class_peek_parent (klass); -#line 22 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" G_OBJECT_CLASS (klass)->finalize = spice_ctrl_menu_item_finalize; -#line 518 "menu.c" +#line 540 "menu.c" } @@ -524,17 +546,17 @@ static void spice_ctrl_menu_item_finalize (GObject* obj) { SpiceCtrlMenuItem * self; -#line 22 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" self = SPICE_CTRL_MENU_ITEM (obj); -#line 24 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 24 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_object_unref0 (self->submenu); -#line 27 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 27 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (self->text); -#line 28 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 28 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (self->accel); -#line 22 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 22 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" G_OBJECT_CLASS (spice_ctrl_menu_item_parent_class)->finalize (obj); -#line 538 "menu.c" +#line 560 "menu.c" } @@ -551,25 +573,25 @@ static void _g_object_unref0_ (gpointer var) { -#line 60 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 66 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" (var == NULL) ? NULL : (var = (g_object_unref (var), NULL)); -#line 557 "menu.c" +#line 579 "menu.c" } static void _g_list_free__g_object_unref0_ (GList* self) { -#line 60 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 66 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_list_foreach (self, (GFunc) _g_object_unref0_, NULL); -#line 60 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 66 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_list_free (self); -#line 566 "menu.c" +#line 588 "menu.c" } static gpointer _g_object_ref0 (gpointer self) { -#line 64 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return self ? g_object_ref (self) : NULL; -#line 573 "menu.c" +#line 595 "menu.c" } @@ -577,40 +599,40 @@ SpiceCtrlMenu* result = NULL; gint _tmp0_; GList* _tmp2_; -#line 62 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 68 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_return_val_if_fail (self != NULL, NULL); -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 69 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp0_ = id; -#line 63 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 69 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" if (_tmp0_ == 0) { -#line 587 "menu.c" +#line 609 "menu.c" SpiceCtrlMenu* _tmp1_; -#line 64 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp1_ = _g_object_ref0 (self); -#line 64 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" result = _tmp1_; -#line 64 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 70 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return result; -#line 595 "menu.c" +#line 617 "menu.c" } -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp2_ = self->items; -#line 599 "menu.c" +#line 621 "menu.c" { GList* item_collection = NULL; GList* item_it = NULL; -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" item_collection = _tmp2_; -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" for (item_it = item_collection; item_it != NULL; item_it = item_it->next) { -#line 607 "menu.c" +#line 629 "menu.c" SpiceCtrlMenuItem* _tmp3_; SpiceCtrlMenuItem* item = NULL; -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp3_ = _g_object_ref0 ((SpiceCtrlMenuItem*) item_it->data); -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" item = _tmp3_; -#line 614 "menu.c" +#line 636 "menu.c" { SpiceCtrlMenuItem* _tmp4_; gint _tmp5_; @@ -621,67 +643,67 @@ SpiceCtrlMenu* _tmp13_ = NULL; SpiceCtrlMenu* menu; SpiceCtrlMenu* _tmp14_; -#line 67 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 73 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp4_ = item; -#line 67 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 73 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp5_ = _tmp4_->id; -#line 67 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 73 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp6_ = id; -#line 67 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 73 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" if (_tmp5_ == _tmp6_) { -#line 633 "menu.c" +#line 655 "menu.c" SpiceCtrlMenuItem* _tmp7_; SpiceCtrlMenu* _tmp8_; SpiceCtrlMenu* _tmp9_; -#line 68 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 74 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp7_ = item; -#line 68 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 74 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp8_ = _tmp7_->submenu; -#line 68 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 74 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp9_ = _g_object_ref0 (_tmp8_); -#line 68 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 74 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" result = _tmp9_; -#line 68 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 74 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_object_unref0 (item); -#line 68 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 74 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return result; -#line 649 "menu.c" +#line 671 "menu.c" } -#line 70 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 76 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp10_ = item; -#line 70 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 76 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp11_ = _tmp10_->submenu; -#line 70 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 76 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp12_ = id; -#line 70 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 76 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp13_ = spice_ctrl_menu_find_id (_tmp11_, _tmp12_); -#line 70 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 76 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" menu = _tmp13_; -#line 71 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 77 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp14_ = menu; -#line 71 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 77 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" if (_tmp14_ != NULL) { -#line 72 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" result = menu; -#line 72 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_object_unref0 (item); -#line 72 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 78 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return result; -#line 671 "menu.c" +#line 693 "menu.c" } -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_object_unref0 (menu); -#line 66 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 72 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_object_unref0 (item); -#line 677 "menu.c" +#line 699 "menu.c" } } } -#line 75 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 81 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" result = NULL; -#line 75 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 81 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return result; -#line 685 "menu.c" +#line 707 "menu.c" } @@ -692,36 +714,36 @@ gchar** _tmp2_; gchar** _tmp3_ = NULL; GError * _inner_error_ = NULL; -#line 78 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 84 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_return_val_if_fail (str != NULL, NULL); -#line 78 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 84 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" self = (SpiceCtrlMenu*) g_object_new (object_type, NULL); -#line 79 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp0_ = str; -#line 79 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp1_ = CONTROLLER_MENU_ITEM_DELIMITER; -#line 79 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp3_ = _tmp2_ = g_strsplit (_tmp0_, _tmp1_, 0); -#line 706 "menu.c" +#line 728 "menu.c" { gchar** itemstr_collection = NULL; gint itemstr_collection_length1 = 0; gint _itemstr_collection_size_ = 0; gint itemstr_it = 0; -#line 79 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" itemstr_collection = _tmp3_; -#line 79 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" itemstr_collection_length1 = _vala_array_length (_tmp2_); -#line 79 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" for (itemstr_it = 0; itemstr_it < _vala_array_length (_tmp2_); itemstr_it = itemstr_it + 1) { -#line 718 "menu.c" +#line 740 "menu.c" gchar* _tmp4_; gchar* itemstr = NULL; -#line 79 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp4_ = g_strdup (itemstr_collection[itemstr_it]); -#line 79 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" itemstr = _tmp4_; -#line 725 "menu.c" +#line 747 "menu.c" { { const gchar* _tmp5_; @@ -738,101 +760,101 @@ SpiceCtrlMenu* _tmp15_; SpiceCtrlMenuItem* _tmp16_; SpiceCtrlMenuItem* _tmp17_; -#line 81 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 87 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp5_ = itemstr; -#line 81 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 87 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp6_ = strlen (_tmp5_); -#line 81 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 87 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp7_ = _tmp6_; -#line 81 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 87 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" if (_tmp7_ == 0) { -#line 82 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 88 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (itemstr); -#line 82 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 88 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" continue; -#line 754 "menu.c" +#line 776 "menu.c" } -#line 83 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 89 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp8_ = itemstr; -#line 83 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 89 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp9_ = spice_ctrl_menu_item_new_from_string (_tmp8_, &_inner_error_); -#line 83 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 89 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" item = _tmp9_; -#line 83 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 89 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" if (_inner_error_ != NULL) { -#line 83 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 89 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" if (_inner_error_->domain == SPICE_CTRL_ERROR) { -#line 766 "menu.c" +#line 788 "menu.c" goto __catch0_spice_ctrl_error; } -#line 83 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 89 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (itemstr); -#line 83 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 89 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" itemstr_collection = (_vala_array_free (itemstr_collection, itemstr_collection_length1, (GDestroyNotify) g_free), NULL); -#line 83 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 89 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); -#line 83 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 89 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_clear_error (&_inner_error_); -#line 83 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 89 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return NULL; -#line 779 "menu.c" +#line 801 "menu.c" } -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 90 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp10_ = item; -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 90 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp11_ = _tmp10_->parent_id; -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 90 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp12_ = spice_ctrl_menu_find_id (self, _tmp11_); -#line 84 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 90 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" parent = _tmp12_; -#line 85 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 91 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp13_ = parent; -#line 85 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 91 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" if (_tmp13_ == NULL) { -#line 793 "menu.c" +#line 815 "menu.c" GError* _tmp14_; -#line 86 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 92 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp14_ = g_error_new_literal (SPICE_CTRL_ERROR, SPICE_CTRL_ERROR_VALUE, "Invalid parent menu id"); -#line 86 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 92 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _inner_error_ = _tmp14_; -#line 86 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 92 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_object_unref0 (parent); -#line 86 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 92 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_object_unref0 (item); -#line 86 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 92 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" if (_inner_error_->domain == SPICE_CTRL_ERROR) { -#line 805 "menu.c" +#line 827 "menu.c" goto __catch0_spice_ctrl_error; } -#line 86 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 92 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_object_unref0 (parent); -#line 86 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 92 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_object_unref0 (item); -#line 86 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 92 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (itemstr); -#line 86 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 92 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" itemstr_collection = (_vala_array_free (itemstr_collection, itemstr_collection_length1, (GDestroyNotify) g_free), NULL); -#line 86 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 92 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); -#line 86 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 92 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_clear_error (&_inner_error_); -#line 86 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 92 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return NULL; -#line 822 "menu.c" +#line 844 "menu.c" } -#line 87 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp15_ = parent; -#line 87 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp16_ = item; -#line 87 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp17_ = _g_object_ref0 (_tmp16_); -#line 87 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 93 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp15_->items = g_list_append (_tmp15_->items, _tmp17_); -#line 80 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_object_unref0 (parent); -#line 80 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_object_unref0 (item); -#line 836 "menu.c" +#line 858 "menu.c" } goto __finally0; __catch0_spice_ctrl_error: @@ -840,54 +862,54 @@ GError* e = NULL; GError* _tmp18_; const gchar* _tmp19_; -#line 80 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" e = _inner_error_; -#line 80 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _inner_error_ = NULL; -#line 89 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 95 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp18_ = e; -#line 89 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 95 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp19_ = _tmp18_->message; -#line 89 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" - g_warning ("menu.vala:89: %s", _tmp19_); -#line 80 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 95 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" + g_warning ("menu.vala:95: %s", _tmp19_); +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_error_free0 (e); -#line 856 "menu.c" +#line 878 "menu.c" } __finally0: -#line 80 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" if (_inner_error_ != NULL) { -#line 80 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (itemstr); -#line 80 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" itemstr_collection = (_vala_array_free (itemstr_collection, itemstr_collection_length1, (GDestroyNotify) g_free), NULL); -#line 80 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); -#line 80 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_clear_error (&_inner_error_); -#line 80 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 86 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return NULL; -#line 871 "menu.c" +#line 893 "menu.c" } -#line 79 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (itemstr); -#line 875 "menu.c" +#line 897 "menu.c" } } -#line 79 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 85 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" itemstr_collection = (_vala_array_free (itemstr_collection, itemstr_collection_length1, (GDestroyNotify) g_free), NULL); -#line 880 "menu.c" +#line 902 "menu.c" } -#line 78 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 84 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return self; -#line 884 "menu.c" +#line 906 "menu.c" } SpiceCtrlMenu* spice_ctrl_menu_new_from_string (const gchar* str) { -#line 78 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 84 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return spice_ctrl_menu_construct_from_string (SPICE_CTRL_TYPE_MENU, str); -#line 891 "menu.c" +#line 913 "menu.c" } @@ -896,30 +918,30 @@ gchar* _tmp0_; gchar* str; GList* _tmp1_; -#line 94 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 100 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" g_return_val_if_fail (self != NULL, NULL); -#line 95 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 101 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp0_ = g_strdup (""); -#line 95 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 101 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" str = _tmp0_; -#line 96 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 102 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp1_ = self->items; -#line 908 "menu.c" +#line 930 "menu.c" { GList* i_collection = NULL; GList* i_it = NULL; -#line 96 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 102 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" i_collection = _tmp1_; -#line 96 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 102 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" for (i_it = i_collection; i_it != NULL; i_it = i_it->next) { -#line 916 "menu.c" +#line 938 "menu.c" SpiceCtrlMenuItem* _tmp2_; SpiceCtrlMenuItem* i = NULL; -#line 96 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 102 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp2_ = _g_object_ref0 ((SpiceCtrlMenuItem*) i_it->data); -#line 96 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 102 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" i = _tmp2_; -#line 923 "menu.c" +#line 945 "menu.c" { const gchar* _tmp3_; SpiceCtrlMenuItem* _tmp4_; @@ -928,65 +950,65 @@ gchar* _tmp7_ = NULL; gchar* _tmp8_; gchar* _tmp9_; -#line 97 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 103 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp3_ = str; -#line 97 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 103 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp4_ = i; -#line 97 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 103 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp5_ = spice_ctrl_menu_item_to_string (_tmp4_); -#line 97 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 103 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp6_ = _tmp5_; -#line 97 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 103 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp7_ = g_strconcat ("\n", _tmp6_, NULL); -#line 97 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 103 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp8_ = _tmp7_; -#line 97 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 103 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _tmp9_ = g_strconcat (_tmp3_, _tmp8_, NULL); -#line 97 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 103 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (str); -#line 97 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 103 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" str = _tmp9_; -#line 97 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 103 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (_tmp8_); -#line 97 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 103 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_free0 (_tmp6_); -#line 96 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 102 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" _g_object_unref0 (i); -#line 956 "menu.c" +#line 978 "menu.c" } } } -#line 98 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 104 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" result = str; -#line 98 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 104 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return result; -#line 964 "menu.c" +#line 986 "menu.c" } SpiceCtrlMenu* spice_ctrl_menu_construct (GType object_type) { SpiceCtrlMenu * self = NULL; -#line 58 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 64 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" self = (SpiceCtrlMenu*) g_object_new (object_type, NULL); -#line 58 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 64 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return self; -#line 974 "menu.c" +#line 996 "menu.c" } SpiceCtrlMenu* spice_ctrl_menu_new (void) { -#line 58 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 64 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" return spice_ctrl_menu_construct (SPICE_CTRL_TYPE_MENU); -#line 981 "menu.c" +#line 1003 "menu.c" } static void spice_ctrl_menu_class_init (SpiceCtrlMenuClass * klass) { -#line 58 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 64 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" spice_ctrl_menu_parent_class = g_type_class_peek_parent (klass); -#line 58 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 64 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" G_OBJECT_CLASS (klass)->finalize = spice_ctrl_menu_finalize; -#line 990 "menu.c" +#line 1012 "menu.c" } @@ -996,13 +1018,13 @@ static void spice_ctrl_menu_finalize (GObject* obj) { SpiceCtrlMenu * self; -#line 58 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 64 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" self = SPICE_CTRL_MENU (obj); -#line 60 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 66 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" __g_list_free__g_object_unref0_0 (self->items); -#line 58 "/home/hans/projects/spice/spice-gtk/gtk/controller/menu.vala" +#line 64 "/home/elmarco/src/spice/spice-gtk-linux/gtk/controller/menu.vala" G_OBJECT_CLASS (spice_ctrl_menu_parent_class)->finalize (obj); -#line 1006 "menu.c" +#line 1028 "menu.c" } diff -Nru spice-gtk-0.9/gtk/controller/menu.vala spice-gtk-0.12/gtk/controller/menu.vala --- spice-gtk-0.9/gtk/controller/menu.vala 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/menu.vala 2012-04-11 13:51:02.000000000 +0000 @@ -28,6 +28,12 @@ public string accel; public SpiceProtocol.Controller.MenuFlags flags; + public MenuItem (int id, string text, SpiceProtocol.Controller.MenuFlags flags) { + this.id = id; + this.text = text; + this.flags = flags; + } + public MenuItem.from_string (string str) throws SpiceCtrl.Error { var params = str.split (SpiceProtocol.Controller.MENU_PARAM_DELIMITER); if (warn_if (params.length != 5)) diff -Nru spice-gtk-0.9/gtk/controller/namedpipelistener.c spice-gtk-0.12/gtk/controller/namedpipelistener.c --- spice-gtk-0.9/gtk/controller/namedpipelistener.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/namedpipelistener.c 2012-04-11 13:51:02.000000000 +0000 @@ -39,7 +39,7 @@ SpiceNamedPipeListener *listener = SPICE_NAMED_PIPE_LISTENER (object); SpiceNamedPipe *p; - while (p = g_queue_pop_head (&listener->priv->namedpipes)) + while ((p = g_queue_pop_head (&listener->priv->namedpipes)) != NULL) g_object_unref (p); g_return_if_fail (g_queue_get_length (&listener->priv->namedpipes) == 0); @@ -239,7 +239,6 @@ GSimpleAsyncResult *simple; ConnectData *c; SpiceNamedPipeConnection *connection; - gboolean success; g_return_val_if_fail (SPICE_IS_NAMED_PIPE_LISTENER (listener), NULL); g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), NULL); diff -Nru spice-gtk-0.9/gtk/controller/spice-controller.h spice-gtk-0.12/gtk/controller/spice-controller.h --- spice-gtk-0.9/gtk/controller/spice-controller.h 2011-10-10 09:39:24.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/spice-controller.h 2012-04-24 11:24:37.000000000 +0000 @@ -1,4 +1,4 @@ -/* spice-controller.h generated by valac 0.14.0, the Vala compiler, do not modify */ +/* spice-controller.h generated by valac 0.16.0, the Vala compiler, do not modify */ #ifndef __SPICE_CONTROLLER_H__ @@ -47,6 +47,17 @@ typedef struct _SpiceCtrlControllerClass SpiceCtrlControllerClass; typedef struct _SpiceCtrlControllerPrivate SpiceCtrlControllerPrivate; +#define SPICE_CTRL_TYPE_FOREIGN_MENU (spice_ctrl_foreign_menu_get_type ()) +#define SPICE_CTRL_FOREIGN_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPICE_CTRL_TYPE_FOREIGN_MENU, SpiceCtrlForeignMenu)) +#define SPICE_CTRL_FOREIGN_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SPICE_CTRL_TYPE_FOREIGN_MENU, SpiceCtrlForeignMenuClass)) +#define SPICE_CTRL_IS_FOREIGN_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SPICE_CTRL_TYPE_FOREIGN_MENU)) +#define SPICE_CTRL_IS_FOREIGN_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SPICE_CTRL_TYPE_FOREIGN_MENU)) +#define SPICE_CTRL_FOREIGN_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SPICE_CTRL_TYPE_FOREIGN_MENU, SpiceCtrlForeignMenuClass)) + +typedef struct _SpiceCtrlForeignMenu SpiceCtrlForeignMenu; +typedef struct _SpiceCtrlForeignMenuClass SpiceCtrlForeignMenuClass; +typedef struct _SpiceCtrlForeignMenuPrivate SpiceCtrlForeignMenuPrivate; + struct _SpiceCtrlMenuItem { GObject parent_instance; SpiceCtrlMenuItemPrivate * priv; @@ -85,15 +96,24 @@ GObjectClass parent_class; }; +struct _SpiceCtrlForeignMenu { + GObject parent_instance; + SpiceCtrlForeignMenuPrivate * priv; +}; + +struct _SpiceCtrlForeignMenuClass { + GObjectClass parent_class; +}; + GType spice_ctrl_menu_item_get_type (void) G_GNUC_CONST; GType spice_ctrl_menu_get_type (void) G_GNUC_CONST; +SpiceCtrlMenuItem* spice_ctrl_menu_item_new (gint id, const gchar* text, unsigned int flags); +SpiceCtrlMenuItem* spice_ctrl_menu_item_construct (GType object_type, gint id, const gchar* text, unsigned int flags); GQuark spice_ctrl_error_quark (void); SpiceCtrlMenuItem* spice_ctrl_menu_item_new_from_string (const gchar* str, GError** error); SpiceCtrlMenuItem* spice_ctrl_menu_item_construct_from_string (GType object_type, const gchar* str, GError** error); gchar* spice_ctrl_menu_item_to_string (SpiceCtrlMenuItem* self); -SpiceCtrlMenuItem* spice_ctrl_menu_item_new (void); -SpiceCtrlMenuItem* spice_ctrl_menu_item_construct (GType object_type); SpiceCtrlMenu* spice_ctrl_menu_find_id (SpiceCtrlMenu* self, gint id); SpiceCtrlMenu* spice_ctrl_menu_new_from_string (const gchar* str); SpiceCtrlMenu* spice_ctrl_menu_construct_from_string (GType object_type, const gchar* str); @@ -121,6 +141,25 @@ gchar** spice_ctrl_controller_get_secure_channels (SpiceCtrlController* self, int* result_length1); gchar** spice_ctrl_controller_get_disable_channels (SpiceCtrlController* self, int* result_length1); SpiceCtrlMenu* spice_ctrl_controller_get_menu (SpiceCtrlController* self); +gboolean spice_ctrl_controller_get_enable_smartcard (SpiceCtrlController* self); +gboolean spice_ctrl_controller_get_send_cad (SpiceCtrlController* self); +gchar** spice_ctrl_controller_get_disable_effects (SpiceCtrlController* self, int* result_length1); +guint32 spice_ctrl_controller_get_color_depth (SpiceCtrlController* self); +gboolean spice_ctrl_controller_get_enable_usbredir (SpiceCtrlController* self); +gboolean spice_ctrl_controller_get_enable_usb_autoshare (SpiceCtrlController* self); +const gchar* spice_ctrl_controller_get_usb_filter (SpiceCtrlController* self); +GType spice_ctrl_foreign_menu_get_type (void) G_GNUC_CONST; +SpiceCtrlForeignMenu* spice_ctrl_foreign_menu_new (void); +SpiceCtrlForeignMenu* spice_ctrl_foreign_menu_construct (GType object_type); +void spice_ctrl_foreign_menu_menu_item_click_msg (SpiceCtrlForeignMenu* self, gint32 item_id); +void spice_ctrl_foreign_menu_menu_item_checked_msg (SpiceCtrlForeignMenu* self, gint32 item_id, gboolean checked); +void spice_ctrl_foreign_menu_app_activated_msg (SpiceCtrlForeignMenu* self, gboolean activated); +void spice_ctrl_foreign_menu_send_msg (SpiceCtrlForeignMenu* self, guint8* p, int p_length1, GAsyncReadyCallback _callback_, gpointer _user_data_); +gboolean spice_ctrl_foreign_menu_send_msg_finish (SpiceCtrlForeignMenu* self, GAsyncResult* _res_, GError** error); +void spice_ctrl_foreign_menu_listen (SpiceCtrlForeignMenu* self, const gchar* addr, GAsyncReadyCallback _callback_, gpointer _user_data_); +void spice_ctrl_foreign_menu_listen_finish (SpiceCtrlForeignMenu* self, GAsyncResult* _res_, GError** error); +SpiceCtrlMenu* spice_ctrl_foreign_menu_get_menu (SpiceCtrlForeignMenu* self); +const gchar* spice_ctrl_foreign_menu_get_title (SpiceCtrlForeignMenu* self); G_END_DECLS diff -Nru spice-gtk-0.9/gtk/controller/spice-controller-listener.c spice-gtk-0.12/gtk/controller/spice-controller-listener.c --- spice-gtk-0.9/gtk/controller/spice-controller-listener.c 2012-01-27 08:56:56.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/spice-controller-listener.c 2012-04-11 13:51:02.000000000 +0000 @@ -63,7 +63,7 @@ if (addr == NULL) addr = g_strdup (g_getenv ("SPICE_XPI_NAMEDPIPE")); if (addr == NULL) - addr = g_strdup_printf ("\\\\.\\pipe\\SpiceController-%lu", GetCurrentProcessId ()); + addr = g_strdup_printf ("\\\\.\\pipe\\SpiceController-%" G_GUINT64_FORMAT, (guint64)GetCurrentProcessId ()); #else if (addr == NULL) addr = g_strdup (g_getenv ("SPICE_XPI_SOCKET")); @@ -142,8 +142,16 @@ g_return_val_if_fail(G_IS_OBJECT(listener), NULL); #ifdef G_OS_WIN32 - spice_named_pipe_listener_accept_finish (SPICE_NAMED_PIPE_LISTENER (listener), result, source_object, error); + SpiceNamedPipeConnection *np; + np = spice_named_pipe_listener_accept_finish (SPICE_NAMED_PIPE_LISTENER (listener), result, source_object, error); + if (np) + return G_IO_STREAM (np); #else - g_socket_listener_accept_finish (G_SOCKET_LISTENER (listener), result, source_object, error); + GSocketConnection *socket; + socket = g_socket_listener_accept_finish (G_SOCKET_LISTENER (listener), result, source_object, error); + if (socket) + return G_IO_STREAM (socket); #endif + + return NULL; } diff -Nru spice-gtk-0.9/gtk/controller/spice-foreign-menu-listener.c spice-gtk-0.12/gtk/controller/spice-foreign-menu-listener.c --- spice-gtk-0.9/gtk/controller/spice-foreign-menu-listener.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/spice-foreign-menu-listener.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,159 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2012 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#include +#include + +#include "spice-foreign-menu-listener.h" + +#ifdef G_OS_WIN32 +#include +#include "namedpipe.h" +#include "namedpipelistener.h" +#endif + +#ifdef G_OS_UNIX +#include +#endif + +/** + * SpiceForeignMenuListenerError: + * @SPICE_FOREIGN_MENU_LISTENER_ERROR_VALUE: invalid value. + * + * Possible errors of foreign menu listener related functions. + **/ + +/** + * SPICE_FOREIGN_MENU_LISTENER_ERROR: + * + * The error domain of the foreign menu listener subsystem. + **/ +GQuark +spice_foreign_menu_listener_error_quark (void) +{ + return g_quark_from_static_string ("spice-foreign-menu-listener-error"); +} + +GObject* +spice_foreign_menu_listener_new (const gchar *address, GError **error) +{ + GObject *listener = NULL; + gchar *addr = NULL; + + g_return_val_if_fail (error == NULL || *error == NULL, NULL); + + addr = g_strdup (address); + +#ifdef G_OS_WIN32 + if (addr == NULL) + addr = g_strdup (g_getenv ("SPICE_FOREIGN_MENU_NAMEDPIPE")); + if (addr == NULL) + addr = g_strdup_printf ("\\\\.\\pipe\\SpiceForeignMenu-%" G_GUINT64_FORMAT, (guint64)GetCurrentProcessId ()); +#else + if (addr == NULL) + addr = g_strdup (g_getenv ("SPICE_FOREIGN_MENU_SOCKET")); + if (addr == NULL) + addr = g_strdup_printf ("/tmp/SpiceForeignMenu-%" G_GUINT64_FORMAT ".uds", (guint64)getpid ()); +#endif + if (addr == NULL) { + g_set_error (error, + SPICE_FOREIGN_MENU_LISTENER_ERROR, + SPICE_FOREIGN_MENU_LISTENER_ERROR_VALUE, +#ifdef G_OS_WIN32 + "Missing namedpipe address" +#else + "Missing socket address" +#endif + ); + goto end; + } + + g_unlink (addr); + +#ifdef G_OS_WIN32 + { + SpiceNamedPipe *np; + + listener = G_OBJECT (spice_named_pipe_listener_new ()); + + np = spice_named_pipe_new (addr, error); + if (!np) { + g_object_unref (listener); + listener = NULL; + goto end; + } + + spice_named_pipe_listener_add_named_pipe (SPICE_NAMED_PIPE_LISTENER (listener), np); + } +#else + { + listener = G_OBJECT (g_socket_listener_new ()); + + if (!g_socket_listener_add_address (G_SOCKET_LISTENER (listener), + G_SOCKET_ADDRESS (g_unix_socket_address_new (addr)), + G_SOCKET_TYPE_STREAM, + G_SOCKET_PROTOCOL_DEFAULT, + NULL, + NULL, + error)) + g_warning ("failed to add address"); + } +#endif + +end: + g_free (addr); + return listener; +} + +void +spice_foreign_menu_listener_accept_async (GObject *listener, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_return_if_fail(G_IS_OBJECT(listener)); + +#ifdef G_OS_WIN32 + spice_named_pipe_listener_accept_async (SPICE_NAMED_PIPE_LISTENER (listener), cancellable, callback, user_data); +#else + g_socket_listener_accept_async (G_SOCKET_LISTENER (listener), cancellable, callback, user_data); +#endif +} + +GIOStream* +spice_foreign_menu_listener_accept_finish (GObject *listener, + GAsyncResult *result, + GObject **source_object, + GError **error) +{ + g_return_val_if_fail(G_IS_OBJECT(listener), NULL); + +#ifdef G_OS_WIN32 + SpiceNamedPipeConnection *np; + np = spice_named_pipe_listener_accept_finish (SPICE_NAMED_PIPE_LISTENER (listener), result, source_object, error); + if (np) + return G_IO_STREAM (np); +#else + GSocketConnection *socket; + socket = g_socket_listener_accept_finish (G_SOCKET_LISTENER (listener), result, source_object, error); + if (socket) + return G_IO_STREAM (socket); +#endif + + return NULL; +} diff -Nru spice-gtk-0.9/gtk/controller/spice-foreign-menu-listener.h spice-gtk-0.12/gtk/controller/spice-foreign-menu-listener.h --- spice-gtk-0.9/gtk/controller/spice-foreign-menu-listener.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/spice-foreign-menu-listener.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,47 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2012 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifndef __SPICE_FOREIGN_MENU_LISTENER_H__ +#define __SPICE_FOREIGN_MENU_LISTENER_H__ + +#include + +G_BEGIN_DECLS + +#define SPICE_FOREIGN_MENU_LISTENER_ERROR spice_foreign_menu_listener_error_quark () +GQuark spice_foreign_menu_listener_error_quark (void); + +typedef enum +{ + SPICE_FOREIGN_MENU_LISTENER_ERROR_VALUE /* incorrect value */ +} SpiceForeignMenuListenerError; + + +GObject* spice_foreign_menu_listener_new (const gchar *address, GError **error); + +void spice_foreign_menu_listener_accept_async (GObject *listener, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIOStream* spice_foreign_menu_listener_accept_finish (GObject *listener, + GAsyncResult *result, + GObject **source_object, + GError **error); +G_END_DECLS + +#endif /* __SPICE_FOREIGN_MENU_LISTENER_H__ */ diff -Nru spice-gtk-0.9/gtk/controller/test.c spice-gtk-0.12/gtk/controller/test.c --- spice-gtk-0.9/gtk/controller/test.c 2011-12-02 13:09:31.000000000 +0000 +++ spice-gtk-0.12/gtk/controller/test.c 2012-04-11 13:51:02.000000000 +0000 @@ -174,9 +174,9 @@ g_message ("notify::%s == ", pspec->name); while (*p) g_message ("%s", *p++); - } else if (pspec->value_type == G_TYPE_OBJECT) { + } else if (G_TYPE_IS_OBJECT(pspec->value_type)) { GObject *o = g_value_get_object (&value); - g_message ("notify::%s == %s", pspec->name, G_OBJECT_TYPE_NAME (o)); + g_message ("notify::%s == %s", pspec->name, o ? G_OBJECT_TYPE_NAME (o) : "null"); } else { g_value_transform (&value, &strvalue); g_message ("notify::%s = %s", pspec->name, g_value_get_string (&strvalue)); @@ -186,6 +186,19 @@ g_value_unset (&strvalue); } +void connect_signals (gpointer obj) +{ + guint i, n_ids = 0; + guint *ids = NULL; + GType type = G_OBJECT_TYPE (obj); + + ids = g_signal_list_ids (type, &n_ids); + for (i = 0; i < n_ids; i++) { + const gchar *name = g_signal_name (ids[i]); + g_signal_connect (obj, name, G_CALLBACK (signaled), (gpointer)name); + } +} + int main (int argc, char *argv[]) { int spicec_pid = (argc > 1 ? atoi (argv[1]) : 0); @@ -199,9 +212,7 @@ ctrl = spice_ctrl_controller_new (); loop = g_main_loop_new (NULL, FALSE); g_signal_connect (ctrl, "notify", G_CALLBACK (notified), NULL); - g_signal_connect (ctrl, "show", G_CALLBACK (signaled), "show"); - g_signal_connect (ctrl, "hide", G_CALLBACK (signaled), "hide"); - g_signal_connect (ctrl, "do_connect", G_CALLBACK (signaled), "do_connect"); + connect_signals (ctrl); #ifdef WIN32 snprintf (pipe_name, PIPE_NAME_MAX_LEN, PIPE_NAME, spicec_pid); diff -Nru spice-gtk-0.9/gtk/decode-glz.c spice-gtk-0.12/gtk/decode-glz.c --- spice-gtk-0.9/gtk/decode-glz.c 2012-01-15 19:43:53.000000000 +0000 +++ spice-gtk-0.12/gtk/decode-glz.c 2012-04-11 13:51:02.000000000 +0000 @@ -25,8 +25,7 @@ #include "spice-util.h" #include "decode.h" -/* spice/common */ -#include "canvas_utils.h" +#include "common/canvas_utils.h" struct glz_image_hdr { uint64_t id; @@ -142,8 +141,6 @@ struct glz_image *image = wait->window->images[slot]; gboolean ready = image && image->hdr.id == wait->id; - SPICE_DEBUG("image with slot %d: %s", slot, ready ? "yes" : "no"); - return ready; } diff -Nru spice-gtk-0.9/gtk/decode.h spice-gtk-0.12/gtk/decode.h --- spice-gtk-0.9/gtk/decode.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/decode.h 2012-04-11 13:51:02.000000000 +0000 @@ -19,7 +19,8 @@ # define SPICEGTK_DECODE_H_ #include -#include "canvas_base.h" + +#include "common/canvas_base.h" G_BEGIN_DECLS diff -Nru spice-gtk-0.9/gtk/display/gnome-rr.c spice-gtk-0.12/gtk/display/gnome-rr.c --- spice-gtk-0.9/gtk/display/gnome-rr.c 2012-01-17 10:04:30.000000000 +0000 +++ spice-gtk-0.12/gtk/display/gnome-rr.c 2012-04-11 13:51:02.000000000 +0000 @@ -195,7 +195,7 @@ g_free (info); } -gboolean +static gboolean has_similar_mode (GnomeRROutput *output, GnomeRRMode *mode) { int i; diff -Nru spice-gtk-0.9/gtk/generated_demarshallers1.c spice-gtk-0.12/gtk/generated_demarshallers1.c --- spice-gtk-0.9/gtk/generated_demarshallers1.c 2011-10-10 09:35:03.000000000 +0000 +++ spice-gtk-0.12/gtk/generated_demarshallers1.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,5843 +0,0 @@ -#include "messages.h" -#include -#include -#include -#include -#include -#include -#include "mem.h" - -#ifdef _MSC_VER -#pragma warning(disable:4101) -#endif - - - -#ifdef WORDS_BIGENDIAN -#define read_int8(ptr) (*((int8_t *)(ptr))) -#define write_int8(ptr, val) *(int8_t *)(ptr) = val -#define read_uint8(ptr) (*((uint8_t *)(ptr))) -#define write_uint8(ptr, val) *(uint8_t *)(ptr) = val -#define read_int16(ptr) ((int16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr))) -#define write_int16(ptr, val) *(uint16_t *)(ptr) = SPICE_BYTESWAP16((uint16_t)val) -#define read_uint16(ptr) ((uint16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr))) -#define write_uint16(ptr, val) *(uint16_t *)(ptr) = SPICE_BYTESWAP16((uint16_t)val) -#define read_int32(ptr) ((int32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr))) -#define write_int32(ptr, val) *(uint32_t *)(ptr) = SPICE_BYTESWAP32((uint32_t)val) -#define read_uint32(ptr) ((uint32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr))) -#define write_uint32(ptr, val) *(uint32_t *)(ptr) = SPICE_BYTESWAP32((uint32_t)val) -#define read_int64(ptr) ((int64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))) -#define write_int64(ptr, val) *(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val) -#define read_uint64(ptr) ((uint64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))) -#define write_uint64(ptr, val) *(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val) -#else -#define read_int8(ptr) (*((int8_t *)(ptr))) -#define write_int8(ptr, val) (*((int8_t *)(ptr))) = val -#define read_uint8(ptr) (*((uint8_t *)(ptr))) -#define write_uint8(ptr, val) (*((uint8_t *)(ptr))) = val -#define read_int16(ptr) (*((int16_t *)(ptr))) -#define write_int16(ptr, val) (*((int16_t *)(ptr))) = val -#define read_uint16(ptr) (*((uint16_t *)(ptr))) -#define write_uint16(ptr, val) (*((uint16_t *)(ptr))) = val -#define read_int32(ptr) (*((int32_t *)(ptr))) -#define write_int32(ptr, val) (*((int32_t *)(ptr))) = val -#define read_uint32(ptr) (*((uint32_t *)(ptr))) -#define write_uint32(ptr, val) (*((uint32_t *)(ptr))) = val -#define read_int64(ptr) (*((int64_t *)(ptr))) -#define write_int64(ptr, val) (*((int64_t *)(ptr))) = val -#define read_uint64(ptr) (*((uint64_t *)(ptr))) -#define write_uint64(ptr, val) (*((uint64_t *)(ptr))) = val -#endif - -static int8_t SPICE_GNUC_UNUSED consume_int8(uint8_t **ptr) -{ - int8_t val; - val = read_int8(*ptr); - *ptr += 1; - return val; -} - -static uint8_t SPICE_GNUC_UNUSED consume_uint8(uint8_t **ptr) -{ - uint8_t val; - val = read_uint8(*ptr); - *ptr += 1; - return val; -} - -static int16_t SPICE_GNUC_UNUSED consume_int16(uint8_t **ptr) -{ - int16_t val; - val = read_int16(*ptr); - *ptr += 2; - return val; -} - -static uint16_t SPICE_GNUC_UNUSED consume_uint16(uint8_t **ptr) -{ - uint16_t val; - val = read_uint16(*ptr); - *ptr += 2; - return val; -} - -static int32_t SPICE_GNUC_UNUSED consume_int32(uint8_t **ptr) -{ - int32_t val; - val = read_int32(*ptr); - *ptr += 4; - return val; -} - -static uint32_t SPICE_GNUC_UNUSED consume_uint32(uint8_t **ptr) -{ - uint32_t val; - val = read_uint32(*ptr); - *ptr += 4; - return val; -} - -static int64_t SPICE_GNUC_UNUSED consume_int64(uint8_t **ptr) -{ - int64_t val; - val = read_int64(*ptr); - *ptr += 8; - return val; -} - -static uint64_t SPICE_GNUC_UNUSED consume_uint64(uint8_t **ptr) -{ - uint64_t val; - val = read_uint64(*ptr); - *ptr += 8; - return val; -} - -typedef struct PointerInfo PointerInfo; -typedef void (*message_destructor_t)(uint8_t *message); -typedef uint8_t * (*parse_func_t)(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *ptr_info, int minor); -typedef uint8_t * (*parse_msg_func_t)(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size_out, message_destructor_t *free_message); -typedef uint8_t * (*spice_parse_channel_func_t)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message); - -struct PointerInfo { - uint64_t offset; - parse_func_t parse; - void * *dest; - uint32_t nelements; -}; - -static uint8_t * parse_msg_migrate(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgMigrate *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgMigrate); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMigrate); - in = start; - - out = (SpiceMsgMigrate *)data; - - out->flags = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static void nofree(uint8_t *data) -{ -} - -static uint8_t * parse_SpiceMsgData(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t data__nw_size; - uint32_t data__nelements; - - { /* data */ - data__nelements = message_end - (start + 0); - - data__nw_size = data__nelements; - } - - nw_size = 0 + data__nw_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = message_start; - *size = message_end - message_start; - *free_message = nofree; - return data; - -} - -static uint8_t * parse_msg_set_ack(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgSetAck *out; - - nw_size = 8; - mem_size = sizeof(SpiceMsgSetAck); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgSetAck); - in = start; - - out = (SpiceMsgSetAck *)data; - - out->generation = consume_uint32(&in); - out->window = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_ping(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t data__nw_size; - uint32_t data__nelements; - SpiceMsgPing *out; - - { /* data */ - data__nelements = message_end - (start + 12); - - data__nw_size = data__nelements; - } - - nw_size = 12 + data__nw_size; - mem_size = sizeof(SpiceMsgPing); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgPing); - in = start; - - out = (SpiceMsgPing *)data; - - out->id = consume_uint32(&in); - out->timestamp = consume_uint64(&in); - /* use array as pointer */ - out->data = (uint8_t *)in; - out->data_len = data__nelements; - in += data__nelements; - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_wait_for_channels(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t wait_list__nw_size, wait_list__mem_size; - uint32_t wait_list__nelements; - SpiceMsgWaitForChannels *out; - uint32_t i; - - { /* wait_list */ - uint8_t wait_count__value; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - wait_count__value = read_uint8(pos); - wait_list__nelements = wait_count__value; - - wait_list__nw_size = (10) * wait_list__nelements; - wait_list__mem_size = sizeof(SpiceWaitForChannel) * wait_list__nelements; - } - - nw_size = 1 + wait_list__nw_size; - mem_size = sizeof(SpiceMsgWaitForChannels) + wait_list__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgWaitForChannels); - in = start; - - out = (SpiceMsgWaitForChannels *)data; - - out->wait_count = consume_uint8(&in); - for (i = 0; i < wait_list__nelements; i++) { - SpiceWaitForChannel *out2; - out2 = (SpiceWaitForChannel *)end; - end += sizeof(SpiceWaitForChannel); - - out2->channel_type = consume_uint8(&in); - out2->channel_id = consume_uint8(&in); - out2->message_serial = consume_uint64(&in); - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_disconnecting(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgDisconnect *out; - - nw_size = 12; - mem_size = sizeof(SpiceMsgDisconnect); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisconnect); - in = start; - - out = (SpiceMsgDisconnect *)data; - - out->time_stamp = consume_uint64(&in); - out->reason = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_notify(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t message__nw_size, message__mem_size; - uint32_t message__nelements; - size_t zero__mem_size; - SpiceMsgNotify *out; - - { /* message */ - uint32_t message_len__value; - pos = start + 20; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - message_len__value = read_uint32(pos); - message__nelements = message_len__value; - - message__nw_size = message__nelements; - message__mem_size = sizeof(uint8_t) * message__nelements; - } - - { /* zero */ - zero__mem_size = sizeof(uint8_t); - } - - nw_size = 25 + message__nw_size; - mem_size = sizeof(SpiceMsgNotify) + message__mem_size + zero__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgNotify); - in = start; - - out = (SpiceMsgNotify *)data; - - out->time_stamp = consume_uint64(&in); - out->severity = consume_uint32(&in); - out->visibilty = consume_uint32(&in); - out->what = consume_uint32(&in); - out->message_len = consume_uint32(&in); - memcpy(out->message, in, message__nelements); - in += message__nelements; - end += message__nelements; - *(uint8_t *)end = consume_uint8(&in); - end += sizeof(uint8_t); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_migrate_begin(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t host_data__nw_size; - uint32_t host_data__nelements; - size_t pub_key_data__nw_size; - uint32_t pub_key_data__nelements; - SpiceMsgMainMigrationBegin *out; - - { /* host_data */ - uint32_t host_size__value; - pos = start + 8; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - host_size__value = read_uint32(pos); - host_data__nelements = host_size__value; - - host_data__nw_size = host_data__nelements; - } - - if (minor >= 1) { /* pub_key_data */ - uint32_t pub_key_size__value; - pos = start + 12 + ((minor >= 1)?6:0); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - pub_key_size__value = read_uint32(pos); - pub_key_data__nelements = pub_key_size__value; - - pub_key_data__nw_size = pub_key_data__nelements; - } else { /* minor < 1 */ - pub_key_data__nelements = 0; - pub_key_data__nw_size = 0; - } - - nw_size = 12 + ((minor >= 1)?10:0) + host_data__nw_size + pub_key_data__nw_size; - mem_size = sizeof(SpiceMsgMainMigrationBegin); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMainMigrationBegin); - in = start; - - out = (SpiceMsgMainMigrationBegin *)data; - - out->port = consume_uint16(&in); - out->sport = consume_uint16(&in); - consume_uint32(&in); - out->host_size = consume_uint32(&in); - if (minor >= 1) { - out->pub_key_type = consume_uint16(&in); - } else { - out->pub_key_type = 0; - } - if (minor >= 1) { - consume_uint32(&in); - } else { - } - if (minor >= 1) { - out->pub_key_size = consume_uint32(&in); - } else { - out->pub_key_size = 0; - } - /* use array as pointer */ - out->host_data = (uint8_t *)in; - in += host_data__nelements; - if (minor >= 1) { - /* use array as pointer */ - out->pub_key_data = (uint8_t *)in; - in += pub_key_data__nelements; - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_SpiceMsgEmpty(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - - nw_size = 0; - mem_size = sizeof(SpiceMsgEmpty); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgEmpty); - in = start; - - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgMainInit *out; - - nw_size = 32; - mem_size = sizeof(SpiceMsgMainInit); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMainInit); - in = start; - - out = (SpiceMsgMainInit *)data; - - out->session_id = consume_uint32(&in); - out->display_channels_hint = consume_uint32(&in); - out->supported_mouse_modes = consume_uint32(&in); - out->current_mouse_mode = consume_uint32(&in); - out->agent_connected = consume_uint32(&in); - out->agent_tokens = consume_uint32(&in); - out->multi_media_time = consume_uint32(&in); - out->ram_hint = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_channels_list(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t channels__nw_size, channels__mem_size; - uint32_t channels__nelements; - SpiceMsgChannels *out; - uint32_t i; - - { /* channels */ - uint32_t num_of_channels__value; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_of_channels__value = read_uint32(pos); - channels__nelements = num_of_channels__value; - - channels__nw_size = (2) * channels__nelements; - channels__mem_size = sizeof(SpiceChannelId) * channels__nelements; - } - - nw_size = 4 + channels__nw_size; - mem_size = sizeof(SpiceMsgChannels) + channels__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgChannels); - in = start; - - out = (SpiceMsgChannels *)data; - - out->num_of_channels = consume_uint32(&in); - for (i = 0; i < channels__nelements; i++) { - SpiceChannelId *out2; - out2 = (SpiceChannelId *)end; - end += sizeof(SpiceChannelId); - - out2->type = consume_uint8(&in); - out2->id = consume_uint8(&in); - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_mouse_mode(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgMainMouseMode *out; - - nw_size = 8; - mem_size = sizeof(SpiceMsgMainMouseMode); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMainMouseMode); - in = start; - - out = (SpiceMsgMainMouseMode *)data; - - out->supported_modes = consume_uint32(&in); - out->current_mode = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_multi_media_time(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgMainMultiMediaTime *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgMainMultiMediaTime); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMainMultiMediaTime); - in = start; - - out = (SpiceMsgMainMultiMediaTime *)data; - - out->time = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_agent_disconnected(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgMainAgentDisconnect *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgMainAgentDisconnect); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMainAgentDisconnect); - in = start; - - out = (SpiceMsgMainAgentDisconnect *)data; - - out->error_code = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_agent_token(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgMainAgentTokens *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgMainAgentTokens); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMainAgentTokens); - in = start; - - out = (SpiceMsgMainAgentTokens *)data; - - out->num_tokens = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_migrate_switch_host(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t host_data__nw_size; - uint32_t host_data__nelements; - size_t cert_subject_data__nw_size; - uint32_t cert_subject_data__nelements; - SpiceMsgMainMigrationSwitchHost *out; - - { /* host_data */ - uint32_t host_size__value; - pos = start + 8; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - host_size__value = read_uint32(pos); - host_data__nelements = host_size__value; - - host_data__nw_size = host_data__nelements; - } - - { /* cert_subject_data */ - uint32_t cert_subject_size__value; - pos = start + 16; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - cert_subject_size__value = read_uint32(pos); - cert_subject_data__nelements = cert_subject_size__value; - - cert_subject_data__nw_size = cert_subject_data__nelements; - } - - nw_size = 20 + host_data__nw_size + cert_subject_data__nw_size; - mem_size = sizeof(SpiceMsgMainMigrationSwitchHost); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMainMigrationSwitchHost); - in = start; - - out = (SpiceMsgMainMigrationSwitchHost *)data; - - out->port = consume_uint16(&in); - out->sport = consume_uint16(&in); - consume_uint32(&in); - out->host_size = consume_uint32(&in); - consume_uint32(&in); - out->cert_subject_size = consume_uint32(&in); - /* use array as pointer */ - out->host_data = (uint8_t *)in; - in += host_data__nelements; - /* use array as pointer */ - out->cert_subject_data = (uint8_t *)in; - in += cert_subject_data__nelements; - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_MainChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[11] = { - parse_msg_main_migrate_begin, - parse_SpiceMsgEmpty, - parse_msg_main_init, - parse_msg_main_channels_list, - parse_msg_main_mouse_mode, - parse_msg_main_multi_media_time, - parse_SpiceMsgEmpty, - parse_msg_main_agent_disconnected, - parse_SpiceMsgData, - parse_msg_main_agent_token, - parse_msg_main_migrate_switch_host - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 112) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} - - - -static uint8_t * parse_msg_display_mode(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgDisplayMode *out; - - nw_size = 12; - mem_size = sizeof(SpiceMsgDisplayMode); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayMode); - in = start; - - out = (SpiceMsgDisplayMode *)data; - - out->x_res = consume_uint32(&in); - out->y_res = consume_uint32(&in); - out->bits = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static intptr_t validate_SpiceClipRects(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) -{ - uint8_t *start = message_start + offset; - SPICE_GNUC_UNUSED uint8_t *pos; - size_t mem_size, nw_size; - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - - if (offset == 0) { - return 0; - } - - if (SPICE_UNLIKELY(start >= message_end)) { - goto error; - } - - { /* rects */ - uint32_t num_rects__value; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - nw_size = 4 + rects__nw_size; - mem_size = sizeof(SpiceClipRects) + rects__mem_size; - - /* Check if struct fits in reported side */ - if (SPICE_UNLIKELY(start + nw_size > message_end)) { - goto error; - } - return mem_size; - - error: - return -1; -} - -static uint8_t * parse_struct_SpiceClipRects(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) -{ - uint8_t *in = message_start + this_ptr_info->offset; - uint8_t *end; - SpiceClipRects *out; - uint32_t rects__nelements; - uint32_t i; - - end = struct_data + sizeof(SpiceClipRects); - out = (SpiceClipRects *)struct_data; - - out->num_rects = consume_uint32(&in); - rects__nelements = out->num_rects; - for (i = 0; i < rects__nelements; i++) { - SpiceRect *out2; - out2 = (SpiceRect *)end; - end += sizeof(SpiceRect); - - out2->top = consume_int32(&in); - out2->left = consume_int32(&in); - out2->bottom = consume_int32(&in); - out2->right = consume_int32(&in); - } - return end; -} - -static uint8_t * parse_msg_display_copy_bits(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[1]; - size_t base__extra_size; - SpiceMsgDisplayCopyBits *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start3 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - base__extra_size = clip__extra_size; - } - - nw_size = 36; - mem_size = sizeof(SpiceMsgDisplayCopyBits) + base__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayCopyBits); - in = start; - - out = (SpiceMsgDisplayCopyBits *)data; - - /* base */ { - out->base.surface_id = 0; - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint32(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - } - /* src_pos */ { - out->src_pos.x = consume_int32(&in); - out->src_pos.y = consume_int32(&in); - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_inval_list(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t resources__nw_size, resources__mem_size; - uint32_t resources__nelements; - SpiceResourceList *out; - uint32_t i; - - { /* resources */ - uint16_t count__value; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - count__value = read_uint16(pos); - resources__nelements = count__value; - - resources__nw_size = (9) * resources__nelements; - resources__mem_size = sizeof(SpiceResourceID) * resources__nelements; - } - - nw_size = 2 + resources__nw_size; - mem_size = sizeof(SpiceResourceList) + resources__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceResourceList); - in = start; - - out = (SpiceResourceList *)data; - - out->count = consume_uint16(&in); - for (i = 0; i < resources__nelements; i++) { - SpiceResourceID *out2; - out2 = (SpiceResourceID *)end; - end += sizeof(SpiceResourceID); - - out2->type = consume_uint8(&in); - out2->id = consume_uint64(&in); - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_inval_all_pixmaps(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t wait_list__nw_size, wait_list__mem_size; - uint32_t wait_list__nelements; - SpiceMsgWaitForChannels *out; - uint32_t i; - - { /* wait_list */ - uint8_t wait_count__value; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - wait_count__value = read_uint8(pos); - wait_list__nelements = wait_count__value; - - wait_list__nw_size = (10) * wait_list__nelements; - wait_list__mem_size = sizeof(SpiceWaitForChannel) * wait_list__nelements; - } - - nw_size = 1 + wait_list__nw_size; - mem_size = sizeof(SpiceMsgWaitForChannels) + wait_list__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgWaitForChannels); - in = start; - - out = (SpiceMsgWaitForChannels *)data; - - out->wait_count = consume_uint8(&in); - for (i = 0; i < wait_list__nelements; i++) { - SpiceWaitForChannel *out2; - out2 = (SpiceWaitForChannel *)end; - end += sizeof(SpiceWaitForChannel); - - out2->channel_type = consume_uint8(&in); - out2->channel_id = consume_uint8(&in); - out2->message_serial = consume_uint64(&in); - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_inval_palette(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgDisplayInvalOne *out; - - nw_size = 8; - mem_size = sizeof(SpiceMsgDisplayInvalOne); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayInvalOne); - in = start; - - out = (SpiceMsgDisplayInvalOne *)data; - - out->id = consume_uint64(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_stream_create(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[1]; - size_t clip__extra_size; - SpiceMsgDisplayStreamCreate *out; - uint32_t i; - - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 52); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start2 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start2 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - nw_size = 64; - mem_size = sizeof(SpiceMsgDisplayStreamCreate) + clip__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayStreamCreate); - in = start; - - out = (SpiceMsgDisplayStreamCreate *)data; - - out->surface_id = 0; - out->id = consume_uint32(&in); - out->flags = consume_uint32(&in); - out->codec_type = consume_uint32(&in); - out->stamp = consume_uint64(&in); - out->stream_width = consume_uint32(&in); - out->stream_height = consume_uint32(&in); - out->src_width = consume_uint32(&in); - out->src_height = consume_uint32(&in); - /* dest */ { - out->dest.top = consume_int32(&in); - out->dest.left = consume_int32(&in); - out->dest.bottom = consume_int32(&in); - out->dest.right = consume_int32(&in); - } - /* clip */ { - out->clip.type = consume_uint32(&in); - if (out->clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_stream_data(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t data__nw_size, data__mem_size; - uint32_t data__nelements; - SpiceMsgDisplayStreamData *out; - - { /* data */ - uint32_t data_size__value; - pos = start + 8; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - data_size__value = read_uint32(pos); - data__nelements = data_size__value; - - data__nw_size = data__nelements; - data__mem_size = sizeof(uint8_t) * data__nelements; - } - - nw_size = 16 + data__nw_size; - mem_size = sizeof(SpiceMsgDisplayStreamData) + data__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayStreamData); - in = start; - - out = (SpiceMsgDisplayStreamData *)data; - - out->id = consume_uint32(&in); - out->multi_media_time = consume_uint32(&in); - out->data_size = consume_uint32(&in); - consume_uint32(&in); - memcpy(out->data, in, data__nelements); - in += data__nelements; - end += data__nelements; - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_stream_clip(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[1]; - size_t clip__extra_size; - SpiceMsgDisplayStreamClip *out; - uint32_t i; - - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 4); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start2 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start2 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - nw_size = 16; - mem_size = sizeof(SpiceMsgDisplayStreamClip) + clip__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayStreamClip); - in = start; - - out = (SpiceMsgDisplayStreamClip *)data; - - out->id = consume_uint32(&in); - /* clip */ { - out->clip.type = consume_uint32(&in); - if (out->clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_stream_destroy(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgDisplayStreamDestroy *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgDisplayStreamDestroy); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayStreamDestroy); - in = start; - - out = (SpiceMsgDisplayStreamDestroy *)data; - - out->id = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static intptr_t validate_SpicePalette(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) -{ - uint8_t *start = message_start + offset; - SPICE_GNUC_UNUSED uint8_t *pos; - size_t mem_size, nw_size; - size_t ents__nw_size, ents__mem_size; - uint32_t ents__nelements; - - if (offset == 0) { - return 0; - } - - if (SPICE_UNLIKELY(start >= message_end)) { - goto error; - } - - { /* ents */ - uint16_t num_ents__value; - pos = start + 8; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - num_ents__value = read_uint16(pos); - ents__nelements = num_ents__value; - - ents__nw_size = (4) * ents__nelements; - ents__mem_size = sizeof(uint32_t) * ents__nelements; - } - - nw_size = 10 + ents__nw_size; - mem_size = sizeof(SpicePalette) + ents__mem_size; - - /* Check if struct fits in reported side */ - if (SPICE_UNLIKELY(start + nw_size > message_end)) { - goto error; - } - return mem_size; - - error: - return -1; -} - -static intptr_t validate_SpiceImage(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) -{ - uint8_t *start = message_start + offset; - SPICE_GNUC_UNUSED uint8_t *pos; - size_t mem_size, nw_size; - SPICE_GNUC_UNUSED intptr_t ptr_size; - size_t u__nw_size, u__extra_size; - uint8_t descriptor_type__value; - - if (offset == 0) { - return 0; - } - - if (SPICE_UNLIKELY(start >= message_end)) { - goto error; - } - - { /* u */ - pos = start + 8; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - descriptor_type__value = read_uint8(pos); - if (descriptor_type__value == SPICE_IMAGE_TYPE_BITMAP) { - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); - size_t pal__extra_size; - uint8_t flags__value; - size_t data__extra_size; - uint32_t data__array__nelements; - { /* pal */ - pos = start2 + 1; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - flags__value = read_uint8(pos); - if ((flags__value & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { - pal__extra_size = 0; - } else if (1) { - uint64_t pal_palette__value; - pos = (start2 + 14); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - pal_palette__value = read_uint64(pos); - ptr_size = validate_SpicePalette(message_start, message_end, pal_palette__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pal__extra_size = ptr_size + /* for alignment */ 3; - } else { - pal__extra_size = 0; - } - - } - - { /* data */ - uint64_t data__value; - uint32_t data__array__nw_size; - uint32_t stride__value; - uint32_t y__value; - pos = (start2 + 22); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - data__value = read_uint64(pos); - if (SPICE_UNLIKELY(message_start + data__value >= message_end)) { - goto error; - } - pos = start2 + 10; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - stride__value = read_uint32(pos); - pos = start2 + 6; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - y__value = read_uint32(pos); - data__array__nelements = stride__value * y__value; - - data__array__nw_size = data__array__nelements; - if (SPICE_UNLIKELY(message_start + data__value + data__array__nw_size > message_end)) { - goto error; - } - data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); - } - - u__nw_size = 30; - u__extra_size = pal__extra_size + data__extra_size; - } else if (descriptor_type__value == SPICE_IMAGE_TYPE_QUIC) { - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); - size_t data__nw_size, data__extra_size; - uint32_t data__nelements; - { /* data */ - uint32_t data_size__value; - pos = start2 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - data_size__value = read_uint32(pos); - data__nelements = data_size__value; - - data__nw_size = data__nelements; - data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); - } - - u__nw_size = 4 + data__nw_size; - u__extra_size = data__extra_size; - } else if (descriptor_type__value == SPICE_IMAGE_TYPE_LZ_RGB || descriptor_type__value == SPICE_IMAGE_TYPE_GLZ_RGB) { - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); - size_t data__nw_size, data__extra_size; - uint32_t data__nelements; - { /* data */ - uint32_t data_size__value; - pos = start2 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - data_size__value = read_uint32(pos); - data__nelements = data_size__value; - - data__nw_size = data__nelements; - data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); - } - - u__nw_size = 4 + data__nw_size; - u__extra_size = data__extra_size; - } else if (descriptor_type__value == SPICE_IMAGE_TYPE_LZ_PLT) { - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); - size_t pal__extra_size; - uint8_t flags__value; - size_t data__nw_size, data__extra_size; - uint32_t data__nelements; - { /* pal */ - pos = start2 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - flags__value = read_uint8(pos); - if ((flags__value & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { - pal__extra_size = 0; - } else if (1) { - uint64_t pal_palette__value; - pos = (start2 + 5); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - pal_palette__value = read_uint64(pos); - if (SPICE_UNLIKELY(pal_palette__value == 0)) { - goto error; - } - ptr_size = validate_SpicePalette(message_start, message_end, pal_palette__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pal__extra_size = ptr_size + /* for alignment */ 3; - } else { - pal__extra_size = 0; - } - - } - - { /* data */ - uint32_t data_size__value; - pos = start2 + 1; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - data_size__value = read_uint32(pos); - data__nelements = data_size__value; - - data__nw_size = data__nelements; - data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); - } - - u__nw_size = 13 + data__nw_size; - u__extra_size = pal__extra_size + data__extra_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - nw_size = 18 + u__nw_size; - mem_size = sizeof(SpiceImage) + u__extra_size; - - /* Check if struct fits in reported side */ - if (SPICE_UNLIKELY(start + nw_size > message_end)) { - goto error; - } - return mem_size; - - error: - return -1; -} - -static uint8_t * parse_struct_SpicePalette(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) -{ - uint8_t *in = message_start + this_ptr_info->offset; - uint8_t *end; - SpicePalette *out; - uint32_t ents__nelements; - uint32_t i; - - end = struct_data + sizeof(SpicePalette); - out = (SpicePalette *)struct_data; - - out->unique = consume_uint64(&in); - out->num_ents = consume_uint16(&in); - ents__nelements = out->num_ents; - for (i = 0; i < ents__nelements; i++) { - out->ents[i] = consume_uint32(&in); - end += sizeof(uint32_t); - } - return end; -} - -static uint8_t * parse_struct_SpiceImage(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) -{ - uint8_t *in = message_start + this_ptr_info->offset; - uint8_t *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[2]; - SpiceImage *out; - uint32_t i; - - end = struct_data + sizeof(SpiceImage); - out = (SpiceImage *)struct_data; - - /* descriptor */ { - out->descriptor.id = consume_uint64(&in); - out->descriptor.type = consume_uint8(&in); - out->descriptor.flags = consume_uint8(&in); - out->descriptor.width = consume_uint32(&in); - out->descriptor.height = consume_uint32(&in); - } - if (out->descriptor.type == SPICE_IMAGE_TYPE_BITMAP) { - uint32_t data__array__nelements; - SpiceChunks *chunks; - out->u.bitmap.format = consume_uint8(&in); - out->u.bitmap.flags = consume_uint8(&in); - out->u.bitmap.x = consume_uint32(&in); - out->u.bitmap.y = consume_uint32(&in); - out->u.bitmap.stride = consume_uint32(&in); - if ((out->u.bitmap.flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { - out->u.bitmap.palette_id = consume_uint64(&in); - } else if (1) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpicePalette; - ptr_info[n_ptr].dest = (void **)&out->u.bitmap.palette; - n_ptr++; - } - data__array__nelements = out->u.bitmap.stride * out->u.bitmap.y; - /* Reuse data from network message as chunk */ - chunks = (SpiceChunks *)end; - end += sizeof(SpiceChunks) + sizeof(SpiceChunk); - out->u.bitmap.data = chunks; - chunks->data_size = data__array__nelements; - chunks->flags = 0; - chunks->num_chunks = 1; - chunks->chunk[0].len = data__array__nelements; - chunks->chunk[0].data = message_start + consume_uint64(&in); - } else if (out->descriptor.type == SPICE_IMAGE_TYPE_QUIC) { - uint32_t data__nelements; - SpiceChunks *chunks; - out->u.quic.data_size = consume_uint32(&in); - data__nelements = out->u.quic.data_size; - /* use array as chunk */ - chunks = (SpiceChunks *)end; - end += sizeof(SpiceChunks) + sizeof(SpiceChunk); - out->u.quic.data = chunks; - chunks->data_size = data__nelements; - chunks->flags = 0; - chunks->num_chunks = 1; - chunks->chunk[0].len = data__nelements; - chunks->chunk[0].data = in; - in += data__nelements; - } else if (out->descriptor.type == SPICE_IMAGE_TYPE_LZ_RGB || out->descriptor.type == SPICE_IMAGE_TYPE_GLZ_RGB) { - uint32_t data__nelements; - SpiceChunks *chunks; - out->u.lz_rgb.data_size = consume_uint32(&in); - data__nelements = out->u.lz_rgb.data_size; - /* use array as chunk */ - chunks = (SpiceChunks *)end; - end += sizeof(SpiceChunks) + sizeof(SpiceChunk); - out->u.lz_rgb.data = chunks; - chunks->data_size = data__nelements; - chunks->flags = 0; - chunks->num_chunks = 1; - chunks->chunk[0].len = data__nelements; - chunks->chunk[0].data = in; - in += data__nelements; - } else if (out->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) { - uint32_t data__nelements; - SpiceChunks *chunks; - out->u.lz_plt.flags = consume_uint8(&in); - out->u.lz_plt.data_size = consume_uint32(&in); - if ((out->u.lz_plt.flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { - out->u.lz_plt.palette_id = consume_uint64(&in); - } else if (1) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpicePalette; - ptr_info[n_ptr].dest = (void **)&out->u.lz_plt.palette; - n_ptr++; - } - data__nelements = out->u.lz_plt.data_size; - /* use array as chunk */ - chunks = (SpiceChunks *)end; - end += sizeof(SpiceChunks) + sizeof(SpiceChunk); - out->u.lz_plt.data = chunks; - chunks->data_size = data__nelements; - chunks->flags = 0; - chunks->num_chunks = 1; - chunks->chunk[0].len = data__nelements; - chunks->chunk[0].data = in; - in += data__nelements; - } - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - return end; - - error: - return NULL; -} - -static uint8_t * parse_msg_display_draw_fill(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[3]; - size_t base__extra_size; - size_t data__extra_size; - SpiceMsgDisplayDrawFill *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start3 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); - size_t brush__extra_size; - size_t mask__extra_size; - { /* brush */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_BRUSH_TYPE_SOLID) { - u__extra_size = 0; - } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 4); - size_t pat__extra_size; - { /* pat */ - uint64_t pat__value; - pos = (start4 + 0); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - pat__value = read_uint64(pos); - if (SPICE_UNLIKELY(pat__value == 0)) { - goto error; - } - ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pat__extra_size = ptr_size + /* for alignment */ 3; - } - - u__extra_size = pat__extra_size; - } else { - u__extra_size = 0; - } - - } - - brush__extra_size = u__extra_size; - } - - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 22); - size_t bitmap__extra_size; - { /* bitmap */ - uint64_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - bitmap__value = read_uint64(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__extra_size = brush__extra_size + mask__extra_size; - } - - nw_size = 67; - mem_size = sizeof(SpiceMsgDisplayDrawFill) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawFill); - in = start; - - out = (SpiceMsgDisplayDrawFill *)data; - - /* base */ { - out->base.surface_id = 0; - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint32(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - } - /* data */ { - /* brush */ { - uint8_t *in_save; - out->data.brush.type = consume_uint32(&in); - in_save = in; - if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { - out->data.brush.u.color = consume_uint32(&in); - } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; - n_ptr++; - /* pos */ { - out->data.brush.u.pattern.pos.x = consume_int32(&in); - out->data.brush.u.pattern.pos.y = consume_int32(&in); - } - } - in = in_save + 16; - } - out->data.rop_descriptor = consume_uint16(&in); - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_opaque(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[4]; - size_t base__extra_size; - size_t data__extra_size; - SpiceMsgDisplayDrawOpaque *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start3 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); - size_t src_bitmap__extra_size; - size_t brush__extra_size; - size_t mask__extra_size; - { /* src_bitmap */ - uint64_t src_bitmap__value; - pos = (start2 + 0); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - src_bitmap__value = read_uint64(pos); - ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - src_bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - { /* brush */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 24); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_BRUSH_TYPE_SOLID) { - u__extra_size = 0; - } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 4); - size_t pat__extra_size; - { /* pat */ - uint64_t pat__value; - pos = (start4 + 0); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - pat__value = read_uint64(pos); - if (SPICE_UNLIKELY(pat__value == 0)) { - goto error; - } - ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pat__extra_size = ptr_size + /* for alignment */ 3; - } - - u__extra_size = pat__extra_size; - } else { - u__extra_size = 0; - } - - } - - brush__extra_size = u__extra_size; - } - - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 47); - size_t bitmap__extra_size; - { /* bitmap */ - uint64_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - bitmap__value = read_uint64(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__extra_size = src_bitmap__extra_size + brush__extra_size + mask__extra_size; - } - - nw_size = 92; - mem_size = sizeof(SpiceMsgDisplayDrawOpaque) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawOpaque); - in = start; - - out = (SpiceMsgDisplayDrawOpaque *)data; - - /* base */ { - out->base.surface_id = 0; - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint32(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - } - /* data */ { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; - n_ptr++; - /* src_area */ { - out->data.src_area.top = consume_int32(&in); - out->data.src_area.left = consume_int32(&in); - out->data.src_area.bottom = consume_int32(&in); - out->data.src_area.right = consume_int32(&in); - } - /* brush */ { - uint8_t *in_save; - out->data.brush.type = consume_uint32(&in); - in_save = in; - if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { - out->data.brush.u.color = consume_uint32(&in); - } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; - n_ptr++; - /* pos */ { - out->data.brush.u.pattern.pos.x = consume_int32(&in); - out->data.brush.u.pattern.pos.y = consume_int32(&in); - } - } - in = in_save + 16; - } - out->data.rop_descriptor = consume_uint16(&in); - out->data.scale_mode = consume_uint8(&in); - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_copy(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[3]; - size_t base__extra_size; - size_t data__extra_size; - SpiceMsgDisplayDrawCopy *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start3 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); - size_t src_bitmap__extra_size; - size_t mask__extra_size; - { /* src_bitmap */ - uint64_t src_bitmap__value; - pos = (start2 + 0); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - src_bitmap__value = read_uint64(pos); - ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - src_bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 27); - size_t bitmap__extra_size; - { /* bitmap */ - uint64_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - bitmap__value = read_uint64(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__extra_size = src_bitmap__extra_size + mask__extra_size; - } - - nw_size = 72; - mem_size = sizeof(SpiceMsgDisplayDrawCopy) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawCopy); - in = start; - - out = (SpiceMsgDisplayDrawCopy *)data; - - /* base */ { - out->base.surface_id = 0; - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint32(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - } - /* data */ { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; - n_ptr++; - /* src_area */ { - out->data.src_area.top = consume_int32(&in); - out->data.src_area.left = consume_int32(&in); - out->data.src_area.bottom = consume_int32(&in); - out->data.src_area.right = consume_int32(&in); - } - out->data.rop_descriptor = consume_uint16(&in); - out->data.scale_mode = consume_uint8(&in); - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_blend(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[3]; - size_t base__extra_size; - size_t data__extra_size; - SpiceMsgDisplayDrawBlend *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start3 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); - size_t src_bitmap__extra_size; - size_t mask__extra_size; - { /* src_bitmap */ - uint64_t src_bitmap__value; - pos = (start2 + 0); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - src_bitmap__value = read_uint64(pos); - ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - src_bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 27); - size_t bitmap__extra_size; - { /* bitmap */ - uint64_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - bitmap__value = read_uint64(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__extra_size = src_bitmap__extra_size + mask__extra_size; - } - - nw_size = 72; - mem_size = sizeof(SpiceMsgDisplayDrawBlend) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawBlend); - in = start; - - out = (SpiceMsgDisplayDrawBlend *)data; - - /* base */ { - out->base.surface_id = 0; - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint32(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - } - /* data */ { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; - n_ptr++; - /* src_area */ { - out->data.src_area.top = consume_int32(&in); - out->data.src_area.left = consume_int32(&in); - out->data.src_area.bottom = consume_int32(&in); - out->data.src_area.right = consume_int32(&in); - } - out->data.rop_descriptor = consume_uint16(&in); - out->data.scale_mode = consume_uint8(&in); - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_blackness(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[2]; - size_t base__extra_size; - size_t data__extra_size; - SpiceMsgDisplayDrawBlackness *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start3 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); - size_t mask__extra_size; - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); - size_t bitmap__extra_size; - { /* bitmap */ - uint64_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - bitmap__value = read_uint64(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__extra_size = mask__extra_size; - } - - nw_size = 45; - mem_size = sizeof(SpiceMsgDisplayDrawBlackness) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawBlackness); - in = start; - - out = (SpiceMsgDisplayDrawBlackness *)data; - - /* base */ { - out->base.surface_id = 0; - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint32(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - } - /* data */ { - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_whiteness(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[2]; - size_t base__extra_size; - size_t data__extra_size; - SpiceMsgDisplayDrawWhiteness *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start3 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); - size_t mask__extra_size; - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); - size_t bitmap__extra_size; - { /* bitmap */ - uint64_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - bitmap__value = read_uint64(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__extra_size = mask__extra_size; - } - - nw_size = 45; - mem_size = sizeof(SpiceMsgDisplayDrawWhiteness) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawWhiteness); - in = start; - - out = (SpiceMsgDisplayDrawWhiteness *)data; - - /* base */ { - out->base.surface_id = 0; - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint32(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - } - /* data */ { - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_invers(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[2]; - size_t base__extra_size; - size_t data__extra_size; - SpiceMsgDisplayDrawInvers *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start3 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); - size_t mask__extra_size; - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); - size_t bitmap__extra_size; - { /* bitmap */ - uint64_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - bitmap__value = read_uint64(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__extra_size = mask__extra_size; - } - - nw_size = 45; - mem_size = sizeof(SpiceMsgDisplayDrawInvers) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawInvers); - in = start; - - out = (SpiceMsgDisplayDrawInvers *)data; - - /* base */ { - out->base.surface_id = 0; - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint32(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - } - /* data */ { - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_rop3(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[4]; - size_t base__extra_size; - size_t data__extra_size; - SpiceMsgDisplayDrawRop3 *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start3 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); - size_t src_bitmap__extra_size; - size_t brush__extra_size; - size_t mask__extra_size; - { /* src_bitmap */ - uint64_t src_bitmap__value; - pos = (start2 + 0); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - src_bitmap__value = read_uint64(pos); - ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - src_bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - { /* brush */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 24); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_BRUSH_TYPE_SOLID) { - u__extra_size = 0; - } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 4); - size_t pat__extra_size; - { /* pat */ - uint64_t pat__value; - pos = (start4 + 0); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - pat__value = read_uint64(pos); - if (SPICE_UNLIKELY(pat__value == 0)) { - goto error; - } - ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pat__extra_size = ptr_size + /* for alignment */ 3; - } - - u__extra_size = pat__extra_size; - } else { - u__extra_size = 0; - } - - } - - brush__extra_size = u__extra_size; - } - - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 46); - size_t bitmap__extra_size; - { /* bitmap */ - uint64_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - bitmap__value = read_uint64(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__extra_size = src_bitmap__extra_size + brush__extra_size + mask__extra_size; - } - - nw_size = 91; - mem_size = sizeof(SpiceMsgDisplayDrawRop3) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawRop3); - in = start; - - out = (SpiceMsgDisplayDrawRop3 *)data; - - /* base */ { - out->base.surface_id = 0; - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint32(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - } - /* data */ { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; - n_ptr++; - /* src_area */ { - out->data.src_area.top = consume_int32(&in); - out->data.src_area.left = consume_int32(&in); - out->data.src_area.bottom = consume_int32(&in); - out->data.src_area.right = consume_int32(&in); - } - /* brush */ { - uint8_t *in_save; - out->data.brush.type = consume_uint32(&in); - in_save = in; - if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { - out->data.brush.u.color = consume_uint32(&in); - } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; - n_ptr++; - /* pos */ { - out->data.brush.u.pattern.pos.x = consume_int32(&in); - out->data.brush.u.pattern.pos.y = consume_int32(&in); - } - } - in = in_save + 16; - } - out->data.rop3 = consume_uint8(&in); - out->data.scale_mode = consume_uint8(&in); - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static intptr_t validate_SpicePath(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) -{ - uint8_t *start = message_start + offset; - SPICE_GNUC_UNUSED uint8_t *pos; - size_t mem_size, nw_size; - size_t segments__nw_size, segments__mem_size; - uint32_t segments__nelements; - uint32_t segments__nbytes; - - if (offset == 0) { - return 0; - } - - if (SPICE_UNLIKELY(start >= message_end)) { - goto error; - } - - { /* segments */ - uint32_t segments_size__value; - uint8_t *start2 = (start + 4); - uint8_t *start2_array_end; - uint32_t segments__element__nw_size; - uint32_t segments__element__mem_size; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - segments_size__value = read_uint32(pos); - segments__nbytes = segments_size__value; - segments__nelements = 0; - - segments__nw_size = segments__nbytes; - segments__mem_size = 0; - start2_array_end = start2 + segments__nbytes; - while (start2 < start2_array_end) { - SPICE_GNUC_UNUSED uint8_t *start3 = start2; - size_t points__nw_size, points__mem_size; - uint32_t points__nelements; - segments__nelements += 1; - { /* points */ - uint32_t count__value; - pos = start3 + 4; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - count__value = read_uint32(pos); - points__nelements = count__value; - - points__nw_size = (8) * points__nelements; - points__mem_size = sizeof(SpicePointFix) * points__nelements; - } - - segments__element__nw_size = 8 + points__nw_size; - segments__element__mem_size = sizeof(SpicePathSeg) + points__mem_size; - segments__mem_size += sizeof(void *) + SPICE_ALIGN(segments__element__mem_size, 4); - start2 += segments__element__nw_size; - } - if (SPICE_UNLIKELY(start2 != start2_array_end)) { - goto error; - } - pos = start + 0; - write_uint32(pos, segments__nelements); - } - - nw_size = 4 + segments__nw_size; - mem_size = sizeof(SpicePath) + segments__mem_size; - - /* Check if struct fits in reported side */ - if (SPICE_UNLIKELY(start + nw_size > message_end)) { - goto error; - } - return mem_size; - - error: - return -1; -} - -static uint8_t * parse_struct_SpicePath(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) -{ - uint8_t *in = message_start + this_ptr_info->offset; - uint8_t *end; - SpicePath *out; - uint32_t segments__nelements; - uint32_t i; - void * *ptr_array; - int ptr_array_index; - uint32_t j; - - end = struct_data + sizeof(SpicePath); - out = (SpicePath *)struct_data; - - out->num_segments = consume_uint32(&in); - segments__nelements = out->num_segments; - ptr_array_index = 0; - ptr_array = (void **)out->segments; - end += sizeof(void *) * segments__nelements; - for (i = 0; i < segments__nelements; i++) { - SpicePathSeg *out2; - uint32_t points__nelements; - ptr_array[ptr_array_index++] = end; - out2 = (SpicePathSeg *)end; - end += sizeof(SpicePathSeg); - - out2->flags = consume_uint32(&in); - out2->count = consume_uint32(&in); - points__nelements = out2->count; - for (j = 0; j < points__nelements; j++) { - SpicePointFix *out3; - out3 = (SpicePointFix *)end; - end += sizeof(SpicePointFix); - - out3->x = consume_int32(&in); - out3->y = consume_int32(&in); - } - /* Align ptr_array element to 4 bytes */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - } - return end; -} - -static uint8_t * parse_array_int32(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) -{ - uint8_t *in = message_start + this_ptr_info->offset; - uint8_t *end; - uint32_t i; - - end = struct_data; - for (i = 0; i < this_ptr_info->nelements; i++) { - *(SPICE_FIXED28_4 *)end = consume_int32(&in); - end += sizeof(SPICE_FIXED28_4); - } - return end; -} - -static uint8_t * parse_msg_display_draw_stroke(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[4]; - size_t base__extra_size; - size_t data__extra_size; - SpiceMsgDisplayDrawStroke *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start3 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); - size_t path__extra_size; - size_t attr__extra_size; - size_t brush__extra_size; - { /* path */ - uint64_t path__value; - pos = (start2 + 0); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - path__value = read_uint64(pos); - ptr_size = validate_SpicePath(message_start, message_end, path__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - path__extra_size = ptr_size + /* for alignment */ 3; - } - - { /* attr */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 8); - size_t style__extra_size; - uint32_t style__array__nelements; - { /* style */ - uint64_t style__value; - uint32_t style__array__nw_size; - uint32_t style__array__mem_size; - uint8_t style_nseg__value; - pos = (start3 + 12); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - style__value = read_uint64(pos); - if (SPICE_UNLIKELY(message_start + style__value >= message_end)) { - goto error; - } - pos = start3 + 3; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - style_nseg__value = read_uint8(pos); - style__array__nelements = style_nseg__value; - - style__array__nw_size = (4) * style__array__nelements; - style__array__mem_size = sizeof(SPICE_FIXED28_4) * style__array__nelements; - if (SPICE_UNLIKELY(message_start + style__value + style__array__nw_size > message_end)) { - goto error; - } - style__extra_size = style__array__mem_size + /* for alignment */ 3; - } - - attr__extra_size = style__extra_size; - } - - { /* brush */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 28); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_BRUSH_TYPE_SOLID) { - u__extra_size = 0; - } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 4); - size_t pat__extra_size; - { /* pat */ - uint64_t pat__value; - pos = (start4 + 0); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - pat__value = read_uint64(pos); - if (SPICE_UNLIKELY(pat__value == 0)) { - goto error; - } - ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pat__extra_size = ptr_size + /* for alignment */ 3; - } - - u__extra_size = pat__extra_size; - } else { - u__extra_size = 0; - } - - } - - brush__extra_size = u__extra_size; - } - - data__extra_size = path__extra_size + attr__extra_size + brush__extra_size; - } - - nw_size = 80; - mem_size = sizeof(SpiceMsgDisplayDrawStroke) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawStroke); - in = start; - - out = (SpiceMsgDisplayDrawStroke *)data; - - /* base */ { - out->base.surface_id = 0; - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint32(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - } - /* data */ { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpicePath; - ptr_info[n_ptr].dest = (void **)&out->data.path; - n_ptr++; - /* attr */ { - uint32_t style__array__nelements; - out->data.attr.flags = consume_uint8(&in); - consume_uint8(&in); - consume_uint8(&in); - out->data.attr.style_nseg = consume_uint8(&in); - consume_int32(&in); - consume_int32(&in); - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_array_int32; - ptr_info[n_ptr].dest = (void **)&out->data.attr.style; - style__array__nelements = out->data.attr.style_nseg; - ptr_info[n_ptr].nelements = style__array__nelements; - n_ptr++; - } - /* brush */ { - uint8_t *in_save; - out->data.brush.type = consume_uint32(&in); - in_save = in; - if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { - out->data.brush.u.color = consume_uint32(&in); - } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; - n_ptr++; - /* pos */ { - out->data.brush.u.pattern.pos.x = consume_int32(&in); - out->data.brush.u.pattern.pos.y = consume_int32(&in); - } - } - in = in_save + 16; - } - out->data.fore_mode = consume_uint16(&in); - out->data.back_mode = consume_uint16(&in); - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static intptr_t validate_SpiceString(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) -{ - uint8_t *start = message_start + offset; - SPICE_GNUC_UNUSED uint8_t *pos; - size_t mem_size, nw_size; - size_t u__nw_size, u__extra_size; - uint16_t flags__value; - uint32_t i; - - if (offset == 0) { - return 0; - } - - if (SPICE_UNLIKELY(start >= message_end)) { - goto error; - } - - { /* u */ - uint32_t u__mem_size; - uint32_t u__nelements; - pos = start + 2; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - flags__value = read_uint16(pos); - if ((flags__value & SPICE_STRING_FLAGS_RASTER_A1)) { - uint16_t length__value; - uint8_t *start2 = (start + 4); - uint32_t u__element__nw_size; - uint32_t u__element__mem_size; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - length__value = read_uint16(pos); - u__nelements = length__value; - - u__nw_size = 0; - u__mem_size = 0; - for (i = 0; i < u__nelements; i++) { - SPICE_GNUC_UNUSED uint8_t *start3 = start2; - size_t data__nw_size, data__mem_size; - uint32_t data__nelements; - { /* data */ - uint16_t width__value; - uint16_t height__value; - pos = start3 + 16; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - width__value = read_uint16(pos); - pos = start3 + 18; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - height__value = read_uint16(pos); - data__nelements = ((width__value + 7) / 8 ) * height__value; - - data__nw_size = data__nelements; - data__mem_size = sizeof(uint8_t) * data__nelements; - } - - u__element__nw_size = 20 + data__nw_size; - u__element__mem_size = sizeof(SpiceRasterGlyph) + data__mem_size; - u__nw_size += u__element__nw_size; - u__mem_size += sizeof(void *) + SPICE_ALIGN(u__element__mem_size, 4); - start2 += u__element__nw_size; - } - u__extra_size = u__mem_size; - } else if ((flags__value & SPICE_STRING_FLAGS_RASTER_A4)) { - uint16_t length__value; - uint8_t *start2 = (start + 4); - uint32_t u__element__nw_size; - uint32_t u__element__mem_size; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - length__value = read_uint16(pos); - u__nelements = length__value; - - u__nw_size = 0; - u__mem_size = 0; - for (i = 0; i < u__nelements; i++) { - SPICE_GNUC_UNUSED uint8_t *start3 = start2; - size_t data__nw_size, data__mem_size; - uint32_t data__nelements; - { /* data */ - uint16_t width__value; - uint16_t height__value; - pos = start3 + 16; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - width__value = read_uint16(pos); - pos = start3 + 18; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - height__value = read_uint16(pos); - data__nelements = ((4 * width__value + 7) / 8 ) * height__value; - - data__nw_size = data__nelements; - data__mem_size = sizeof(uint8_t) * data__nelements; - } - - u__element__nw_size = 20 + data__nw_size; - u__element__mem_size = sizeof(SpiceRasterGlyph) + data__mem_size; - u__nw_size += u__element__nw_size; - u__mem_size += sizeof(void *) + SPICE_ALIGN(u__element__mem_size, 4); - start2 += u__element__nw_size; - } - u__extra_size = u__mem_size; - } else if ((flags__value & SPICE_STRING_FLAGS_RASTER_A8)) { - uint16_t length__value; - uint8_t *start2 = (start + 4); - uint32_t u__element__nw_size; - uint32_t u__element__mem_size; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - length__value = read_uint16(pos); - u__nelements = length__value; - - u__nw_size = 0; - u__mem_size = 0; - for (i = 0; i < u__nelements; i++) { - SPICE_GNUC_UNUSED uint8_t *start3 = start2; - size_t data__nw_size, data__mem_size; - uint32_t data__nelements; - { /* data */ - uint16_t width__value; - uint16_t height__value; - pos = start3 + 16; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - width__value = read_uint16(pos); - pos = start3 + 18; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - height__value = read_uint16(pos); - data__nelements = width__value * height__value; - - data__nw_size = data__nelements; - data__mem_size = sizeof(uint8_t) * data__nelements; - } - - u__element__nw_size = 20 + data__nw_size; - u__element__mem_size = sizeof(SpiceRasterGlyph) + data__mem_size; - u__nw_size += u__element__nw_size; - u__mem_size += sizeof(void *) + SPICE_ALIGN(u__element__mem_size, 4); - start2 += u__element__nw_size; - } - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - nw_size = 4 + u__nw_size; - mem_size = sizeof(SpiceString) + u__extra_size; - - /* Check if struct fits in reported side */ - if (SPICE_UNLIKELY(start + nw_size > message_end)) { - goto error; - } - return mem_size; - - error: - return -1; -} - -static uint8_t * parse_struct_SpiceString(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) -{ - uint8_t *in = message_start + this_ptr_info->offset; - uint8_t *end; - SpiceString *out; - uint32_t i; - - end = struct_data + sizeof(SpiceString); - out = (SpiceString *)struct_data; - - out->length = consume_uint16(&in); - out->flags = consume_uint16(&in); - if ((out->flags & SPICE_STRING_FLAGS_RASTER_A1)) { - uint32_t glyphs__nelements; - void * *ptr_array; - int ptr_array_index; - glyphs__nelements = out->length; - ptr_array_index = 0; - ptr_array = (void **)out->glyphs; - end += sizeof(void *) * glyphs__nelements; - for (i = 0; i < glyphs__nelements; i++) { - SpiceRasterGlyph *out2; - uint32_t data__nelements; - ptr_array[ptr_array_index++] = end; - out2 = (SpiceRasterGlyph *)end; - end += sizeof(SpiceRasterGlyph); - - /* render_pos */ { - out2->render_pos.x = consume_int32(&in); - out2->render_pos.y = consume_int32(&in); - } - /* glyph_origin */ { - out2->glyph_origin.x = consume_int32(&in); - out2->glyph_origin.y = consume_int32(&in); - } - out2->width = consume_uint16(&in); - out2->height = consume_uint16(&in); - data__nelements = ((out2->width + 7) / 8 ) * out2->height; - memcpy(out2->data, in, data__nelements); - in += data__nelements; - end += data__nelements; - /* Align ptr_array element to 4 bytes */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - } - } else if ((out->flags & SPICE_STRING_FLAGS_RASTER_A4)) { - uint32_t glyphs__nelements; - void * *ptr_array; - int ptr_array_index; - glyphs__nelements = out->length; - ptr_array_index = 0; - ptr_array = (void **)out->glyphs; - end += sizeof(void *) * glyphs__nelements; - for (i = 0; i < glyphs__nelements; i++) { - SpiceRasterGlyph *out2; - uint32_t data__nelements; - ptr_array[ptr_array_index++] = end; - out2 = (SpiceRasterGlyph *)end; - end += sizeof(SpiceRasterGlyph); - - /* render_pos */ { - out2->render_pos.x = consume_int32(&in); - out2->render_pos.y = consume_int32(&in); - } - /* glyph_origin */ { - out2->glyph_origin.x = consume_int32(&in); - out2->glyph_origin.y = consume_int32(&in); - } - out2->width = consume_uint16(&in); - out2->height = consume_uint16(&in); - data__nelements = ((4 * out2->width + 7) / 8 ) * out2->height; - memcpy(out2->data, in, data__nelements); - in += data__nelements; - end += data__nelements; - /* Align ptr_array element to 4 bytes */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - } - } else if ((out->flags & SPICE_STRING_FLAGS_RASTER_A8)) { - uint32_t glyphs__nelements; - void * *ptr_array; - int ptr_array_index; - glyphs__nelements = out->length; - ptr_array_index = 0; - ptr_array = (void **)out->glyphs; - end += sizeof(void *) * glyphs__nelements; - for (i = 0; i < glyphs__nelements; i++) { - SpiceRasterGlyph *out2; - uint32_t data__nelements; - ptr_array[ptr_array_index++] = end; - out2 = (SpiceRasterGlyph *)end; - end += sizeof(SpiceRasterGlyph); - - /* render_pos */ { - out2->render_pos.x = consume_int32(&in); - out2->render_pos.y = consume_int32(&in); - } - /* glyph_origin */ { - out2->glyph_origin.x = consume_int32(&in); - out2->glyph_origin.y = consume_int32(&in); - } - out2->width = consume_uint16(&in); - out2->height = consume_uint16(&in); - data__nelements = out2->width * out2->height; - memcpy(out2->data, in, data__nelements); - in += data__nelements; - end += data__nelements; - /* Align ptr_array element to 4 bytes */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - } - } - return end; -} - -static uint8_t * parse_msg_display_draw_text(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[4]; - size_t base__extra_size; - size_t data__extra_size; - SpiceMsgDisplayDrawText *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start3 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); - size_t str__extra_size; - size_t fore_brush__extra_size; - size_t back_brush__extra_size; - { /* str */ - uint64_t str__value; - pos = (start2 + 0); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - str__value = read_uint64(pos); - ptr_size = validate_SpiceString(message_start, message_end, str__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - str__extra_size = ptr_size + /* for alignment */ 3; - } - - { /* fore_brush */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 24); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_BRUSH_TYPE_SOLID) { - u__extra_size = 0; - } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 4); - size_t pat__extra_size; - { /* pat */ - uint64_t pat__value; - pos = (start4 + 0); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - pat__value = read_uint64(pos); - if (SPICE_UNLIKELY(pat__value == 0)) { - goto error; - } - ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pat__extra_size = ptr_size + /* for alignment */ 3; - } - - u__extra_size = pat__extra_size; - } else { - u__extra_size = 0; - } - - } - - fore_brush__extra_size = u__extra_size; - } - - { /* back_brush */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 44); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_BRUSH_TYPE_SOLID) { - u__extra_size = 0; - } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 4); - size_t pat__extra_size; - { /* pat */ - uint64_t pat__value; - pos = (start4 + 0); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - pat__value = read_uint64(pos); - if (SPICE_UNLIKELY(pat__value == 0)) { - goto error; - } - ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pat__extra_size = ptr_size + /* for alignment */ 3; - } - - u__extra_size = pat__extra_size; - } else { - u__extra_size = 0; - } - - } - - back_brush__extra_size = u__extra_size; - } - - data__extra_size = str__extra_size + fore_brush__extra_size + back_brush__extra_size; - } - - nw_size = 96; - mem_size = sizeof(SpiceMsgDisplayDrawText) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawText); - in = start; - - out = (SpiceMsgDisplayDrawText *)data; - - /* base */ { - out->base.surface_id = 0; - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint32(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - } - /* data */ { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceString; - ptr_info[n_ptr].dest = (void **)&out->data.str; - n_ptr++; - /* back_area */ { - out->data.back_area.top = consume_int32(&in); - out->data.back_area.left = consume_int32(&in); - out->data.back_area.bottom = consume_int32(&in); - out->data.back_area.right = consume_int32(&in); - } - /* fore_brush */ { - uint8_t *in_save; - out->data.fore_brush.type = consume_uint32(&in); - in_save = in; - if (out->data.fore_brush.type == SPICE_BRUSH_TYPE_SOLID) { - out->data.fore_brush.u.color = consume_uint32(&in); - } else if (out->data.fore_brush.type == SPICE_BRUSH_TYPE_PATTERN) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.fore_brush.u.pattern.pat; - n_ptr++; - /* pos */ { - out->data.fore_brush.u.pattern.pos.x = consume_int32(&in); - out->data.fore_brush.u.pattern.pos.y = consume_int32(&in); - } - } - in = in_save + 16; - } - /* back_brush */ { - uint8_t *in_save; - out->data.back_brush.type = consume_uint32(&in); - in_save = in; - if (out->data.back_brush.type == SPICE_BRUSH_TYPE_SOLID) { - out->data.back_brush.u.color = consume_uint32(&in); - } else if (out->data.back_brush.type == SPICE_BRUSH_TYPE_PATTERN) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.back_brush.u.pattern.pat; - n_ptr++; - /* pos */ { - out->data.back_brush.u.pattern.pos.x = consume_int32(&in); - out->data.back_brush.u.pattern.pos.y = consume_int32(&in); - } - } - in = in_save + 16; - } - out->data.fore_mode = consume_uint16(&in); - out->data.back_mode = consume_uint16(&in); - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_transparent(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[2]; - size_t base__extra_size; - size_t data__extra_size; - SpiceMsgDisplayDrawTransparent *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start3 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); - size_t src_bitmap__extra_size; - { /* src_bitmap */ - uint64_t src_bitmap__value; - pos = (start2 + 0); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - src_bitmap__value = read_uint64(pos); - ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - src_bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - data__extra_size = src_bitmap__extra_size; - } - - nw_size = 60; - mem_size = sizeof(SpiceMsgDisplayDrawTransparent) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawTransparent); - in = start; - - out = (SpiceMsgDisplayDrawTransparent *)data; - - /* base */ { - out->base.surface_id = 0; - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint32(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - } - /* data */ { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; - n_ptr++; - /* src_area */ { - out->data.src_area.top = consume_int32(&in); - out->data.src_area.left = consume_int32(&in); - out->data.src_area.bottom = consume_int32(&in); - out->data.src_area.right = consume_int32(&in); - } - out->data.src_color = consume_uint32(&in); - out->data.true_color = consume_uint32(&in); - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_alpha_blend(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[2]; - size_t base__extra_size; - size_t data__extra_size; - SpiceMsgDisplayDrawAlphaBlend *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); - size_t u__extra_size; - uint32_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - type__value = read_uint32(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - uint64_t u_rects__value; - pos = (start3 + 4); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - u_rects__value = read_uint64(pos); - ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - u__extra_size = ptr_size + /* for alignment */ 3; - } else if (1) { - u__extra_size = 0; - } else { - u__extra_size = 0; - } - - } - - clip__extra_size = u__extra_size; - } - - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); - size_t src_bitmap__extra_size; - { /* src_bitmap */ - uint64_t src_bitmap__value; - pos = (start2 + 1); - if (SPICE_UNLIKELY(pos + 8 > message_end)) { - goto error; - } - src_bitmap__value = read_uint64(pos); - ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - src_bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - data__extra_size = src_bitmap__extra_size; - } - - nw_size = 53; - mem_size = sizeof(SpiceMsgDisplayDrawAlphaBlend) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawAlphaBlend); - in = start; - - out = (SpiceMsgDisplayDrawAlphaBlend *)data; - - /* base */ { - out->base.surface_id = 0; - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint32(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - } else if (1) { - consume_uint64(&in); - } - } - } - /* data */ { - out->data.alpha_flags = 0; - out->data.alpha = consume_uint8(&in); - ptr_info[n_ptr].offset = consume_uint64(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; - n_ptr++; - /* src_area */ { - out->data.src_area.top = consume_int32(&in); - out->data.src_area.left = consume_int32(&in); - out->data.src_area.bottom = consume_int32(&in); - out->data.src_area.right = consume_int32(&in); - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_DisplayChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[8] = { - parse_msg_display_mode, - parse_SpiceMsgEmpty, - parse_SpiceMsgEmpty, - parse_msg_display_copy_bits, - parse_msg_display_inval_list, - parse_msg_display_inval_all_pixmaps, - parse_msg_display_inval_palette, - parse_SpiceMsgEmpty - }; - static parse_msg_func_t funcs3[5] = { - parse_msg_display_stream_create, - parse_msg_display_stream_data, - parse_msg_display_stream_clip, - parse_msg_display_stream_destroy, - parse_SpiceMsgEmpty - }; - static parse_msg_func_t funcs4[12] = { - parse_msg_display_draw_fill, - parse_msg_display_draw_opaque, - parse_msg_display_draw_copy, - parse_msg_display_draw_blend, - parse_msg_display_draw_blackness, - parse_msg_display_draw_whiteness, - parse_msg_display_draw_invers, - parse_msg_display_draw_rop3, - parse_msg_display_draw_stroke, - parse_msg_display_draw_text, - parse_msg_display_draw_transparent, - parse_msg_display_draw_alpha_blend - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 109) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 122 && message_type < 127) { - return funcs3[message_type-122](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 302 && message_type < 314) { - return funcs4[message_type-302](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} - - - -static uint8_t * parse_msg_inputs_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgInputsInit *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgInputsInit); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgInputsInit); - in = start; - - out = (SpiceMsgInputsInit *)data; - - out->keyboard_modifiers = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_inputs_key_modifiers(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgInputsKeyModifiers *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgInputsKeyModifiers); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgInputsKeyModifiers); - in = start; - - out = (SpiceMsgInputsKeyModifiers *)data; - - out->modifiers = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_InputsChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[2] = { - parse_msg_inputs_init, - parse_msg_inputs_key_modifiers - }; - static parse_msg_func_t funcs3[1] = { - parse_SpiceMsgEmpty - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 103) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 111 && message_type < 112) { - return funcs3[message_type-111](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} - - - -static uint8_t * parse_msg_cursor_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t cursor__nw_size; - SpiceMsgCursorInit *out; - - { /* cursor */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 9); - size_t data__nw_size; - uint32_t data__nelements; - { /* data */ - data__nelements = message_end - (start2 + 22); - - data__nw_size = data__nelements; - } - - cursor__nw_size = 22 + data__nw_size; - } - - nw_size = 9 + cursor__nw_size; - mem_size = sizeof(SpiceMsgCursorInit); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgCursorInit); - in = start; - - out = (SpiceMsgCursorInit *)data; - - /* position */ { - out->position.x = consume_int16(&in); - out->position.y = consume_int16(&in); - } - out->trail_length = consume_uint16(&in); - out->trail_frequency = consume_uint16(&in); - out->visible = consume_uint8(&in); - /* cursor */ { - uint32_t data__nelements; - out->cursor.flags = consume_uint32(&in); - /* header */ { - out->cursor.header.unique = consume_uint64(&in); - out->cursor.header.type = consume_uint16(&in); - out->cursor.header.width = consume_uint16(&in); - out->cursor.header.height = consume_uint16(&in); - out->cursor.header.hot_spot_x = consume_uint16(&in); - out->cursor.header.hot_spot_y = consume_uint16(&in); - } - data__nelements = (message_end - in) / (1); - /* use array as pointer */ - out->cursor.data = (uint8_t *)in; - out->cursor.data_size = data__nelements; - in += data__nelements; - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_cursor_set(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t cursor__nw_size; - SpiceMsgCursorSet *out; - - { /* cursor */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 5); - size_t data__nw_size; - uint32_t data__nelements; - { /* data */ - data__nelements = message_end - (start2 + 22); - - data__nw_size = data__nelements; - } - - cursor__nw_size = 22 + data__nw_size; - } - - nw_size = 5 + cursor__nw_size; - mem_size = sizeof(SpiceMsgCursorSet); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgCursorSet); - in = start; - - out = (SpiceMsgCursorSet *)data; - - /* position */ { - out->position.x = consume_int16(&in); - out->position.y = consume_int16(&in); - } - out->visible = consume_uint8(&in); - /* cursor */ { - uint32_t data__nelements; - out->cursor.flags = consume_uint32(&in); - /* header */ { - out->cursor.header.unique = consume_uint64(&in); - out->cursor.header.type = consume_uint16(&in); - out->cursor.header.width = consume_uint16(&in); - out->cursor.header.height = consume_uint16(&in); - out->cursor.header.hot_spot_x = consume_uint16(&in); - out->cursor.header.hot_spot_y = consume_uint16(&in); - } - data__nelements = (message_end - in) / (1); - /* use array as pointer */ - out->cursor.data = (uint8_t *)in; - out->cursor.data_size = data__nelements; - in += data__nelements; - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_cursor_move(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgCursorMove *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgCursorMove); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgCursorMove); - in = start; - - out = (SpiceMsgCursorMove *)data; - - /* position */ { - out->position.x = consume_int16(&in); - out->position.y = consume_int16(&in); - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_cursor_trail(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgCursorTrail *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgCursorTrail); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgCursorTrail); - in = start; - - out = (SpiceMsgCursorTrail *)data; - - out->length = consume_uint16(&in); - out->frequency = consume_uint16(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_cursor_inval_one(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgDisplayInvalOne *out; - - nw_size = 8; - mem_size = sizeof(SpiceMsgDisplayInvalOne); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayInvalOne); - in = start; - - out = (SpiceMsgDisplayInvalOne *)data; - - out->id = consume_uint64(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_CursorChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[8] = { - parse_msg_cursor_init, - parse_SpiceMsgEmpty, - parse_msg_cursor_set, - parse_msg_cursor_move, - parse_SpiceMsgEmpty, - parse_msg_cursor_trail, - parse_msg_cursor_inval_one, - parse_SpiceMsgEmpty - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 109) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} - - - -static uint8_t * parse_msg_playback_data(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t data__nw_size; - uint32_t data__nelements; - SpiceMsgPlaybackPacket *out; - - { /* data */ - data__nelements = message_end - (start + 4); - - data__nw_size = data__nelements; - } - - nw_size = 4 + data__nw_size; - mem_size = sizeof(SpiceMsgPlaybackPacket); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgPlaybackPacket); - in = start; - - out = (SpiceMsgPlaybackPacket *)data; - - out->time = consume_uint32(&in); - /* use array as pointer */ - out->data = (uint8_t *)in; - out->data_size = data__nelements; - in += data__nelements; - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_playback_mode(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t data__nw_size; - uint32_t data__nelements; - SpiceMsgPlaybackMode *out; - - { /* data */ - data__nelements = message_end - (start + 8); - - data__nw_size = data__nelements; - } - - nw_size = 8 + data__nw_size; - mem_size = sizeof(SpiceMsgPlaybackMode); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgPlaybackMode); - in = start; - - out = (SpiceMsgPlaybackMode *)data; - - out->time = consume_uint32(&in); - out->mode = consume_uint32(&in); - /* use array as pointer */ - out->data = (uint8_t *)in; - out->data_size = data__nelements; - in += data__nelements; - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_playback_start(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgPlaybackStart *out; - - nw_size = 16; - mem_size = sizeof(SpiceMsgPlaybackStart); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgPlaybackStart); - in = start; - - out = (SpiceMsgPlaybackStart *)data; - - out->channels = consume_uint32(&in); - out->format = consume_uint32(&in); - out->frequency = consume_uint32(&in); - out->time = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_PlaybackChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[4] = { - parse_msg_playback_data, - parse_msg_playback_mode, - parse_msg_playback_start, - parse_SpiceMsgEmpty - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 105) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} - - - -static uint8_t * parse_msg_record_start(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgRecordStart *out; - - nw_size = 12; - mem_size = sizeof(SpiceMsgRecordStart); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgRecordStart); - in = start; - - out = (SpiceMsgRecordStart *)data; - - out->channels = consume_uint32(&in); - out->format = consume_uint32(&in); - out->frequency = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_RecordChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[2] = { - parse_msg_record_start, - parse_SpiceMsgEmpty - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 103) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} - -spice_parse_channel_func_t spice_get_server_channel_parser1(uint32_t channel, unsigned int *max_message_type) -{ - static struct {spice_parse_channel_func_t func; unsigned int max_messages; } channels[7] = { - { NULL, 0 }, - { parse_MainChannel_msg, 111}, - { parse_DisplayChannel_msg, 313}, - { parse_InputsChannel_msg, 111}, - { parse_CursorChannel_msg, 108}, - { parse_PlaybackChannel_msg, 104}, - { parse_RecordChannel_msg, 102} - }; - if (channel < 7) { - if (max_message_type != NULL) { - *max_message_type = channels[channel].max_messages; - } - return channels[channel].func; - } - return NULL; -} - -uint8_t * spice_parse_msg1(uint8_t *message_start, uint8_t *message_end, uint32_t channel, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - spice_parse_channel_func_t func; - func = spice_get_server_channel_parser1(channel, NULL); - if (func != NULL) { - return func(message_start, message_end, message_type, minor, size_out, free_message); - } - return NULL; -} diff -Nru spice-gtk-0.9/gtk/generated_demarshallers.c spice-gtk-0.12/gtk/generated_demarshallers.c --- spice-gtk-0.9/gtk/generated_demarshallers.c 2011-12-22 11:55:43.000000000 +0000 +++ spice-gtk-0.12/gtk/generated_demarshallers.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,6992 +0,0 @@ -#include "messages.h" -#include -#include -#include -#include -#include -#include -#include "mem.h" - -#ifdef _MSC_VER -#pragma warning(disable:4101) -#endif - - - -#ifdef WORDS_BIGENDIAN -#define read_int8(ptr) (*((int8_t *)(ptr))) -#define write_int8(ptr, val) *(int8_t *)(ptr) = val -#define read_uint8(ptr) (*((uint8_t *)(ptr))) -#define write_uint8(ptr, val) *(uint8_t *)(ptr) = val -#define read_int16(ptr) ((int16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr))) -#define write_int16(ptr, val) *(uint16_t *)(ptr) = SPICE_BYTESWAP16((uint16_t)val) -#define read_uint16(ptr) ((uint16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr))) -#define write_uint16(ptr, val) *(uint16_t *)(ptr) = SPICE_BYTESWAP16((uint16_t)val) -#define read_int32(ptr) ((int32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr))) -#define write_int32(ptr, val) *(uint32_t *)(ptr) = SPICE_BYTESWAP32((uint32_t)val) -#define read_uint32(ptr) ((uint32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr))) -#define write_uint32(ptr, val) *(uint32_t *)(ptr) = SPICE_BYTESWAP32((uint32_t)val) -#define read_int64(ptr) ((int64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))) -#define write_int64(ptr, val) *(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val) -#define read_uint64(ptr) ((uint64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))) -#define write_uint64(ptr, val) *(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val) -#else -#define read_int8(ptr) (*((int8_t *)(ptr))) -#define write_int8(ptr, val) (*((int8_t *)(ptr))) = val -#define read_uint8(ptr) (*((uint8_t *)(ptr))) -#define write_uint8(ptr, val) (*((uint8_t *)(ptr))) = val -#define read_int16(ptr) (*((int16_t *)(ptr))) -#define write_int16(ptr, val) (*((int16_t *)(ptr))) = val -#define read_uint16(ptr) (*((uint16_t *)(ptr))) -#define write_uint16(ptr, val) (*((uint16_t *)(ptr))) = val -#define read_int32(ptr) (*((int32_t *)(ptr))) -#define write_int32(ptr, val) (*((int32_t *)(ptr))) = val -#define read_uint32(ptr) (*((uint32_t *)(ptr))) -#define write_uint32(ptr, val) (*((uint32_t *)(ptr))) = val -#define read_int64(ptr) (*((int64_t *)(ptr))) -#define write_int64(ptr, val) (*((int64_t *)(ptr))) = val -#define read_uint64(ptr) (*((uint64_t *)(ptr))) -#define write_uint64(ptr, val) (*((uint64_t *)(ptr))) = val -#endif - -static int8_t SPICE_GNUC_UNUSED consume_int8(uint8_t **ptr) -{ - int8_t val; - val = read_int8(*ptr); - *ptr += 1; - return val; -} - -static uint8_t SPICE_GNUC_UNUSED consume_uint8(uint8_t **ptr) -{ - uint8_t val; - val = read_uint8(*ptr); - *ptr += 1; - return val; -} - -static int16_t SPICE_GNUC_UNUSED consume_int16(uint8_t **ptr) -{ - int16_t val; - val = read_int16(*ptr); - *ptr += 2; - return val; -} - -static uint16_t SPICE_GNUC_UNUSED consume_uint16(uint8_t **ptr) -{ - uint16_t val; - val = read_uint16(*ptr); - *ptr += 2; - return val; -} - -static int32_t SPICE_GNUC_UNUSED consume_int32(uint8_t **ptr) -{ - int32_t val; - val = read_int32(*ptr); - *ptr += 4; - return val; -} - -static uint32_t SPICE_GNUC_UNUSED consume_uint32(uint8_t **ptr) -{ - uint32_t val; - val = read_uint32(*ptr); - *ptr += 4; - return val; -} - -static int64_t SPICE_GNUC_UNUSED consume_int64(uint8_t **ptr) -{ - int64_t val; - val = read_int64(*ptr); - *ptr += 8; - return val; -} - -static uint64_t SPICE_GNUC_UNUSED consume_uint64(uint8_t **ptr) -{ - uint64_t val; - val = read_uint64(*ptr); - *ptr += 8; - return val; -} - -typedef struct PointerInfo PointerInfo; -typedef void (*message_destructor_t)(uint8_t *message); -typedef uint8_t * (*parse_func_t)(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *ptr_info, int minor); -typedef uint8_t * (*parse_msg_func_t)(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size_out, message_destructor_t *free_message); -typedef uint8_t * (*spice_parse_channel_func_t)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message); - -struct PointerInfo { - uint64_t offset; - parse_func_t parse; - void * *dest; - uint32_t nelements; -}; - -static uint8_t * parse_msg_migrate(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgMigrate *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgMigrate); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMigrate); - in = start; - - out = (SpiceMsgMigrate *)data; - - out->flags = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static void nofree(uint8_t *data) -{ -} - -static uint8_t * parse_SpiceMsgData(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t data__nw_size; - uint32_t data__nelements; - - { /* data */ - data__nelements = message_end - (start + 0); - - data__nw_size = data__nelements; - } - - nw_size = 0 + data__nw_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = message_start; - *size = message_end - message_start; - *free_message = nofree; - return data; - -} - -static uint8_t * parse_msg_set_ack(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgSetAck *out; - - nw_size = 8; - mem_size = sizeof(SpiceMsgSetAck); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgSetAck); - in = start; - - out = (SpiceMsgSetAck *)data; - - out->generation = consume_uint32(&in); - out->window = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_ping(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t data__nw_size; - uint32_t data__nelements; - SpiceMsgPing *out; - - { /* data */ - data__nelements = message_end - (start + 12); - - data__nw_size = data__nelements; - } - - nw_size = 12 + data__nw_size; - mem_size = sizeof(SpiceMsgPing); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgPing); - in = start; - - out = (SpiceMsgPing *)data; - - out->id = consume_uint32(&in); - out->timestamp = consume_uint64(&in); - /* use array as pointer */ - out->data = (uint8_t *)in; - out->data_len = data__nelements; - in += data__nelements; - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_wait_for_channels(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t wait_list__nw_size, wait_list__mem_size; - uint32_t wait_list__nelements; - SpiceMsgWaitForChannels *out; - uint32_t i; - - { /* wait_list */ - uint8_t wait_count__value; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - wait_count__value = read_uint8(pos); - wait_list__nelements = wait_count__value; - - wait_list__nw_size = (10) * wait_list__nelements; - wait_list__mem_size = sizeof(SpiceWaitForChannel) * wait_list__nelements; - } - - nw_size = 1 + wait_list__nw_size; - mem_size = sizeof(SpiceMsgWaitForChannels) + wait_list__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgWaitForChannels); - in = start; - - out = (SpiceMsgWaitForChannels *)data; - - out->wait_count = consume_uint8(&in); - for (i = 0; i < wait_list__nelements; i++) { - SpiceWaitForChannel *out2; - out2 = (SpiceWaitForChannel *)end; - end += sizeof(SpiceWaitForChannel); - - out2->channel_type = consume_uint8(&in); - out2->channel_id = consume_uint8(&in); - out2->message_serial = consume_uint64(&in); - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_disconnecting(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgDisconnect *out; - - nw_size = 12; - mem_size = sizeof(SpiceMsgDisconnect); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisconnect); - in = start; - - out = (SpiceMsgDisconnect *)data; - - out->time_stamp = consume_uint64(&in); - out->reason = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_notify(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t message__nw_size, message__mem_size; - uint32_t message__nelements; - SpiceMsgNotify *out; - - { /* message */ - uint32_t message_len__value; - pos = start + 20; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - message_len__value = read_uint32(pos); - message__nelements = message_len__value; - - message__nw_size = message__nelements; - message__mem_size = sizeof(uint8_t) * message__nelements; - } - - nw_size = 24 + message__nw_size; - mem_size = sizeof(SpiceMsgNotify) + message__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgNotify); - in = start; - - out = (SpiceMsgNotify *)data; - - out->time_stamp = consume_uint64(&in); - out->severity = consume_uint32(&in); - out->visibilty = consume_uint32(&in); - out->what = consume_uint32(&in); - out->message_len = consume_uint32(&in); - memcpy(out->message, in, message__nelements); - in += message__nelements; - end += message__nelements; - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_array_uint8(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) -{ - uint8_t *in = message_start + this_ptr_info->offset; - uint8_t *end; - - end = struct_data; - memcpy(end, in, this_ptr_info->nelements); - in += this_ptr_info->nelements; - end += this_ptr_info->nelements; - return end; -} - -static uint8_t * parse_msg_main_migrate_begin(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[2]; - size_t host_data__extra_size; - uint32_t host_data__array__nelements; - size_t cert_subject_data__extra_size; - uint32_t cert_subject_data__array__nelements; - SpiceMsgMainMigrationBegin *out; - uint32_t i; - - { /* host_data */ - uint32_t host_data__value; - uint32_t host_data__array__nw_size; - uint32_t host_data__array__mem_size; - uint32_t host_size__value; - pos = (start + 8); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - host_data__value = read_uint32(pos); - if (SPICE_UNLIKELY(host_data__value == 0)) { - goto error; - } - if (SPICE_UNLIKELY(message_start + host_data__value >= message_end)) { - goto error; - } - pos = start + 4; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - host_size__value = read_uint32(pos); - host_data__array__nelements = host_size__value; - - host_data__array__nw_size = host_data__array__nelements; - host_data__array__mem_size = sizeof(uint8_t) * host_data__array__nelements; - if (SPICE_UNLIKELY(message_start + host_data__value + host_data__array__nw_size > message_end)) { - goto error; - } - host_data__extra_size = host_data__array__mem_size + /* for alignment */ 3; - } - - { /* cert_subject_data */ - uint32_t cert_subject_data__value; - uint32_t cert_subject_data__array__nw_size; - uint32_t cert_subject_data__array__mem_size; - uint32_t cert_subject_size__value; - pos = (start + 16); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - cert_subject_data__value = read_uint32(pos); - if (SPICE_UNLIKELY(message_start + cert_subject_data__value >= message_end)) { - goto error; - } - pos = start + 12; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - cert_subject_size__value = read_uint32(pos); - cert_subject_data__array__nelements = cert_subject_size__value; - - cert_subject_data__array__nw_size = cert_subject_data__array__nelements; - cert_subject_data__array__mem_size = sizeof(uint8_t) * cert_subject_data__array__nelements; - if (SPICE_UNLIKELY(message_start + cert_subject_data__value + cert_subject_data__array__nw_size > message_end)) { - goto error; - } - cert_subject_data__extra_size = cert_subject_data__array__mem_size + /* for alignment */ 3; - } - - nw_size = 20; - mem_size = sizeof(SpiceMsgMainMigrationBegin) + host_data__extra_size + cert_subject_data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMainMigrationBegin); - in = start; - - out = (SpiceMsgMainMigrationBegin *)data; - - out->port = consume_uint16(&in); - out->sport = consume_uint16(&in); - out->host_size = consume_uint32(&in); - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_array_uint8; - ptr_info[n_ptr].dest = (void **)&out->host_data; - ptr_info[n_ptr].nelements = host_data__array__nelements; - n_ptr++; - out->cert_subject_size = consume_uint32(&in); - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_array_uint8; - ptr_info[n_ptr].dest = (void **)&out->cert_subject_data; - ptr_info[n_ptr].nelements = cert_subject_data__array__nelements; - n_ptr++; - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_SpiceMsgEmpty(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - - nw_size = 0; - mem_size = sizeof(SpiceMsgEmpty); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgEmpty); - in = start; - - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgMainInit *out; - - nw_size = 32; - mem_size = sizeof(SpiceMsgMainInit); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMainInit); - in = start; - - out = (SpiceMsgMainInit *)data; - - out->session_id = consume_uint32(&in); - out->display_channels_hint = consume_uint32(&in); - out->supported_mouse_modes = consume_uint32(&in); - out->current_mouse_mode = consume_uint32(&in); - out->agent_connected = consume_uint32(&in); - out->agent_tokens = consume_uint32(&in); - out->multi_media_time = consume_uint32(&in); - out->ram_hint = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_channels_list(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t channels__nw_size, channels__mem_size; - uint32_t channels__nelements; - SpiceMsgChannels *out; - uint32_t i; - - { /* channels */ - uint32_t num_of_channels__value; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_of_channels__value = read_uint32(pos); - channels__nelements = num_of_channels__value; - - channels__nw_size = (2) * channels__nelements; - channels__mem_size = sizeof(SpiceChannelId) * channels__nelements; - } - - nw_size = 4 + channels__nw_size; - mem_size = sizeof(SpiceMsgChannels) + channels__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgChannels); - in = start; - - out = (SpiceMsgChannels *)data; - - out->num_of_channels = consume_uint32(&in); - for (i = 0; i < channels__nelements; i++) { - SpiceChannelId *out2; - out2 = (SpiceChannelId *)end; - end += sizeof(SpiceChannelId); - - out2->type = consume_uint8(&in); - out2->id = consume_uint8(&in); - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_mouse_mode(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgMainMouseMode *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgMainMouseMode); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMainMouseMode); - in = start; - - out = (SpiceMsgMainMouseMode *)data; - - out->supported_modes = consume_uint16(&in); - out->current_mode = consume_uint16(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_multi_media_time(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgMainMultiMediaTime *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgMainMultiMediaTime); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMainMultiMediaTime); - in = start; - - out = (SpiceMsgMainMultiMediaTime *)data; - - out->time = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_agent_disconnected(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgMainAgentDisconnect *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgMainAgentDisconnect); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMainAgentDisconnect); - in = start; - - out = (SpiceMsgMainAgentDisconnect *)data; - - out->error_code = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_agent_token(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgMainAgentTokens *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgMainAgentTokens); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMainAgentTokens); - in = start; - - out = (SpiceMsgMainAgentTokens *)data; - - out->num_tokens = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_main_migrate_switch_host(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[2]; - size_t host_data__extra_size; - uint32_t host_data__array__nelements; - size_t cert_subject_data__extra_size; - uint32_t cert_subject_data__array__nelements; - SpiceMsgMainMigrationSwitchHost *out; - uint32_t i; - - { /* host_data */ - uint32_t host_data__value; - uint32_t host_data__array__nw_size; - uint32_t host_data__array__mem_size; - uint32_t host_size__value; - pos = (start + 8); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - host_data__value = read_uint32(pos); - if (SPICE_UNLIKELY(message_start + host_data__value >= message_end)) { - goto error; - } - pos = start + 4; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - host_size__value = read_uint32(pos); - host_data__array__nelements = host_size__value; - - host_data__array__nw_size = host_data__array__nelements; - host_data__array__mem_size = sizeof(uint8_t) * host_data__array__nelements; - if (SPICE_UNLIKELY(message_start + host_data__value + host_data__array__nw_size > message_end)) { - goto error; - } - host_data__extra_size = host_data__array__mem_size + /* for alignment */ 3; - } - - { /* cert_subject_data */ - uint32_t cert_subject_data__value; - uint32_t cert_subject_data__array__nw_size; - uint32_t cert_subject_data__array__mem_size; - uint32_t cert_subject_size__value; - pos = (start + 16); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - cert_subject_data__value = read_uint32(pos); - if (SPICE_UNLIKELY(message_start + cert_subject_data__value >= message_end)) { - goto error; - } - pos = start + 12; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - cert_subject_size__value = read_uint32(pos); - cert_subject_data__array__nelements = cert_subject_size__value; - - cert_subject_data__array__nw_size = cert_subject_data__array__nelements; - cert_subject_data__array__mem_size = sizeof(uint8_t) * cert_subject_data__array__nelements; - if (SPICE_UNLIKELY(message_start + cert_subject_data__value + cert_subject_data__array__nw_size > message_end)) { - goto error; - } - cert_subject_data__extra_size = cert_subject_data__array__mem_size + /* for alignment */ 3; - } - - nw_size = 20; - mem_size = sizeof(SpiceMsgMainMigrationSwitchHost) + host_data__extra_size + cert_subject_data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgMainMigrationSwitchHost); - in = start; - - out = (SpiceMsgMainMigrationSwitchHost *)data; - - out->port = consume_uint16(&in); - out->sport = consume_uint16(&in); - out->host_size = consume_uint32(&in); - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_array_uint8; - ptr_info[n_ptr].dest = (void **)&out->host_data; - ptr_info[n_ptr].nelements = host_data__array__nelements; - n_ptr++; - out->cert_subject_size = consume_uint32(&in); - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_array_uint8; - ptr_info[n_ptr].dest = (void **)&out->cert_subject_data; - ptr_info[n_ptr].nelements = cert_subject_data__array__nelements; - n_ptr++; - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_MainChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[12] = { - parse_msg_main_migrate_begin, - parse_SpiceMsgEmpty, - parse_msg_main_init, - parse_msg_main_channels_list, - parse_msg_main_mouse_mode, - parse_msg_main_multi_media_time, - parse_SpiceMsgEmpty, - parse_msg_main_agent_disconnected, - parse_SpiceMsgData, - parse_msg_main_agent_token, - parse_msg_main_migrate_switch_host, - parse_SpiceMsgEmpty - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 113) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} - - - -static uint8_t * parse_msg_display_mode(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgDisplayMode *out; - - nw_size = 12; - mem_size = sizeof(SpiceMsgDisplayMode); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayMode); - in = start; - - out = (SpiceMsgDisplayMode *)data; - - out->x_res = consume_uint32(&in); - out->y_res = consume_uint32(&in); - out->bits = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_struct_SpiceClipRects(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) -{ - uint8_t *in = message_start + this_ptr_info->offset; - uint8_t *end; - SpiceClipRects *out; - uint32_t rects__nelements; - uint32_t i; - - end = struct_data + sizeof(SpiceClipRects); - out = (SpiceClipRects *)struct_data; - - out->num_rects = consume_uint32(&in); - rects__nelements = out->num_rects; - for (i = 0; i < rects__nelements; i++) { - SpiceRect *out2; - out2 = (SpiceRect *)end; - end += sizeof(SpiceRect); - - out2->top = consume_int32(&in); - out2->left = consume_int32(&in); - out2->bottom = consume_int32(&in); - out2->right = consume_int32(&in); - } - return end; -} - -static uint8_t * parse_msg_display_copy_bits(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[1]; - size_t base__nw_size, base__extra_size; - uint32_t rects__saved_size = 0; - SpiceMsgDisplayCopyBits *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__nw_size, clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start4 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - base__nw_size = 20 + clip__nw_size; - base__extra_size = clip__extra_size; - } - - nw_size = 8 + base__nw_size; - mem_size = sizeof(SpiceMsgDisplayCopyBits) + base__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayCopyBits); - in = start; - - out = (SpiceMsgDisplayCopyBits *)data; - - /* base */ { - out->base.surface_id = consume_uint32(&in); - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint8(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - } - /* src_pos */ { - out->src_pos.x = consume_int32(&in); - out->src_pos.y = consume_int32(&in); - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_inval_list(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t resources__nw_size, resources__mem_size; - uint32_t resources__nelements; - SpiceResourceList *out; - uint32_t i; - - { /* resources */ - uint16_t count__value; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - count__value = read_uint16(pos); - resources__nelements = count__value; - - resources__nw_size = (9) * resources__nelements; - resources__mem_size = sizeof(SpiceResourceID) * resources__nelements; - } - - nw_size = 2 + resources__nw_size; - mem_size = sizeof(SpiceResourceList) + resources__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceResourceList); - in = start; - - out = (SpiceResourceList *)data; - - out->count = consume_uint16(&in); - for (i = 0; i < resources__nelements; i++) { - SpiceResourceID *out2; - out2 = (SpiceResourceID *)end; - end += sizeof(SpiceResourceID); - - out2->type = consume_uint8(&in); - out2->id = consume_uint64(&in); - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_inval_all_pixmaps(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t wait_list__nw_size, wait_list__mem_size; - uint32_t wait_list__nelements; - SpiceMsgWaitForChannels *out; - uint32_t i; - - { /* wait_list */ - uint8_t wait_count__value; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - wait_count__value = read_uint8(pos); - wait_list__nelements = wait_count__value; - - wait_list__nw_size = (10) * wait_list__nelements; - wait_list__mem_size = sizeof(SpiceWaitForChannel) * wait_list__nelements; - } - - nw_size = 1 + wait_list__nw_size; - mem_size = sizeof(SpiceMsgWaitForChannels) + wait_list__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgWaitForChannels); - in = start; - - out = (SpiceMsgWaitForChannels *)data; - - out->wait_count = consume_uint8(&in); - for (i = 0; i < wait_list__nelements; i++) { - SpiceWaitForChannel *out2; - out2 = (SpiceWaitForChannel *)end; - end += sizeof(SpiceWaitForChannel); - - out2->channel_type = consume_uint8(&in); - out2->channel_id = consume_uint8(&in); - out2->message_serial = consume_uint64(&in); - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_inval_palette(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgDisplayInvalOne *out; - - nw_size = 8; - mem_size = sizeof(SpiceMsgDisplayInvalOne); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayInvalOne); - in = start; - - out = (SpiceMsgDisplayInvalOne *)data; - - out->id = consume_uint64(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_stream_create(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[1]; - size_t clip__nw_size, clip__extra_size; - uint32_t rects__saved_size = 0; - SpiceMsgDisplayStreamCreate *out; - uint32_t i; - - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 50); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start2 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - nw_size = 50 + clip__nw_size; - mem_size = sizeof(SpiceMsgDisplayStreamCreate) + clip__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayStreamCreate); - in = start; - - out = (SpiceMsgDisplayStreamCreate *)data; - - out->surface_id = consume_uint32(&in); - out->id = consume_uint32(&in); - out->flags = consume_uint8(&in); - out->codec_type = consume_uint8(&in); - out->stamp = consume_uint64(&in); - out->stream_width = consume_uint32(&in); - out->stream_height = consume_uint32(&in); - out->src_width = consume_uint32(&in); - out->src_height = consume_uint32(&in); - /* dest */ { - out->dest.top = consume_int32(&in); - out->dest.left = consume_int32(&in); - out->dest.bottom = consume_int32(&in); - out->dest.right = consume_int32(&in); - } - /* clip */ { - out->clip.type = consume_uint8(&in); - if (out->clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_stream_data(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t data__nw_size, data__mem_size; - uint32_t data__nelements; - SpiceMsgDisplayStreamData *out; - - { /* data */ - uint32_t data_size__value; - pos = start + 8; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - data_size__value = read_uint32(pos); - data__nelements = data_size__value; - - data__nw_size = data__nelements; - data__mem_size = sizeof(uint8_t) * data__nelements; - } - - nw_size = 12 + data__nw_size; - mem_size = sizeof(SpiceMsgDisplayStreamData) + data__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayStreamData); - in = start; - - out = (SpiceMsgDisplayStreamData *)data; - - out->id = consume_uint32(&in); - out->multi_media_time = consume_uint32(&in); - out->data_size = consume_uint32(&in); - memcpy(out->data, in, data__nelements); - in += data__nelements; - end += data__nelements; - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_stream_clip(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[1]; - size_t clip__nw_size, clip__extra_size; - uint32_t rects__saved_size = 0; - SpiceMsgDisplayStreamClip *out; - uint32_t i; - - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 4); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start2 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - nw_size = 4 + clip__nw_size; - mem_size = sizeof(SpiceMsgDisplayStreamClip) + clip__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayStreamClip); - in = start; - - out = (SpiceMsgDisplayStreamClip *)data; - - out->id = consume_uint32(&in); - /* clip */ { - out->clip.type = consume_uint8(&in); - if (out->clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_stream_destroy(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgDisplayStreamDestroy *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgDisplayStreamDestroy); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayStreamDestroy); - in = start; - - out = (SpiceMsgDisplayStreamDestroy *)data; - - out->id = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static intptr_t validate_SpicePalette(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) -{ - uint8_t *start = message_start + offset; - SPICE_GNUC_UNUSED uint8_t *pos; - size_t mem_size, nw_size; - size_t ents__nw_size, ents__mem_size; - uint32_t ents__nelements; - - if (offset == 0) { - return 0; - } - - if (SPICE_UNLIKELY(start >= message_end)) { - goto error; - } - - { /* ents */ - uint16_t num_ents__value; - pos = start + 8; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - num_ents__value = read_uint16(pos); - ents__nelements = num_ents__value; - - ents__nw_size = (4) * ents__nelements; - ents__mem_size = sizeof(uint32_t) * ents__nelements; - } - - nw_size = 10 + ents__nw_size; - mem_size = sizeof(SpicePalette) + ents__mem_size; - - /* Check if struct fits in reported side */ - if (SPICE_UNLIKELY(start + nw_size > message_end)) { - goto error; - } - return mem_size; - - error: - return -1; -} - -static intptr_t validate_SpiceImage(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) -{ - uint8_t *start = message_start + offset; - SPICE_GNUC_UNUSED uint8_t *pos; - size_t mem_size, nw_size; - SPICE_GNUC_UNUSED intptr_t ptr_size; - size_t u__nw_size, u__extra_size; - uint8_t descriptor_type__value; - - if (offset == 0) { - return 0; - } - - if (SPICE_UNLIKELY(start >= message_end)) { - goto error; - } - - { /* u */ - pos = start + 8; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - descriptor_type__value = read_uint8(pos); - if (descriptor_type__value == SPICE_IMAGE_TYPE_BITMAP) { - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); - size_t pal__nw_size, pal__extra_size; - uint8_t flags__value; - size_t data__nw_size, data__extra_size; - uint32_t data__nelements; - { /* pal */ - pos = start2 + 1; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - flags__value = read_uint8(pos); - if ((flags__value & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { - pal__nw_size = 8; - pal__extra_size = 0; - } else if (1) { - uint32_t pal_palette__value; - pal__nw_size = 4; - pos = (start2 + 14); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - pal_palette__value = read_uint32(pos); - ptr_size = validate_SpicePalette(message_start, message_end, pal_palette__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pal__extra_size = ptr_size + /* for alignment */ 3; - } else { - pal__nw_size = 0; - pal__extra_size = 0; - } - - } - - { /* data */ - uint32_t stride__value; - uint32_t y__value; - pos = start2 + 10; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - stride__value = read_uint32(pos); - pos = start2 + 6; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - y__value = read_uint32(pos); - data__nelements = stride__value * y__value; - - data__nw_size = data__nelements; - data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); - } - - u__nw_size = 14 + pal__nw_size + data__nw_size; - u__extra_size = pal__extra_size + data__extra_size; - } else if (descriptor_type__value == SPICE_IMAGE_TYPE_QUIC) { - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); - size_t data__nw_size, data__extra_size; - uint32_t data__nelements; - { /* data */ - uint32_t data_size__value; - pos = start2 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - data_size__value = read_uint32(pos); - data__nelements = data_size__value; - - data__nw_size = data__nelements; - data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); - } - - u__nw_size = 4 + data__nw_size; - u__extra_size = data__extra_size; - } else if (descriptor_type__value == SPICE_IMAGE_TYPE_LZ_RGB || descriptor_type__value == SPICE_IMAGE_TYPE_GLZ_RGB) { - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); - size_t data__nw_size, data__extra_size; - uint32_t data__nelements; - { /* data */ - uint32_t data_size__value; - pos = start2 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - data_size__value = read_uint32(pos); - data__nelements = data_size__value; - - data__nw_size = data__nelements; - data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); - } - - u__nw_size = 4 + data__nw_size; - u__extra_size = data__extra_size; - } else if (descriptor_type__value == SPICE_IMAGE_TYPE_JPEG) { - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); - size_t data__nw_size, data__extra_size; - uint32_t data__nelements; - { /* data */ - uint32_t data_size__value; - pos = start2 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - data_size__value = read_uint32(pos); - data__nelements = data_size__value; - - data__nw_size = data__nelements; - data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); - } - - u__nw_size = 4 + data__nw_size; - u__extra_size = data__extra_size; - } else if (descriptor_type__value == SPICE_IMAGE_TYPE_LZ_PLT) { - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); - size_t pal__nw_size, pal__extra_size; - uint8_t flags__value; - size_t data__nw_size, data__extra_size; - uint32_t data__nelements; - { /* pal */ - pos = start2 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - flags__value = read_uint8(pos); - if ((flags__value & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { - pal__nw_size = 8; - pal__extra_size = 0; - } else if (1) { - uint32_t pal_palette__value; - pal__nw_size = 4; - pos = (start2 + 5); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - pal_palette__value = read_uint32(pos); - if (SPICE_UNLIKELY(pal_palette__value == 0)) { - goto error; - } - ptr_size = validate_SpicePalette(message_start, message_end, pal_palette__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pal__extra_size = ptr_size + /* for alignment */ 3; - } else { - pal__nw_size = 0; - pal__extra_size = 0; - } - - } - - { /* data */ - uint32_t data_size__value; - pos = start2 + 1; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - data_size__value = read_uint32(pos); - data__nelements = data_size__value; - - data__nw_size = data__nelements; - data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); - } - - u__nw_size = 5 + pal__nw_size + data__nw_size; - u__extra_size = pal__extra_size + data__extra_size; - } else if (descriptor_type__value == SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB) { - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); - size_t data__nw_size, data__extra_size; - uint32_t data__nelements; - { /* data */ - uint32_t data_size__value; - pos = start2 + 4; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - data_size__value = read_uint32(pos); - data__nelements = data_size__value; - - data__nw_size = data__nelements; - data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); - } - - u__nw_size = 8 + data__nw_size; - u__extra_size = data__extra_size; - } else if (descriptor_type__value == SPICE_IMAGE_TYPE_JPEG_ALPHA) { - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); - size_t data__nw_size, data__extra_size; - uint32_t data__nelements; - { /* data */ - uint32_t data_size__value; - pos = start2 + 5; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - data_size__value = read_uint32(pos); - data__nelements = data_size__value; - - data__nw_size = data__nelements; - data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); - } - - u__nw_size = 9 + data__nw_size; - u__extra_size = data__extra_size; - } else if (descriptor_type__value == SPICE_IMAGE_TYPE_SURFACE) { - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); - u__nw_size = 4; - u__extra_size = 0; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - nw_size = 18 + u__nw_size; - mem_size = sizeof(SpiceImage) + u__extra_size; - - /* Check if struct fits in reported side */ - if (SPICE_UNLIKELY(start + nw_size > message_end)) { - goto error; - } - return mem_size; - - error: - return -1; -} - -static uint8_t * parse_struct_SpicePalette(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) -{ - uint8_t *in = message_start + this_ptr_info->offset; - uint8_t *end; - SpicePalette *out; - uint32_t ents__nelements; - uint32_t i; - - end = struct_data + sizeof(SpicePalette); - out = (SpicePalette *)struct_data; - - out->unique = consume_uint64(&in); - out->num_ents = consume_uint16(&in); - ents__nelements = out->num_ents; - for (i = 0; i < ents__nelements; i++) { - out->ents[i] = consume_uint32(&in); - end += sizeof(uint32_t); - } - return end; -} - -static uint8_t * parse_struct_SpiceImage(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) -{ - uint8_t *in = message_start + this_ptr_info->offset; - uint8_t *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[1]; - SpiceImage *out; - uint32_t i; - - end = struct_data + sizeof(SpiceImage); - out = (SpiceImage *)struct_data; - - /* descriptor */ { - out->descriptor.id = consume_uint64(&in); - out->descriptor.type = consume_uint8(&in); - out->descriptor.flags = consume_uint8(&in); - out->descriptor.width = consume_uint32(&in); - out->descriptor.height = consume_uint32(&in); - } - if (out->descriptor.type == SPICE_IMAGE_TYPE_BITMAP) { - uint32_t data__nelements; - SpiceChunks *chunks; - out->u.bitmap.format = consume_uint8(&in); - out->u.bitmap.flags = consume_uint8(&in); - out->u.bitmap.x = consume_uint32(&in); - out->u.bitmap.y = consume_uint32(&in); - out->u.bitmap.stride = consume_uint32(&in); - if ((out->u.bitmap.flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { - out->u.bitmap.palette_id = consume_uint64(&in); - } else if (1) { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpicePalette; - ptr_info[n_ptr].dest = (void **)&out->u.bitmap.palette; - n_ptr++; - } - data__nelements = out->u.bitmap.stride * out->u.bitmap.y; - /* use array as chunk */ - chunks = (SpiceChunks *)end; - end += sizeof(SpiceChunks) + sizeof(SpiceChunk); - out->u.bitmap.data = chunks; - chunks->data_size = data__nelements; - chunks->flags = 0; - chunks->num_chunks = 1; - chunks->chunk[0].len = data__nelements; - chunks->chunk[0].data = in; - in += data__nelements; - } else if (out->descriptor.type == SPICE_IMAGE_TYPE_QUIC) { - uint32_t data__nelements; - SpiceChunks *chunks; - out->u.quic.data_size = consume_uint32(&in); - data__nelements = out->u.quic.data_size; - /* use array as chunk */ - chunks = (SpiceChunks *)end; - end += sizeof(SpiceChunks) + sizeof(SpiceChunk); - out->u.quic.data = chunks; - chunks->data_size = data__nelements; - chunks->flags = 0; - chunks->num_chunks = 1; - chunks->chunk[0].len = data__nelements; - chunks->chunk[0].data = in; - in += data__nelements; - } else if (out->descriptor.type == SPICE_IMAGE_TYPE_LZ_RGB || out->descriptor.type == SPICE_IMAGE_TYPE_GLZ_RGB) { - uint32_t data__nelements; - SpiceChunks *chunks; - out->u.lz_rgb.data_size = consume_uint32(&in); - data__nelements = out->u.lz_rgb.data_size; - /* use array as chunk */ - chunks = (SpiceChunks *)end; - end += sizeof(SpiceChunks) + sizeof(SpiceChunk); - out->u.lz_rgb.data = chunks; - chunks->data_size = data__nelements; - chunks->flags = 0; - chunks->num_chunks = 1; - chunks->chunk[0].len = data__nelements; - chunks->chunk[0].data = in; - in += data__nelements; - } else if (out->descriptor.type == SPICE_IMAGE_TYPE_JPEG) { - uint32_t data__nelements; - SpiceChunks *chunks; - out->u.jpeg.data_size = consume_uint32(&in); - data__nelements = out->u.jpeg.data_size; - /* use array as chunk */ - chunks = (SpiceChunks *)end; - end += sizeof(SpiceChunks) + sizeof(SpiceChunk); - out->u.jpeg.data = chunks; - chunks->data_size = data__nelements; - chunks->flags = 0; - chunks->num_chunks = 1; - chunks->chunk[0].len = data__nelements; - chunks->chunk[0].data = in; - in += data__nelements; - } else if (out->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) { - uint32_t data__nelements; - SpiceChunks *chunks; - out->u.lz_plt.flags = consume_uint8(&in); - out->u.lz_plt.data_size = consume_uint32(&in); - if ((out->u.lz_plt.flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { - out->u.lz_plt.palette_id = consume_uint64(&in); - } else if (1) { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpicePalette; - ptr_info[n_ptr].dest = (void **)&out->u.lz_plt.palette; - n_ptr++; - } - data__nelements = out->u.lz_plt.data_size; - /* use array as chunk */ - chunks = (SpiceChunks *)end; - end += sizeof(SpiceChunks) + sizeof(SpiceChunk); - out->u.lz_plt.data = chunks; - chunks->data_size = data__nelements; - chunks->flags = 0; - chunks->num_chunks = 1; - chunks->chunk[0].len = data__nelements; - chunks->chunk[0].data = in; - in += data__nelements; - } else if (out->descriptor.type == SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB) { - uint32_t data__nelements; - SpiceChunks *chunks; - out->u.zlib_glz.glz_data_size = consume_uint32(&in); - out->u.zlib_glz.data_size = consume_uint32(&in); - data__nelements = out->u.zlib_glz.data_size; - /* use array as chunk */ - chunks = (SpiceChunks *)end; - end += sizeof(SpiceChunks) + sizeof(SpiceChunk); - out->u.zlib_glz.data = chunks; - chunks->data_size = data__nelements; - chunks->flags = 0; - chunks->num_chunks = 1; - chunks->chunk[0].len = data__nelements; - chunks->chunk[0].data = in; - in += data__nelements; - } else if (out->descriptor.type == SPICE_IMAGE_TYPE_JPEG_ALPHA) { - uint32_t data__nelements; - SpiceChunks *chunks; - out->u.jpeg_alpha.flags = consume_uint8(&in); - out->u.jpeg_alpha.jpeg_size = consume_uint32(&in); - out->u.jpeg_alpha.data_size = consume_uint32(&in); - data__nelements = out->u.jpeg_alpha.data_size; - /* use array as chunk */ - chunks = (SpiceChunks *)end; - end += sizeof(SpiceChunks) + sizeof(SpiceChunk); - out->u.jpeg_alpha.data = chunks; - chunks->data_size = data__nelements; - chunks->flags = 0; - chunks->num_chunks = 1; - chunks->chunk[0].len = data__nelements; - chunks->chunk[0].data = in; - in += data__nelements; - } else if (out->descriptor.type == SPICE_IMAGE_TYPE_SURFACE) { - out->u.surface.surface_id = consume_uint32(&in); - } - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - return end; - - error: - return NULL; -} - -static uint8_t * parse_msg_display_draw_fill(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[3]; - size_t base__nw_size, base__extra_size; - uint32_t rects__saved_size = 0; - size_t data__nw_size, data__extra_size; - SpiceMsgDisplayDrawFill *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__nw_size, clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start4 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - base__nw_size = 20 + clip__nw_size; - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); - size_t brush__nw_size, brush__extra_size; - size_t mask__extra_size; - { /* brush */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_BRUSH_TYPE_SOLID) { - u__nw_size = 4; - u__extra_size = 0; - } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t pat__extra_size; - { /* pat */ - uint32_t pat__value; - pos = (start4 + 0); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - pat__value = read_uint32(pos); - if (SPICE_UNLIKELY(pat__value == 0)) { - goto error; - } - ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pat__extra_size = ptr_size + /* for alignment */ 3; - } - - u__nw_size = 12; - u__extra_size = pat__extra_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - brush__nw_size = 1 + u__nw_size; - brush__extra_size = u__extra_size; - } - - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 2 + brush__nw_size); - size_t bitmap__extra_size; - { /* bitmap */ - uint32_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - bitmap__value = read_uint32(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__nw_size = 15 + brush__nw_size; - data__extra_size = brush__extra_size + mask__extra_size; - } - - nw_size = 0 + base__nw_size + data__nw_size; - mem_size = sizeof(SpiceMsgDisplayDrawFill) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawFill); - in = start; - - out = (SpiceMsgDisplayDrawFill *)data; - - /* base */ { - out->base.surface_id = consume_uint32(&in); - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint8(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - } - /* data */ { - /* brush */ { - out->data.brush.type = consume_uint8(&in); - if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { - out->data.brush.u.color = consume_uint32(&in); - } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; - n_ptr++; - /* pos */ { - out->data.brush.u.pattern.pos.x = consume_int32(&in); - out->data.brush.u.pattern.pos.y = consume_int32(&in); - } - } - } - out->data.rop_descriptor = consume_uint16(&in); - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_opaque(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[4]; - size_t base__nw_size, base__extra_size; - uint32_t rects__saved_size = 0; - size_t data__nw_size, data__extra_size; - SpiceMsgDisplayDrawOpaque *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__nw_size, clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start4 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - base__nw_size = 20 + clip__nw_size; - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); - size_t src_bitmap__extra_size; - size_t brush__nw_size, brush__extra_size; - size_t mask__extra_size; - { /* src_bitmap */ - uint32_t src_bitmap__value; - pos = (start2 + 0); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - src_bitmap__value = read_uint32(pos); - ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - src_bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - { /* brush */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_BRUSH_TYPE_SOLID) { - u__nw_size = 4; - u__extra_size = 0; - } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t pat__extra_size; - { /* pat */ - uint32_t pat__value; - pos = (start4 + 0); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - pat__value = read_uint32(pos); - if (SPICE_UNLIKELY(pat__value == 0)) { - goto error; - } - ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pat__extra_size = ptr_size + /* for alignment */ 3; - } - - u__nw_size = 12; - u__extra_size = pat__extra_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - brush__nw_size = 1 + u__nw_size; - brush__extra_size = u__extra_size; - } - - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 23 + brush__nw_size); - size_t bitmap__extra_size; - { /* bitmap */ - uint32_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - bitmap__value = read_uint32(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__nw_size = 36 + brush__nw_size; - data__extra_size = src_bitmap__extra_size + brush__extra_size + mask__extra_size; - } - - nw_size = 0 + base__nw_size + data__nw_size; - mem_size = sizeof(SpiceMsgDisplayDrawOpaque) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawOpaque); - in = start; - - out = (SpiceMsgDisplayDrawOpaque *)data; - - /* base */ { - out->base.surface_id = consume_uint32(&in); - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint8(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - } - /* data */ { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; - n_ptr++; - /* src_area */ { - out->data.src_area.top = consume_int32(&in); - out->data.src_area.left = consume_int32(&in); - out->data.src_area.bottom = consume_int32(&in); - out->data.src_area.right = consume_int32(&in); - } - /* brush */ { - out->data.brush.type = consume_uint8(&in); - if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { - out->data.brush.u.color = consume_uint32(&in); - } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; - n_ptr++; - /* pos */ { - out->data.brush.u.pattern.pos.x = consume_int32(&in); - out->data.brush.u.pattern.pos.y = consume_int32(&in); - } - } - } - out->data.rop_descriptor = consume_uint16(&in); - out->data.scale_mode = consume_uint8(&in); - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_copy(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[3]; - size_t base__nw_size, base__extra_size; - uint32_t rects__saved_size = 0; - size_t data__extra_size; - SpiceMsgDisplayDrawCopy *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__nw_size, clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start4 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - base__nw_size = 20 + clip__nw_size; - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); - size_t src_bitmap__extra_size; - size_t mask__extra_size; - { /* src_bitmap */ - uint32_t src_bitmap__value; - pos = (start2 + 0); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - src_bitmap__value = read_uint32(pos); - ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - src_bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 23); - size_t bitmap__extra_size; - { /* bitmap */ - uint32_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - bitmap__value = read_uint32(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__extra_size = src_bitmap__extra_size + mask__extra_size; - } - - nw_size = 36 + base__nw_size; - mem_size = sizeof(SpiceMsgDisplayDrawCopy) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawCopy); - in = start; - - out = (SpiceMsgDisplayDrawCopy *)data; - - /* base */ { - out->base.surface_id = consume_uint32(&in); - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint8(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - } - /* data */ { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; - n_ptr++; - /* src_area */ { - out->data.src_area.top = consume_int32(&in); - out->data.src_area.left = consume_int32(&in); - out->data.src_area.bottom = consume_int32(&in); - out->data.src_area.right = consume_int32(&in); - } - out->data.rop_descriptor = consume_uint16(&in); - out->data.scale_mode = consume_uint8(&in); - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_blend(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[3]; - size_t base__nw_size, base__extra_size; - uint32_t rects__saved_size = 0; - size_t data__extra_size; - SpiceMsgDisplayDrawBlend *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__nw_size, clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start4 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - base__nw_size = 20 + clip__nw_size; - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); - size_t src_bitmap__extra_size; - size_t mask__extra_size; - { /* src_bitmap */ - uint32_t src_bitmap__value; - pos = (start2 + 0); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - src_bitmap__value = read_uint32(pos); - ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - src_bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 23); - size_t bitmap__extra_size; - { /* bitmap */ - uint32_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - bitmap__value = read_uint32(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__extra_size = src_bitmap__extra_size + mask__extra_size; - } - - nw_size = 36 + base__nw_size; - mem_size = sizeof(SpiceMsgDisplayDrawBlend) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawBlend); - in = start; - - out = (SpiceMsgDisplayDrawBlend *)data; - - /* base */ { - out->base.surface_id = consume_uint32(&in); - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint8(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - } - /* data */ { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; - n_ptr++; - /* src_area */ { - out->data.src_area.top = consume_int32(&in); - out->data.src_area.left = consume_int32(&in); - out->data.src_area.bottom = consume_int32(&in); - out->data.src_area.right = consume_int32(&in); - } - out->data.rop_descriptor = consume_uint16(&in); - out->data.scale_mode = consume_uint8(&in); - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_blackness(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[2]; - size_t base__nw_size, base__extra_size; - uint32_t rects__saved_size = 0; - size_t data__extra_size; - SpiceMsgDisplayDrawBlackness *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__nw_size, clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start4 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - base__nw_size = 20 + clip__nw_size; - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); - size_t mask__extra_size; - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); - size_t bitmap__extra_size; - { /* bitmap */ - uint32_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - bitmap__value = read_uint32(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__extra_size = mask__extra_size; - } - - nw_size = 13 + base__nw_size; - mem_size = sizeof(SpiceMsgDisplayDrawBlackness) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawBlackness); - in = start; - - out = (SpiceMsgDisplayDrawBlackness *)data; - - /* base */ { - out->base.surface_id = consume_uint32(&in); - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint8(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - } - /* data */ { - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_whiteness(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[2]; - size_t base__nw_size, base__extra_size; - uint32_t rects__saved_size = 0; - size_t data__extra_size; - SpiceMsgDisplayDrawWhiteness *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__nw_size, clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start4 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - base__nw_size = 20 + clip__nw_size; - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); - size_t mask__extra_size; - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); - size_t bitmap__extra_size; - { /* bitmap */ - uint32_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - bitmap__value = read_uint32(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__extra_size = mask__extra_size; - } - - nw_size = 13 + base__nw_size; - mem_size = sizeof(SpiceMsgDisplayDrawWhiteness) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawWhiteness); - in = start; - - out = (SpiceMsgDisplayDrawWhiteness *)data; - - /* base */ { - out->base.surface_id = consume_uint32(&in); - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint8(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - } - /* data */ { - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_invers(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[2]; - size_t base__nw_size, base__extra_size; - uint32_t rects__saved_size = 0; - size_t data__extra_size; - SpiceMsgDisplayDrawInvers *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__nw_size, clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start4 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - base__nw_size = 20 + clip__nw_size; - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); - size_t mask__extra_size; - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); - size_t bitmap__extra_size; - { /* bitmap */ - uint32_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - bitmap__value = read_uint32(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__extra_size = mask__extra_size; - } - - nw_size = 13 + base__nw_size; - mem_size = sizeof(SpiceMsgDisplayDrawInvers) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawInvers); - in = start; - - out = (SpiceMsgDisplayDrawInvers *)data; - - /* base */ { - out->base.surface_id = consume_uint32(&in); - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint8(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - } - /* data */ { - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_rop3(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[4]; - size_t base__nw_size, base__extra_size; - uint32_t rects__saved_size = 0; - size_t data__nw_size, data__extra_size; - SpiceMsgDisplayDrawRop3 *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__nw_size, clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start4 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - base__nw_size = 20 + clip__nw_size; - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); - size_t src_bitmap__extra_size; - size_t brush__nw_size, brush__extra_size; - size_t mask__extra_size; - { /* src_bitmap */ - uint32_t src_bitmap__value; - pos = (start2 + 0); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - src_bitmap__value = read_uint32(pos); - ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - src_bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - { /* brush */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_BRUSH_TYPE_SOLID) { - u__nw_size = 4; - u__extra_size = 0; - } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t pat__extra_size; - { /* pat */ - uint32_t pat__value; - pos = (start4 + 0); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - pat__value = read_uint32(pos); - if (SPICE_UNLIKELY(pat__value == 0)) { - goto error; - } - ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pat__extra_size = ptr_size + /* for alignment */ 3; - } - - u__nw_size = 12; - u__extra_size = pat__extra_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - brush__nw_size = 1 + u__nw_size; - brush__extra_size = u__extra_size; - } - - { /* mask */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 22 + brush__nw_size); - size_t bitmap__extra_size; - { /* bitmap */ - uint32_t bitmap__value; - pos = (start3 + 9); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - bitmap__value = read_uint32(pos); - ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - mask__extra_size = bitmap__extra_size; - } - - data__nw_size = 35 + brush__nw_size; - data__extra_size = src_bitmap__extra_size + brush__extra_size + mask__extra_size; - } - - nw_size = 0 + base__nw_size + data__nw_size; - mem_size = sizeof(SpiceMsgDisplayDrawRop3) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawRop3); - in = start; - - out = (SpiceMsgDisplayDrawRop3 *)data; - - /* base */ { - out->base.surface_id = consume_uint32(&in); - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint8(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - } - /* data */ { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; - n_ptr++; - /* src_area */ { - out->data.src_area.top = consume_int32(&in); - out->data.src_area.left = consume_int32(&in); - out->data.src_area.bottom = consume_int32(&in); - out->data.src_area.right = consume_int32(&in); - } - /* brush */ { - out->data.brush.type = consume_uint8(&in); - if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { - out->data.brush.u.color = consume_uint32(&in); - } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; - n_ptr++; - /* pos */ { - out->data.brush.u.pattern.pos.x = consume_int32(&in); - out->data.brush.u.pattern.pos.y = consume_int32(&in); - } - } - } - out->data.rop3 = consume_uint8(&in); - out->data.scale_mode = consume_uint8(&in); - /* mask */ { - out->data.mask.flags = consume_uint8(&in); - /* pos */ { - out->data.mask.pos.x = consume_int32(&in); - out->data.mask.pos.y = consume_int32(&in); - } - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; - n_ptr++; - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static intptr_t validate_SpicePath(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) -{ - uint8_t *start = message_start + offset; - SPICE_GNUC_UNUSED uint8_t *pos; - size_t mem_size, nw_size; - size_t segments__nw_size, segments__mem_size; - uint32_t segments__nelements; - uint32_t i; - - if (offset == 0) { - return 0; - } - - if (SPICE_UNLIKELY(start >= message_end)) { - goto error; - } - - { /* segments */ - uint32_t num_segments__value; - uint8_t *start2 = (start + 4); - uint32_t segments__element__nw_size; - uint32_t segments__element__mem_size; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_segments__value = read_uint32(pos); - segments__nelements = num_segments__value; - - segments__nw_size = 0; - segments__mem_size = 0; - for (i = 0; i < segments__nelements; i++) { - SPICE_GNUC_UNUSED uint8_t *start3 = start2; - size_t points__nw_size, points__mem_size; - uint32_t points__nelements; - { /* points */ - uint32_t count__value; - pos = start3 + 1; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - count__value = read_uint32(pos); - points__nelements = count__value; - - points__nw_size = (8) * points__nelements; - points__mem_size = sizeof(SpicePointFix) * points__nelements; - } - - segments__element__nw_size = 5 + points__nw_size; - segments__element__mem_size = sizeof(SpicePathSeg) + points__mem_size; - segments__nw_size += segments__element__nw_size; - segments__mem_size += sizeof(void *) + SPICE_ALIGN(segments__element__mem_size, 4); - start2 += segments__element__nw_size; - } - } - - nw_size = 4 + segments__nw_size; - mem_size = sizeof(SpicePath) + segments__mem_size; - - /* Check if struct fits in reported side */ - if (SPICE_UNLIKELY(start + nw_size > message_end)) { - goto error; - } - return mem_size; - - error: - return -1; -} - -static uint8_t * parse_struct_SpicePath(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) -{ - uint8_t *in = message_start + this_ptr_info->offset; - uint8_t *end; - SpicePath *out; - uint32_t segments__nelements; - uint32_t i; - void * *ptr_array; - int ptr_array_index; - uint32_t j; - - end = struct_data + sizeof(SpicePath); - out = (SpicePath *)struct_data; - - out->num_segments = consume_uint32(&in); - segments__nelements = out->num_segments; - ptr_array_index = 0; - ptr_array = (void **)out->segments; - end += sizeof(void *) * segments__nelements; - for (i = 0; i < segments__nelements; i++) { - SpicePathSeg *out2; - uint32_t points__nelements; - ptr_array[ptr_array_index++] = end; - out2 = (SpicePathSeg *)end; - end += sizeof(SpicePathSeg); - - out2->flags = consume_uint8(&in); - out2->count = consume_uint32(&in); - points__nelements = out2->count; - for (j = 0; j < points__nelements; j++) { - SpicePointFix *out3; - out3 = (SpicePointFix *)end; - end += sizeof(SpicePointFix); - - out3->x = consume_int32(&in); - out3->y = consume_int32(&in); - } - /* Align ptr_array element to 4 bytes */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - } - return end; -} - -static uint8_t * parse_array_int32(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) -{ - uint8_t *in = message_start + this_ptr_info->offset; - uint8_t *end; - uint32_t i; - - end = struct_data; - for (i = 0; i < this_ptr_info->nelements; i++) { - *(SPICE_FIXED28_4 *)end = consume_int32(&in); - end += sizeof(SPICE_FIXED28_4); - } - return end; -} - -static uint8_t * parse_msg_display_draw_stroke(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[4]; - size_t base__nw_size, base__extra_size; - uint32_t rects__saved_size = 0; - size_t data__nw_size, data__extra_size; - SpiceMsgDisplayDrawStroke *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__nw_size, clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start4 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - base__nw_size = 20 + clip__nw_size; - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); - size_t path__extra_size; - size_t attr__nw_size, attr__extra_size; - size_t brush__nw_size, brush__extra_size; - { /* path */ - uint32_t path__value; - pos = (start2 + 0); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - path__value = read_uint32(pos); - if (SPICE_UNLIKELY(path__value == 0)) { - goto error; - } - ptr_size = validate_SpicePath(message_start, message_end, path__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - path__extra_size = ptr_size + /* for alignment */ 3; - } - - { /* attr */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 4); - size_t u1__nw_size; - uint8_t flags__value; - size_t u2__nw_size, u2__extra_size; - { /* u1 */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - flags__value = read_uint8(pos); - if ((flags__value & SPICE_LINE_FLAGS_STYLED)) { - u1__nw_size = 1; - } else { - u1__nw_size = 0; - } - - } - - { /* u2 */ - uint32_t u2__array__nelements; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - flags__value = read_uint8(pos); - if ((flags__value & SPICE_LINE_FLAGS_STYLED)) { - uint32_t u2_style__value; - uint32_t u2__array__nw_size; - uint32_t u2__array__mem_size; - uint8_t style_nseg__value; - u2__nw_size = 4; - pos = (start3 + 1 + u1__nw_size); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - u2_style__value = read_uint32(pos); - if (SPICE_UNLIKELY(message_start + u2_style__value >= message_end)) { - goto error; - } - pos = start3 + 1; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - style_nseg__value = read_uint8(pos); - u2__array__nelements = style_nseg__value; - - u2__array__nw_size = (4) * u2__array__nelements; - u2__array__mem_size = sizeof(SPICE_FIXED28_4) * u2__array__nelements; - if (SPICE_UNLIKELY(message_start + u2_style__value + u2__array__nw_size > message_end)) { - goto error; - } - u2__extra_size = u2__array__mem_size + /* for alignment */ 3; - } else { - u2__nw_size = 0; - u2__extra_size = 0; - } - - } - - attr__nw_size = 1 + u1__nw_size + u2__nw_size; - attr__extra_size = u2__extra_size; - } - - { /* brush */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 4 + attr__nw_size); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_BRUSH_TYPE_SOLID) { - u__nw_size = 4; - u__extra_size = 0; - } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t pat__extra_size; - { /* pat */ - uint32_t pat__value; - pos = (start4 + 0); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - pat__value = read_uint32(pos); - if (SPICE_UNLIKELY(pat__value == 0)) { - goto error; - } - ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pat__extra_size = ptr_size + /* for alignment */ 3; - } - - u__nw_size = 12; - u__extra_size = pat__extra_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - brush__nw_size = 1 + u__nw_size; - brush__extra_size = u__extra_size; - } - - data__nw_size = 8 + attr__nw_size + brush__nw_size; - data__extra_size = path__extra_size + attr__extra_size + brush__extra_size; - } - - nw_size = 0 + base__nw_size + data__nw_size; - mem_size = sizeof(SpiceMsgDisplayDrawStroke) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawStroke); - in = start; - - out = (SpiceMsgDisplayDrawStroke *)data; - - /* base */ { - out->base.surface_id = consume_uint32(&in); - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint8(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - } - /* data */ { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpicePath; - ptr_info[n_ptr].dest = (void **)&out->data.path; - n_ptr++; - /* attr */ { - out->data.attr.flags = consume_uint8(&in); - if ((out->data.attr.flags & SPICE_LINE_FLAGS_STYLED)) { - out->data.attr.style_nseg = consume_uint8(&in); - } - if ((out->data.attr.flags & SPICE_LINE_FLAGS_STYLED)) { - uint32_t style__array__nelements; - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_array_int32; - ptr_info[n_ptr].dest = (void **)&out->data.attr.style; - style__array__nelements = out->data.attr.style_nseg; - ptr_info[n_ptr].nelements = style__array__nelements; - n_ptr++; - } - } - /* brush */ { - out->data.brush.type = consume_uint8(&in); - if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { - out->data.brush.u.color = consume_uint32(&in); - } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; - n_ptr++; - /* pos */ { - out->data.brush.u.pattern.pos.x = consume_int32(&in); - out->data.brush.u.pattern.pos.y = consume_int32(&in); - } - } - } - out->data.fore_mode = consume_uint16(&in); - out->data.back_mode = consume_uint16(&in); - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static intptr_t validate_SpiceString(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) -{ - uint8_t *start = message_start + offset; - SPICE_GNUC_UNUSED uint8_t *pos; - size_t mem_size, nw_size; - size_t u__nw_size, u__extra_size; - uint8_t flags__value; - uint32_t i; - - if (offset == 0) { - return 0; - } - - if (SPICE_UNLIKELY(start >= message_end)) { - goto error; - } - - { /* u */ - uint32_t u__mem_size; - uint32_t u__nelements; - pos = start + 2; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - flags__value = read_uint8(pos); - if ((flags__value & SPICE_STRING_FLAGS_RASTER_A1)) { - uint16_t length__value; - uint8_t *start2 = (start + 3); - uint32_t u__element__nw_size; - uint32_t u__element__mem_size; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - length__value = read_uint16(pos); - u__nelements = length__value; - - u__nw_size = 0; - u__mem_size = 0; - for (i = 0; i < u__nelements; i++) { - SPICE_GNUC_UNUSED uint8_t *start3 = start2; - size_t data__nw_size, data__mem_size; - uint32_t data__nelements; - { /* data */ - uint16_t width__value; - uint16_t height__value; - pos = start3 + 16; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - width__value = read_uint16(pos); - pos = start3 + 18; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - height__value = read_uint16(pos); - data__nelements = ((width__value + 7) / 8 ) * height__value; - - data__nw_size = data__nelements; - data__mem_size = sizeof(uint8_t) * data__nelements; - } - - u__element__nw_size = 20 + data__nw_size; - u__element__mem_size = sizeof(SpiceRasterGlyph) + data__mem_size; - u__nw_size += u__element__nw_size; - u__mem_size += sizeof(void *) + SPICE_ALIGN(u__element__mem_size, 4); - start2 += u__element__nw_size; - } - u__extra_size = u__mem_size; - } else if ((flags__value & SPICE_STRING_FLAGS_RASTER_A4)) { - uint16_t length__value; - uint8_t *start2 = (start + 3); - uint32_t u__element__nw_size; - uint32_t u__element__mem_size; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - length__value = read_uint16(pos); - u__nelements = length__value; - - u__nw_size = 0; - u__mem_size = 0; - for (i = 0; i < u__nelements; i++) { - SPICE_GNUC_UNUSED uint8_t *start3 = start2; - size_t data__nw_size, data__mem_size; - uint32_t data__nelements; - { /* data */ - uint16_t width__value; - uint16_t height__value; - pos = start3 + 16; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - width__value = read_uint16(pos); - pos = start3 + 18; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - height__value = read_uint16(pos); - data__nelements = ((4 * width__value + 7) / 8 ) * height__value; - - data__nw_size = data__nelements; - data__mem_size = sizeof(uint8_t) * data__nelements; - } - - u__element__nw_size = 20 + data__nw_size; - u__element__mem_size = sizeof(SpiceRasterGlyph) + data__mem_size; - u__nw_size += u__element__nw_size; - u__mem_size += sizeof(void *) + SPICE_ALIGN(u__element__mem_size, 4); - start2 += u__element__nw_size; - } - u__extra_size = u__mem_size; - } else if ((flags__value & SPICE_STRING_FLAGS_RASTER_A8)) { - uint16_t length__value; - uint8_t *start2 = (start + 3); - uint32_t u__element__nw_size; - uint32_t u__element__mem_size; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - length__value = read_uint16(pos); - u__nelements = length__value; - - u__nw_size = 0; - u__mem_size = 0; - for (i = 0; i < u__nelements; i++) { - SPICE_GNUC_UNUSED uint8_t *start3 = start2; - size_t data__nw_size, data__mem_size; - uint32_t data__nelements; - { /* data */ - uint16_t width__value; - uint16_t height__value; - pos = start3 + 16; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - width__value = read_uint16(pos); - pos = start3 + 18; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - height__value = read_uint16(pos); - data__nelements = width__value * height__value; - - data__nw_size = data__nelements; - data__mem_size = sizeof(uint8_t) * data__nelements; - } - - u__element__nw_size = 20 + data__nw_size; - u__element__mem_size = sizeof(SpiceRasterGlyph) + data__mem_size; - u__nw_size += u__element__nw_size; - u__mem_size += sizeof(void *) + SPICE_ALIGN(u__element__mem_size, 4); - start2 += u__element__nw_size; - } - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - nw_size = 3 + u__nw_size; - mem_size = sizeof(SpiceString) + u__extra_size; - - /* Check if struct fits in reported side */ - if (SPICE_UNLIKELY(start + nw_size > message_end)) { - goto error; - } - return mem_size; - - error: - return -1; -} - -static uint8_t * parse_struct_SpiceString(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) -{ - uint8_t *in = message_start + this_ptr_info->offset; - uint8_t *end; - SpiceString *out; - uint32_t i; - - end = struct_data + sizeof(SpiceString); - out = (SpiceString *)struct_data; - - out->length = consume_uint16(&in); - out->flags = consume_uint8(&in); - if ((out->flags & SPICE_STRING_FLAGS_RASTER_A1)) { - uint32_t glyphs__nelements; - void * *ptr_array; - int ptr_array_index; - glyphs__nelements = out->length; - ptr_array_index = 0; - ptr_array = (void **)out->glyphs; - end += sizeof(void *) * glyphs__nelements; - for (i = 0; i < glyphs__nelements; i++) { - SpiceRasterGlyph *out2; - uint32_t data__nelements; - ptr_array[ptr_array_index++] = end; - out2 = (SpiceRasterGlyph *)end; - end += sizeof(SpiceRasterGlyph); - - /* render_pos */ { - out2->render_pos.x = consume_int32(&in); - out2->render_pos.y = consume_int32(&in); - } - /* glyph_origin */ { - out2->glyph_origin.x = consume_int32(&in); - out2->glyph_origin.y = consume_int32(&in); - } - out2->width = consume_uint16(&in); - out2->height = consume_uint16(&in); - data__nelements = ((out2->width + 7) / 8 ) * out2->height; - memcpy(out2->data, in, data__nelements); - in += data__nelements; - end += data__nelements; - /* Align ptr_array element to 4 bytes */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - } - } else if ((out->flags & SPICE_STRING_FLAGS_RASTER_A4)) { - uint32_t glyphs__nelements; - void * *ptr_array; - int ptr_array_index; - glyphs__nelements = out->length; - ptr_array_index = 0; - ptr_array = (void **)out->glyphs; - end += sizeof(void *) * glyphs__nelements; - for (i = 0; i < glyphs__nelements; i++) { - SpiceRasterGlyph *out2; - uint32_t data__nelements; - ptr_array[ptr_array_index++] = end; - out2 = (SpiceRasterGlyph *)end; - end += sizeof(SpiceRasterGlyph); - - /* render_pos */ { - out2->render_pos.x = consume_int32(&in); - out2->render_pos.y = consume_int32(&in); - } - /* glyph_origin */ { - out2->glyph_origin.x = consume_int32(&in); - out2->glyph_origin.y = consume_int32(&in); - } - out2->width = consume_uint16(&in); - out2->height = consume_uint16(&in); - data__nelements = ((4 * out2->width + 7) / 8 ) * out2->height; - memcpy(out2->data, in, data__nelements); - in += data__nelements; - end += data__nelements; - /* Align ptr_array element to 4 bytes */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - } - } else if ((out->flags & SPICE_STRING_FLAGS_RASTER_A8)) { - uint32_t glyphs__nelements; - void * *ptr_array; - int ptr_array_index; - glyphs__nelements = out->length; - ptr_array_index = 0; - ptr_array = (void **)out->glyphs; - end += sizeof(void *) * glyphs__nelements; - for (i = 0; i < glyphs__nelements; i++) { - SpiceRasterGlyph *out2; - uint32_t data__nelements; - ptr_array[ptr_array_index++] = end; - out2 = (SpiceRasterGlyph *)end; - end += sizeof(SpiceRasterGlyph); - - /* render_pos */ { - out2->render_pos.x = consume_int32(&in); - out2->render_pos.y = consume_int32(&in); - } - /* glyph_origin */ { - out2->glyph_origin.x = consume_int32(&in); - out2->glyph_origin.y = consume_int32(&in); - } - out2->width = consume_uint16(&in); - out2->height = consume_uint16(&in); - data__nelements = out2->width * out2->height; - memcpy(out2->data, in, data__nelements); - in += data__nelements; - end += data__nelements; - /* Align ptr_array element to 4 bytes */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - } - } - return end; -} - -static uint8_t * parse_msg_display_draw_text(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[4]; - size_t base__nw_size, base__extra_size; - uint32_t rects__saved_size = 0; - size_t data__nw_size, data__extra_size; - SpiceMsgDisplayDrawText *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__nw_size, clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start4 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - base__nw_size = 20 + clip__nw_size; - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); - size_t str__extra_size; - size_t fore_brush__nw_size, fore_brush__extra_size; - size_t back_brush__nw_size, back_brush__extra_size; - { /* str */ - uint32_t str__value; - pos = (start2 + 0); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - str__value = read_uint32(pos); - if (SPICE_UNLIKELY(str__value == 0)) { - goto error; - } - ptr_size = validate_SpiceString(message_start, message_end, str__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - str__extra_size = ptr_size + /* for alignment */ 3; - } - - { /* fore_brush */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_BRUSH_TYPE_SOLID) { - u__nw_size = 4; - u__extra_size = 0; - } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t pat__extra_size; - { /* pat */ - uint32_t pat__value; - pos = (start4 + 0); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - pat__value = read_uint32(pos); - if (SPICE_UNLIKELY(pat__value == 0)) { - goto error; - } - ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pat__extra_size = ptr_size + /* for alignment */ 3; - } - - u__nw_size = 12; - u__extra_size = pat__extra_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - fore_brush__nw_size = 1 + u__nw_size; - fore_brush__extra_size = u__extra_size; - } - - { /* back_brush */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20 + fore_brush__nw_size); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_BRUSH_TYPE_SOLID) { - u__nw_size = 4; - u__extra_size = 0; - } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t pat__extra_size; - { /* pat */ - uint32_t pat__value; - pos = (start4 + 0); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - pat__value = read_uint32(pos); - if (SPICE_UNLIKELY(pat__value == 0)) { - goto error; - } - ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - pat__extra_size = ptr_size + /* for alignment */ 3; - } - - u__nw_size = 12; - u__extra_size = pat__extra_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - back_brush__nw_size = 1 + u__nw_size; - back_brush__extra_size = u__extra_size; - } - - data__nw_size = 24 + fore_brush__nw_size + back_brush__nw_size; - data__extra_size = str__extra_size + fore_brush__extra_size + back_brush__extra_size; - } - - nw_size = 0 + base__nw_size + data__nw_size; - mem_size = sizeof(SpiceMsgDisplayDrawText) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawText); - in = start; - - out = (SpiceMsgDisplayDrawText *)data; - - /* base */ { - out->base.surface_id = consume_uint32(&in); - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint8(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - } - /* data */ { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceString; - ptr_info[n_ptr].dest = (void **)&out->data.str; - n_ptr++; - /* back_area */ { - out->data.back_area.top = consume_int32(&in); - out->data.back_area.left = consume_int32(&in); - out->data.back_area.bottom = consume_int32(&in); - out->data.back_area.right = consume_int32(&in); - } - /* fore_brush */ { - out->data.fore_brush.type = consume_uint8(&in); - if (out->data.fore_brush.type == SPICE_BRUSH_TYPE_SOLID) { - out->data.fore_brush.u.color = consume_uint32(&in); - } else if (out->data.fore_brush.type == SPICE_BRUSH_TYPE_PATTERN) { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.fore_brush.u.pattern.pat; - n_ptr++; - /* pos */ { - out->data.fore_brush.u.pattern.pos.x = consume_int32(&in); - out->data.fore_brush.u.pattern.pos.y = consume_int32(&in); - } - } - } - /* back_brush */ { - out->data.back_brush.type = consume_uint8(&in); - if (out->data.back_brush.type == SPICE_BRUSH_TYPE_SOLID) { - out->data.back_brush.u.color = consume_uint32(&in); - } else if (out->data.back_brush.type == SPICE_BRUSH_TYPE_PATTERN) { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.back_brush.u.pattern.pat; - n_ptr++; - /* pos */ { - out->data.back_brush.u.pattern.pos.x = consume_int32(&in); - out->data.back_brush.u.pattern.pos.y = consume_int32(&in); - } - } - } - out->data.fore_mode = consume_uint16(&in); - out->data.back_mode = consume_uint16(&in); - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_transparent(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[2]; - size_t base__nw_size, base__extra_size; - uint32_t rects__saved_size = 0; - size_t data__extra_size; - SpiceMsgDisplayDrawTransparent *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__nw_size, clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start4 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - base__nw_size = 20 + clip__nw_size; - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); - size_t src_bitmap__extra_size; - { /* src_bitmap */ - uint32_t src_bitmap__value; - pos = (start2 + 0); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - src_bitmap__value = read_uint32(pos); - ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - src_bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - data__extra_size = src_bitmap__extra_size; - } - - nw_size = 28 + base__nw_size; - mem_size = sizeof(SpiceMsgDisplayDrawTransparent) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawTransparent); - in = start; - - out = (SpiceMsgDisplayDrawTransparent *)data; - - /* base */ { - out->base.surface_id = consume_uint32(&in); - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint8(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - } - /* data */ { - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; - n_ptr++; - /* src_area */ { - out->data.src_area.top = consume_int32(&in); - out->data.src_area.left = consume_int32(&in); - out->data.src_area.bottom = consume_int32(&in); - out->data.src_area.right = consume_int32(&in); - } - out->data.src_color = consume_uint32(&in); - out->data.true_color = consume_uint32(&in); - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_draw_alpha_blend(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SPICE_GNUC_UNUSED intptr_t ptr_size; - uint32_t n_ptr=0; - PointerInfo ptr_info[2]; - size_t base__nw_size, base__extra_size; - uint32_t rects__saved_size = 0; - size_t data__extra_size; - SpiceMsgDisplayDrawAlphaBlend *out; - uint32_t i; - - { /* base */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); - size_t clip__nw_size, clip__extra_size; - { /* clip */ - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); - size_t u__nw_size, u__extra_size; - uint8_t type__value; - { /* u */ - uint32_t u__mem_size; - pos = start3 + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - type__value = read_uint8(pos); - if (type__value == SPICE_CLIP_TYPE_RECTS) { - SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); - size_t rects__nw_size, rects__mem_size; - uint32_t rects__nelements; - { /* rects */ - uint32_t num_rects__value; - pos = start4 + 0; - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - num_rects__value = read_uint32(pos); - rects__nelements = num_rects__value; - - rects__nw_size = (16) * rects__nelements; - rects__mem_size = sizeof(SpiceRect) * rects__nelements; - } - - u__nw_size = 4 + rects__nw_size; - u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; - rects__saved_size = u__nw_size; - u__extra_size = u__mem_size; - } else { - u__nw_size = 0; - u__extra_size = 0; - } - - } - - clip__nw_size = 1 + u__nw_size; - clip__extra_size = u__extra_size; - } - - base__nw_size = 20 + clip__nw_size; - base__extra_size = clip__extra_size; - } - - { /* data */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); - size_t src_bitmap__extra_size; - { /* src_bitmap */ - uint32_t src_bitmap__value; - pos = (start2 + 2); - if (SPICE_UNLIKELY(pos + 4 > message_end)) { - goto error; - } - src_bitmap__value = read_uint32(pos); - ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); - if (SPICE_UNLIKELY(ptr_size < 0)) { - goto error; - } - src_bitmap__extra_size = ptr_size + /* for alignment */ 3; - } - - data__extra_size = src_bitmap__extra_size; - } - - nw_size = 22 + base__nw_size; - mem_size = sizeof(SpiceMsgDisplayDrawAlphaBlend) + base__extra_size + data__extra_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayDrawAlphaBlend); - in = start; - - out = (SpiceMsgDisplayDrawAlphaBlend *)data; - - /* base */ { - out->base.surface_id = consume_uint32(&in); - /* box */ { - out->base.box.top = consume_int32(&in); - out->base.box.left = consume_int32(&in); - out->base.box.bottom = consume_int32(&in); - out->base.box.right = consume_int32(&in); - } - /* clip */ { - out->base.clip.type = consume_uint8(&in); - if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { - ptr_info[n_ptr].offset = in - start; - ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; - ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; - n_ptr++; - in += rects__saved_size; - } - } - } - /* data */ { - out->data.alpha_flags = consume_uint8(&in); - out->data.alpha = consume_uint8(&in); - ptr_info[n_ptr].offset = consume_uint32(&in); - ptr_info[n_ptr].parse = parse_struct_SpiceImage; - ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; - n_ptr++; - /* src_area */ { - out->data.src_area.top = consume_int32(&in); - out->data.src_area.left = consume_int32(&in); - out->data.src_area.bottom = consume_int32(&in); - out->data.src_area.right = consume_int32(&in); - } - } - - assert(in <= message_end); - - for (i = 0; i < n_ptr; i++) { - if (ptr_info[i].offset == 0) { - *ptr_info[i].dest = NULL; - } else { - /* Align to 32 bit */ - end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); - *ptr_info[i].dest = (void *)end; - end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); - if (SPICE_UNLIKELY(end == NULL)) { - goto error; - } - } - } - - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_surface_create(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgSurfaceCreate *out; - - nw_size = 20; - mem_size = sizeof(SpiceMsgSurfaceCreate); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgSurfaceCreate); - in = start; - - out = (SpiceMsgSurfaceCreate *)data; - - out->surface_id = consume_uint32(&in); - out->width = consume_uint32(&in); - out->height = consume_uint32(&in); - out->format = consume_uint32(&in); - out->flags = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_display_surface_destroy(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgSurfaceDestroy *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgSurfaceDestroy); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgSurfaceDestroy); - in = start; - - out = (SpiceMsgSurfaceDestroy *)data; - - out->surface_id = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_DisplayChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[8] = { - parse_msg_display_mode, - parse_SpiceMsgEmpty, - parse_SpiceMsgEmpty, - parse_msg_display_copy_bits, - parse_msg_display_inval_list, - parse_msg_display_inval_all_pixmaps, - parse_msg_display_inval_palette, - parse_SpiceMsgEmpty - }; - static parse_msg_func_t funcs3[5] = { - parse_msg_display_stream_create, - parse_msg_display_stream_data, - parse_msg_display_stream_clip, - parse_msg_display_stream_destroy, - parse_SpiceMsgEmpty - }; - static parse_msg_func_t funcs4[14] = { - parse_msg_display_draw_fill, - parse_msg_display_draw_opaque, - parse_msg_display_draw_copy, - parse_msg_display_draw_blend, - parse_msg_display_draw_blackness, - parse_msg_display_draw_whiteness, - parse_msg_display_draw_invers, - parse_msg_display_draw_rop3, - parse_msg_display_draw_stroke, - parse_msg_display_draw_text, - parse_msg_display_draw_transparent, - parse_msg_display_draw_alpha_blend, - parse_msg_display_surface_create, - parse_msg_display_surface_destroy - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 109) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 122 && message_type < 127) { - return funcs3[message_type-122](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 302 && message_type < 316) { - return funcs4[message_type-302](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} - - - -static uint8_t * parse_msg_inputs_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgInputsInit *out; - - nw_size = 2; - mem_size = sizeof(SpiceMsgInputsInit); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgInputsInit); - in = start; - - out = (SpiceMsgInputsInit *)data; - - out->keyboard_modifiers = consume_uint16(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_inputs_key_modifiers(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgInputsKeyModifiers *out; - - nw_size = 2; - mem_size = sizeof(SpiceMsgInputsKeyModifiers); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgInputsKeyModifiers); - in = start; - - out = (SpiceMsgInputsKeyModifiers *)data; - - out->modifiers = consume_uint16(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_InputsChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[2] = { - parse_msg_inputs_init, - parse_msg_inputs_key_modifiers - }; - static parse_msg_func_t funcs3[1] = { - parse_SpiceMsgEmpty - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 103) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 111 && message_type < 112) { - return funcs3[message_type-111](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} - - - -static uint8_t * parse_msg_cursor_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t cursor__nw_size; - SpiceMsgCursorInit *out; - - { /* cursor */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 9); - size_t u__nw_size; - uint16_t flags__value; - size_t data__nw_size; - uint32_t data__nelements; - { /* u */ - pos = start2 + 0; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - flags__value = read_uint16(pos); - if (!(flags__value & SPICE_CURSOR_FLAGS_NONE)) { - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 2); - u__nw_size = 17; - } else { - u__nw_size = 0; - } - - } - - { /* data */ - data__nelements = message_end - (start2 + 2 + u__nw_size); - - data__nw_size = data__nelements; - } - - cursor__nw_size = 2 + u__nw_size + data__nw_size; - } - - nw_size = 9 + cursor__nw_size; - mem_size = sizeof(SpiceMsgCursorInit); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgCursorInit); - in = start; - - out = (SpiceMsgCursorInit *)data; - - /* position */ { - out->position.x = consume_int16(&in); - out->position.y = consume_int16(&in); - } - out->trail_length = consume_uint16(&in); - out->trail_frequency = consume_uint16(&in); - out->visible = consume_uint8(&in); - /* cursor */ { - uint32_t data__nelements; - out->cursor.flags = consume_uint16(&in); - if (!(out->cursor.flags & SPICE_CURSOR_FLAGS_NONE)) { - out->cursor.header.unique = consume_uint64(&in); - out->cursor.header.type = consume_uint8(&in); - out->cursor.header.width = consume_uint16(&in); - out->cursor.header.height = consume_uint16(&in); - out->cursor.header.hot_spot_x = consume_uint16(&in); - out->cursor.header.hot_spot_y = consume_uint16(&in); - } - data__nelements = (message_end - in) / (1); - /* use array as pointer */ - out->cursor.data = (uint8_t *)in; - out->cursor.data_size = data__nelements; - in += data__nelements; - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_cursor_set(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t cursor__nw_size; - SpiceMsgCursorSet *out; - - { /* cursor */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 5); - size_t u__nw_size; - uint16_t flags__value; - size_t data__nw_size; - uint32_t data__nelements; - { /* u */ - pos = start2 + 0; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - flags__value = read_uint16(pos); - if (!(flags__value & SPICE_CURSOR_FLAGS_NONE)) { - SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 2); - u__nw_size = 17; - } else { - u__nw_size = 0; - } - - } - - { /* data */ - data__nelements = message_end - (start2 + 2 + u__nw_size); - - data__nw_size = data__nelements; - } - - cursor__nw_size = 2 + u__nw_size + data__nw_size; - } - - nw_size = 5 + cursor__nw_size; - mem_size = sizeof(SpiceMsgCursorSet); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgCursorSet); - in = start; - - out = (SpiceMsgCursorSet *)data; - - /* position */ { - out->position.x = consume_int16(&in); - out->position.y = consume_int16(&in); - } - out->visible = consume_uint8(&in); - /* cursor */ { - uint32_t data__nelements; - out->cursor.flags = consume_uint16(&in); - if (!(out->cursor.flags & SPICE_CURSOR_FLAGS_NONE)) { - out->cursor.header.unique = consume_uint64(&in); - out->cursor.header.type = consume_uint8(&in); - out->cursor.header.width = consume_uint16(&in); - out->cursor.header.height = consume_uint16(&in); - out->cursor.header.hot_spot_x = consume_uint16(&in); - out->cursor.header.hot_spot_y = consume_uint16(&in); - } - data__nelements = (message_end - in) / (1); - /* use array as pointer */ - out->cursor.data = (uint8_t *)in; - out->cursor.data_size = data__nelements; - in += data__nelements; - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_cursor_move(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgCursorMove *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgCursorMove); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgCursorMove); - in = start; - - out = (SpiceMsgCursorMove *)data; - - /* position */ { - out->position.x = consume_int16(&in); - out->position.y = consume_int16(&in); - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_cursor_trail(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgCursorTrail *out; - - nw_size = 4; - mem_size = sizeof(SpiceMsgCursorTrail); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgCursorTrail); - in = start; - - out = (SpiceMsgCursorTrail *)data; - - out->length = consume_uint16(&in); - out->frequency = consume_uint16(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_cursor_inval_one(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgDisplayInvalOne *out; - - nw_size = 8; - mem_size = sizeof(SpiceMsgDisplayInvalOne); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgDisplayInvalOne); - in = start; - - out = (SpiceMsgDisplayInvalOne *)data; - - out->id = consume_uint64(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_CursorChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[8] = { - parse_msg_cursor_init, - parse_SpiceMsgEmpty, - parse_msg_cursor_set, - parse_msg_cursor_move, - parse_SpiceMsgEmpty, - parse_msg_cursor_trail, - parse_msg_cursor_inval_one, - parse_SpiceMsgEmpty - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 109) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} - - - -static uint8_t * parse_msg_playback_data(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t data__nw_size; - uint32_t data__nelements; - SpiceMsgPlaybackPacket *out; - - { /* data */ - data__nelements = message_end - (start + 4); - - data__nw_size = data__nelements; - } - - nw_size = 4 + data__nw_size; - mem_size = sizeof(SpiceMsgPlaybackPacket); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgPlaybackPacket); - in = start; - - out = (SpiceMsgPlaybackPacket *)data; - - out->time = consume_uint32(&in); - /* use array as pointer */ - out->data = (uint8_t *)in; - out->data_size = data__nelements; - in += data__nelements; - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_playback_mode(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t data__nw_size; - uint32_t data__nelements; - SpiceMsgPlaybackMode *out; - - { /* data */ - data__nelements = message_end - (start + 6); - - data__nw_size = data__nelements; - } - - nw_size = 6 + data__nw_size; - mem_size = sizeof(SpiceMsgPlaybackMode); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgPlaybackMode); - in = start; - - out = (SpiceMsgPlaybackMode *)data; - - out->time = consume_uint32(&in); - out->mode = consume_uint16(&in); - /* use array as pointer */ - out->data = (uint8_t *)in; - out->data_size = data__nelements; - in += data__nelements; - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_playback_start(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgPlaybackStart *out; - - nw_size = 14; - mem_size = sizeof(SpiceMsgPlaybackStart); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgPlaybackStart); - in = start; - - out = (SpiceMsgPlaybackStart *)data; - - out->channels = consume_uint32(&in); - out->format = consume_uint16(&in); - out->frequency = consume_uint32(&in); - out->time = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_SpiceMsgAudioVolume(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t volume__nw_size, volume__mem_size; - uint32_t volume__nelements; - SpiceMsgAudioVolume *out; - uint32_t i; - - { /* volume */ - uint8_t nchannels__value; - pos = start + 0; - if (SPICE_UNLIKELY(pos + 1 > message_end)) { - goto error; - } - nchannels__value = read_uint8(pos); - volume__nelements = nchannels__value; - - volume__nw_size = (2) * volume__nelements; - volume__mem_size = sizeof(uint16_t) * volume__nelements; - } - - nw_size = 1 + volume__nw_size; - mem_size = sizeof(SpiceMsgAudioVolume) + volume__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgAudioVolume); - in = start; - - out = (SpiceMsgAudioVolume *)data; - - out->nchannels = consume_uint8(&in); - for (i = 0; i < volume__nelements; i++) { - out->volume[i] = consume_uint16(&in); - end += sizeof(uint16_t); - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_SpiceMsgAudioMute(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgAudioMute *out; - - nw_size = 1; - mem_size = sizeof(SpiceMsgAudioMute); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgAudioMute); - in = start; - - out = (SpiceMsgAudioMute *)data; - - out->mute = consume_uint8(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_PlaybackChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[6] = { - parse_msg_playback_data, - parse_msg_playback_mode, - parse_msg_playback_start, - parse_SpiceMsgEmpty, - parse_SpiceMsgAudioVolume, - parse_SpiceMsgAudioMute - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 107) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} - - - -static uint8_t * parse_msg_record_start(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgRecordStart *out; - - nw_size = 10; - mem_size = sizeof(SpiceMsgRecordStart); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgRecordStart); - in = start; - - out = (SpiceMsgRecordStart *)data; - - out->channels = consume_uint32(&in); - out->format = consume_uint16(&in); - out->frequency = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_RecordChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[4] = { - parse_msg_record_start, - parse_SpiceMsgEmpty, - parse_SpiceMsgAudioVolume, - parse_SpiceMsgAudioMute - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 105) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} - - - -static uint8_t * parse_msg_tunnel_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgTunnelInit *out; - - nw_size = 6; - mem_size = sizeof(SpiceMsgTunnelInit); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgTunnelInit); - in = start; - - out = (SpiceMsgTunnelInit *)data; - - out->max_num_of_sockets = consume_uint16(&in); - out->max_socket_data_size = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_tunnel_service_ip_map(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t virtual_ip__nw_size; - SpiceMsgTunnelServiceIpMap *out; - - { /* virtual_ip */ - SPICE_GNUC_UNUSED uint8_t *start2 = (start + 4); - size_t u__nw_size; - uint16_t type__value; - { /* u */ - uint32_t u__nelements; - pos = start2 + 0; - if (SPICE_UNLIKELY(pos + 2 > message_end)) { - goto error; - } - type__value = read_uint16(pos); - if (type__value == SPICE_TUNNEL_IP_TYPE_IPv4) { - u__nelements = 4; - - u__nw_size = u__nelements; - } else { - u__nw_size = 0; - } - - } - - virtual_ip__nw_size = 2 + u__nw_size; - } - - nw_size = 4 + virtual_ip__nw_size; - mem_size = sizeof(SpiceMsgTunnelServiceIpMap); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgTunnelServiceIpMap); - in = start; - - out = (SpiceMsgTunnelServiceIpMap *)data; - - out->service_id = consume_uint32(&in); - /* virtual_ip */ { - out->virtual_ip.type = consume_uint16(&in); - if (out->virtual_ip.type == SPICE_TUNNEL_IP_TYPE_IPv4) { - uint32_t ipv4__nelements; - ipv4__nelements = 4; - memcpy(out->virtual_ip.u.ipv4, in, ipv4__nelements); - in += ipv4__nelements; - } - } - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_tunnel_socket_open(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgTunnelSocketOpen *out; - - nw_size = 10; - mem_size = sizeof(SpiceMsgTunnelSocketOpen); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgTunnelSocketOpen); - in = start; - - out = (SpiceMsgTunnelSocketOpen *)data; - - out->connection_id = consume_uint16(&in); - out->service_id = consume_uint32(&in); - out->tokens = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_tunnel_socket_fin(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgTunnelSocketFin *out; - - nw_size = 2; - mem_size = sizeof(SpiceMsgTunnelSocketFin); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgTunnelSocketFin); - in = start; - - out = (SpiceMsgTunnelSocketFin *)data; - - out->connection_id = consume_uint16(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_tunnel_socket_close(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgTunnelSocketClose *out; - - nw_size = 2; - mem_size = sizeof(SpiceMsgTunnelSocketClose); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgTunnelSocketClose); - in = start; - - out = (SpiceMsgTunnelSocketClose *)data; - - out->connection_id = consume_uint16(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_tunnel_socket_data(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t data__nw_size, data__mem_size; - uint32_t data__nelements; - SpiceMsgTunnelSocketData *out; - - { /* data */ - data__nelements = message_end - (start + 2); - - data__nw_size = data__nelements; - data__mem_size = sizeof(uint8_t) * data__nelements; - } - - nw_size = 2 + data__nw_size; - mem_size = sizeof(SpiceMsgTunnelSocketData) + data__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgTunnelSocketData); - in = start; - - out = (SpiceMsgTunnelSocketData *)data; - - out->connection_id = consume_uint16(&in); - memcpy(out->data, in, data__nelements); - in += data__nelements; - end += data__nelements; - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_tunnel_socket_closed_ack(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgTunnelSocketClosedAck *out; - - nw_size = 2; - mem_size = sizeof(SpiceMsgTunnelSocketClosedAck); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgTunnelSocketClosedAck); - in = start; - - out = (SpiceMsgTunnelSocketClosedAck *)data; - - out->connection_id = consume_uint16(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_msg_tunnel_socket_token(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - SpiceMsgTunnelSocketTokens *out; - - nw_size = 6; - mem_size = sizeof(SpiceMsgTunnelSocketTokens); - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgTunnelSocketTokens); - in = start; - - out = (SpiceMsgTunnelSocketTokens *)data; - - out->connection_id = consume_uint16(&in); - out->num_tokens = consume_uint32(&in); - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_TunnelChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[8] = { - parse_msg_tunnel_init, - parse_msg_tunnel_service_ip_map, - parse_msg_tunnel_socket_open, - parse_msg_tunnel_socket_fin, - parse_msg_tunnel_socket_close, - parse_msg_tunnel_socket_data, - parse_msg_tunnel_socket_closed_ack, - parse_msg_tunnel_socket_token - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 109) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} - - -#ifdef USE_SMARTCARD - -static uint8_t * parse_msg_smartcard_msg(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) -{ - SPICE_GNUC_UNUSED uint8_t *pos; - uint8_t *start = message_start; - uint8_t *data = NULL; - size_t nw_size; - size_t mem_size; - uint8_t *in, *end; - size_t data__nw_size, data__mem_size; - uint32_t data__nelements; - SpiceMsgSmartcard *out; - - { /* data */ - data__nelements = message_end - (start + 12); - - data__nw_size = data__nelements; - data__mem_size = sizeof(uint8_t) * data__nelements; - } - - nw_size = 12 + data__nw_size; - mem_size = sizeof(SpiceMsgSmartcard) + data__mem_size; - - /* Check if message fits in reported side */ - if (start + nw_size > message_end) { - return NULL; - } - - /* Validated extents and calculated size */ - data = (uint8_t *)malloc(mem_size); - if (SPICE_UNLIKELY(data == NULL)) { - goto error; - } - end = data + sizeof(SpiceMsgSmartcard); - in = start; - - out = (SpiceMsgSmartcard *)data; - - out->type = consume_uint32(&in); - out->reader_id = consume_uint32(&in); - out->length = consume_uint32(&in); - memcpy(out->data, in, data__nelements); - in += data__nelements; - end += data__nelements; - - assert(in <= message_end); - assert(end <= data + mem_size); - - *size = end - data; - *free_message = (message_destructor_t) free; - return data; - - error: - if (data != NULL) { - free(data); - } - return NULL; -} - -static uint8_t * parse_SmartcardChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[1] = { - parse_msg_smartcard_msg - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 102) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} -#endif /* USE_SMARTCARD */ - - - -static uint8_t * parse_UsbredirChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - static parse_msg_func_t funcs1[7] = { - parse_msg_migrate, - parse_SpiceMsgData, - parse_msg_set_ack, - parse_msg_ping, - parse_msg_wait_for_channels, - parse_msg_disconnecting, - parse_msg_notify - }; - static parse_msg_func_t funcs2[1] = { - parse_SpiceMsgData - }; - if (message_type >= 1 && message_type < 8) { - return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); - } else if (message_type >= 101 && message_type < 102) { - return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); - } - return NULL; -} - -spice_parse_channel_func_t spice_get_server_channel_parser(uint32_t channel, unsigned int *max_message_type) -{ - static struct {spice_parse_channel_func_t func; unsigned int max_messages; } channels[10] = { - { NULL, 0 }, - { parse_MainChannel_msg, 112}, - { parse_DisplayChannel_msg, 315}, - { parse_InputsChannel_msg, 111}, - { parse_CursorChannel_msg, 108}, - { parse_PlaybackChannel_msg, 106}, - { parse_RecordChannel_msg, 104}, - { parse_TunnelChannel_msg, 108}, -#ifdef USE_SMARTCARD - { parse_SmartcardChannel_msg, 101}, -#else /* USE_SMARTCARD */ - { NULL, 0 }, -#endif /* USE_SMARTCARD */ - { parse_UsbredirChannel_msg, 101} - }; - if (channel < 10) { - if (max_message_type != NULL) { - *max_message_type = channels[channel].max_messages; - } - return channels[channel].func; - } - return NULL; -} - -uint8_t * spice_parse_msg(uint8_t *message_start, uint8_t *message_end, uint32_t channel, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) -{ - spice_parse_channel_func_t func; - func = spice_get_server_channel_parser(channel, NULL); - if (func != NULL) { - return func(message_start, message_end, message_type, minor, size_out, free_message); - } - return NULL; -} diff -Nru spice-gtk-0.9/gtk/generated_marshallers1.c spice-gtk-0.12/gtk/generated_marshallers1.c --- spice-gtk-0.9/gtk/generated_marshallers1.c 2011-10-10 09:35:04.000000000 +0000 +++ spice-gtk-0.12/gtk/generated_marshallers1.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,230 +0,0 @@ -#include "messages.h" -#include "marshallers.h" -#include -#include -#include -#include -#include -#include -#include - -#ifdef _MSC_VER -#pragma warning(disable:4101) -#pragma warning(disable:4018) -#endif - -static void spice_marshall_msgc_ack_sync(SpiceMarshaller *m, SpiceMsgcAckSync *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcAckSync *src; - src = (SpiceMsgcAckSync *)msg; - - spice_marshaller_add_uint32(m, src->generation); -} - -static void spice_marshall_SpiceMsgEmpty(SpiceMarshaller *m, SpiceMsgEmpty *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; -} - -static void spice_marshall_msgc_pong(SpiceMarshaller *m, SpiceMsgPing *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgPing *src; - src = (SpiceMsgPing *)msg; - - spice_marshaller_add_uint32(m, src->id); - spice_marshaller_add_uint64(m, src->timestamp); -} - -static void spice_marshall_SpiceMsgData(SpiceMarshaller *m, SpiceMsgData *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; -} - -static void spice_marshall_msgc_disconnecting(SpiceMarshaller *m, SpiceMsgDisconnect *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgDisconnect *src; - src = (SpiceMsgDisconnect *)msg; - - spice_marshaller_add_uint64(m, src->time_stamp); - spice_marshaller_add_uint32(m, src->reason); -} - -static void spice_marshall_msgc_main_client_info(SpiceMarshaller *m, SpiceMsgcClientInfo *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcClientInfo *src; - src = (SpiceMsgcClientInfo *)msg; - - spice_marshaller_add_uint64(m, src->cache_size); -} - -static void spice_marshall_msgc_main_mouse_mode_request(SpiceMarshaller *m, SpiceMsgcMainMouseModeRequest *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcMainMouseModeRequest *src; - src = (SpiceMsgcMainMouseModeRequest *)msg; - - spice_marshaller_add_uint32(m, src->mode); -} - -static void spice_marshall_msgc_main_agent_start(SpiceMarshaller *m, SpiceMsgcMainAgentStart *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcMainAgentStart *src; - src = (SpiceMsgcMainAgentStart *)msg; - - spice_marshaller_add_uint32(m, src->num_tokens); -} - -static void spice_marshall_msgc_main_agent_token(SpiceMarshaller *m, SpiceMsgcMainAgentTokens *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcMainAgentTokens *src; - src = (SpiceMsgcMainAgentTokens *)msg; - - spice_marshaller_add_uint32(m, src->num_tokens); -} - -static void spice_marshall_msgc_display_init(SpiceMarshaller *m, SpiceMsgcDisplayInit *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcDisplayInit *src; - src = (SpiceMsgcDisplayInit *)msg; - - spice_marshaller_add_uint8(m, src->pixmap_cache_id); - spice_marshaller_add_int64(m, src->pixmap_cache_size); - spice_marshaller_add_uint8(m, src->glz_dictionary_id); - spice_marshaller_add_int32(m, src->glz_dictionary_window_size); -} - -static void spice_marshall_msgc_inputs_key_down(SpiceMarshaller *m, SpiceMsgcKeyDown *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcKeyDown *src; - src = (SpiceMsgcKeyDown *)msg; - - spice_marshaller_add_uint32(m, src->code); -} - -static void spice_marshall_msgc_inputs_key_up(SpiceMarshaller *m, SpiceMsgcKeyUp *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcKeyUp *src; - src = (SpiceMsgcKeyUp *)msg; - - spice_marshaller_add_uint32(m, src->code); -} - -static void spice_marshall_msgc_inputs_key_modifiers(SpiceMarshaller *m, SpiceMsgcKeyModifiers *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcKeyModifiers *src; - src = (SpiceMsgcKeyModifiers *)msg; - - spice_marshaller_add_uint32(m, src->modifiers); -} - -static void spice_marshall_msgc_inputs_mouse_motion(SpiceMarshaller *m, SpiceMsgcMouseMotion *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcMouseMotion *src; - src = (SpiceMsgcMouseMotion *)msg; - - spice_marshaller_add_int32(m, src->dx); - spice_marshaller_add_int32(m, src->dy); - spice_marshaller_add_uint32(m, src->buttons_state); -} - -static void spice_marshall_msgc_inputs_mouse_position(SpiceMarshaller *m, SpiceMsgcMousePosition *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcMousePosition *src; - src = (SpiceMsgcMousePosition *)msg; - - spice_marshaller_add_uint32(m, src->x); - spice_marshaller_add_uint32(m, src->y); - spice_marshaller_add_uint32(m, src->buttons_state); - spice_marshaller_add_uint8(m, src->display_id); -} - -static void spice_marshall_msgc_inputs_mouse_press(SpiceMarshaller *m, SpiceMsgcMousePress *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcMousePress *src; - src = (SpiceMsgcMousePress *)msg; - - spice_marshaller_add_uint32(m, src->button); - spice_marshaller_add_uint32(m, src->buttons_state); -} - -static void spice_marshall_msgc_inputs_mouse_release(SpiceMarshaller *m, SpiceMsgcMouseRelease *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcMouseRelease *src; - src = (SpiceMsgcMouseRelease *)msg; - - spice_marshaller_add_uint32(m, src->button); - spice_marshaller_add_uint32(m, src->buttons_state); -} - -static void spice_marshall_msgc_record_data(SpiceMarshaller *m, SpiceMsgcRecordPacket *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcRecordPacket *src; - src = (SpiceMsgcRecordPacket *)msg; - - spice_marshaller_add_uint32(m, src->time); - /* Don't marshall @nomarshal data */ -} - -static void spice_marshall_msgc_record_mode(SpiceMarshaller *m, SpiceMsgcRecordMode *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcRecordMode *src; - src = (SpiceMsgcRecordMode *)msg; - - spice_marshaller_add_uint32(m, src->time); - spice_marshaller_add_uint32(m, src->mode); - /* Remaining data must be appended manually */ -} - -static void spice_marshall_msgc_record_start_mark(SpiceMarshaller *m, SpiceMsgcRecordStartMark *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcRecordStartMark *src; - src = (SpiceMsgcRecordStartMark *)msg; - - spice_marshaller_add_uint32(m, src->time); -} - -SpiceMessageMarshallers * spice_message_marshallers_get1(void) -{ - static SpiceMessageMarshallers marshallers = {NULL}; - - marshallers.msg_SpiceMsgData = spice_marshall_SpiceMsgData; - marshallers.msg_SpiceMsgEmpty = spice_marshall_SpiceMsgEmpty; - marshallers.msgc_ack_sync = spice_marshall_msgc_ack_sync; - marshallers.msgc_disconnecting = spice_marshall_msgc_disconnecting; - marshallers.msgc_display_init = spice_marshall_msgc_display_init; - marshallers.msgc_inputs_key_down = spice_marshall_msgc_inputs_key_down; - marshallers.msgc_inputs_key_modifiers = spice_marshall_msgc_inputs_key_modifiers; - marshallers.msgc_inputs_key_up = spice_marshall_msgc_inputs_key_up; - marshallers.msgc_inputs_mouse_motion = spice_marshall_msgc_inputs_mouse_motion; - marshallers.msgc_inputs_mouse_position = spice_marshall_msgc_inputs_mouse_position; - marshallers.msgc_inputs_mouse_press = spice_marshall_msgc_inputs_mouse_press; - marshallers.msgc_inputs_mouse_release = spice_marshall_msgc_inputs_mouse_release; - marshallers.msgc_main_agent_start = spice_marshall_msgc_main_agent_start; - marshallers.msgc_main_agent_token = spice_marshall_msgc_main_agent_token; - marshallers.msgc_main_client_info = spice_marshall_msgc_main_client_info; - marshallers.msgc_main_mouse_mode_request = spice_marshall_msgc_main_mouse_mode_request; - marshallers.msgc_pong = spice_marshall_msgc_pong; - marshallers.msgc_record_data = spice_marshall_msgc_record_data; - marshallers.msgc_record_mode = spice_marshall_msgc_record_mode; - marshallers.msgc_record_start_mark = spice_marshall_msgc_record_start_mark; - - return &marshallers; -} - diff -Nru spice-gtk-0.9/gtk/generated_marshallers.c spice-gtk-0.12/gtk/generated_marshallers.c --- spice-gtk-0.9/gtk/generated_marshallers.c 2011-12-22 11:55:43.000000000 +0000 +++ spice-gtk-0.12/gtk/generated_marshallers.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,420 +0,0 @@ -#include "messages.h" -#include "marshallers.h" -#include -#include -#include -#include -#include -#include -#include - -#ifdef _MSC_VER -#pragma warning(disable:4101) -#pragma warning(disable:4018) -#endif - -static void spice_marshall_msgc_ack_sync(SpiceMarshaller *m, SpiceMsgcAckSync *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcAckSync *src; - src = (SpiceMsgcAckSync *)msg; - - spice_marshaller_add_uint32(m, src->generation); -} - -static void spice_marshall_SpiceMsgEmpty(SpiceMarshaller *m, SpiceMsgEmpty *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; -} - -static void spice_marshall_msgc_pong(SpiceMarshaller *m, SpiceMsgPing *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgPing *src; - src = (SpiceMsgPing *)msg; - - spice_marshaller_add_uint32(m, src->id); - spice_marshaller_add_uint64(m, src->timestamp); -} - -static void spice_marshall_SpiceMsgData(SpiceMarshaller *m, SpiceMsgData *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; -} - -static void spice_marshall_msgc_disconnecting(SpiceMarshaller *m, SpiceMsgDisconnect *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgDisconnect *src; - src = (SpiceMsgDisconnect *)msg; - - spice_marshaller_add_uint64(m, src->time_stamp); - spice_marshaller_add_uint32(m, src->reason); -} - -static void spice_marshall_msgc_main_client_info(SpiceMarshaller *m, SpiceMsgcClientInfo *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcClientInfo *src; - src = (SpiceMsgcClientInfo *)msg; - - spice_marshaller_add_uint64(m, src->cache_size); -} - -static void spice_marshall_msgc_main_mouse_mode_request(SpiceMarshaller *m, SpiceMsgcMainMouseModeRequest *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcMainMouseModeRequest *src; - src = (SpiceMsgcMainMouseModeRequest *)msg; - - spice_marshaller_add_uint16(m, src->mode); -} - -static void spice_marshall_msgc_main_agent_start(SpiceMarshaller *m, SpiceMsgcMainAgentStart *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcMainAgentStart *src; - src = (SpiceMsgcMainAgentStart *)msg; - - spice_marshaller_add_uint32(m, src->num_tokens); -} - -static void spice_marshall_msgc_main_agent_token(SpiceMarshaller *m, SpiceMsgcMainAgentTokens *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcMainAgentTokens *src; - src = (SpiceMsgcMainAgentTokens *)msg; - - spice_marshaller_add_uint32(m, src->num_tokens); -} - -static void spice_marshall_msgc_display_init(SpiceMarshaller *m, SpiceMsgcDisplayInit *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcDisplayInit *src; - src = (SpiceMsgcDisplayInit *)msg; - - spice_marshaller_add_uint8(m, src->pixmap_cache_id); - spice_marshaller_add_int64(m, src->pixmap_cache_size); - spice_marshaller_add_uint8(m, src->glz_dictionary_id); - spice_marshaller_add_int32(m, src->glz_dictionary_window_size); -} - -static void spice_marshall_msgc_inputs_key_down(SpiceMarshaller *m, SpiceMsgcKeyDown *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcKeyDown *src; - src = (SpiceMsgcKeyDown *)msg; - - spice_marshaller_add_uint32(m, src->code); -} - -static void spice_marshall_msgc_inputs_key_up(SpiceMarshaller *m, SpiceMsgcKeyUp *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcKeyUp *src; - src = (SpiceMsgcKeyUp *)msg; - - spice_marshaller_add_uint32(m, src->code); -} - -static void spice_marshall_msgc_inputs_key_modifiers(SpiceMarshaller *m, SpiceMsgcKeyModifiers *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcKeyModifiers *src; - src = (SpiceMsgcKeyModifiers *)msg; - - spice_marshaller_add_uint16(m, src->modifiers); -} - -static void spice_marshall_msgc_inputs_mouse_motion(SpiceMarshaller *m, SpiceMsgcMouseMotion *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcMouseMotion *src; - src = (SpiceMsgcMouseMotion *)msg; - - spice_marshaller_add_int32(m, src->dx); - spice_marshaller_add_int32(m, src->dy); - spice_marshaller_add_uint16(m, src->buttons_state); -} - -static void spice_marshall_msgc_inputs_mouse_position(SpiceMarshaller *m, SpiceMsgcMousePosition *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcMousePosition *src; - src = (SpiceMsgcMousePosition *)msg; - - spice_marshaller_add_uint32(m, src->x); - spice_marshaller_add_uint32(m, src->y); - spice_marshaller_add_uint16(m, src->buttons_state); - spice_marshaller_add_uint8(m, src->display_id); -} - -static void spice_marshall_msgc_inputs_mouse_press(SpiceMarshaller *m, SpiceMsgcMousePress *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcMousePress *src; - src = (SpiceMsgcMousePress *)msg; - - spice_marshaller_add_uint8(m, src->button); - spice_marshaller_add_uint16(m, src->buttons_state); -} - -static void spice_marshall_msgc_inputs_mouse_release(SpiceMarshaller *m, SpiceMsgcMouseRelease *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcMouseRelease *src; - src = (SpiceMsgcMouseRelease *)msg; - - spice_marshaller_add_uint8(m, src->button); - spice_marshaller_add_uint16(m, src->buttons_state); -} - -static void spice_marshall_msgc_record_data(SpiceMarshaller *m, SpiceMsgcRecordPacket *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcRecordPacket *src; - src = (SpiceMsgcRecordPacket *)msg; - - spice_marshaller_add_uint32(m, src->time); - /* Don't marshall @nomarshal data */ -} - -static void spice_marshall_msgc_record_mode(SpiceMarshaller *m, SpiceMsgcRecordMode *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcRecordMode *src; - src = (SpiceMsgcRecordMode *)msg; - - spice_marshaller_add_uint32(m, src->time); - spice_marshaller_add_uint16(m, src->mode); - /* Remaining data must be appended manually */ -} - -static void spice_marshall_msgc_record_start_mark(SpiceMarshaller *m, SpiceMsgcRecordStartMark *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcRecordStartMark *src; - src = (SpiceMsgcRecordStartMark *)msg; - - spice_marshaller_add_uint32(m, src->time); -} - -SPICE_GNUC_UNUSED static void spice_marshall_array_uint8(SpiceMarshaller *m, uint8_t *ptr, unsigned count) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - uint32_t i; - - for (i = 0; i < count; i++) { - spice_marshaller_add_uint8(m, *ptr++); - } -} - -static void spice_marshall_msgc_tunnel_service_add(SpiceMarshaller *m, SpiceMsgcTunnelAddGenericService *msg, SpiceMarshaller **name_out, SpiceMarshaller **description_out) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcTunnelAddGenericService *src; - uint32_t i; - *name_out = NULL; - *description_out = NULL; - src = (SpiceMsgcTunnelAddGenericService *)msg; - - spice_marshaller_add_uint16(m, src->type); - spice_marshaller_add_uint32(m, src->id); - spice_marshaller_add_uint32(m, src->group); - spice_marshaller_add_uint32(m, src->port); - *name_out = spice_marshaller_get_ptr_submarshaller(m, 0); - *description_out = spice_marshaller_get_ptr_submarshaller(m, 0); - if (src->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) { - uint8_t *ipv4__element; - spice_marshaller_add_uint16(m, src->u.ip.type); - if (src->u.ip.type == SPICE_TUNNEL_IP_TYPE_IPv4) { - ipv4__element = src->u.ip.u.ipv4; - for (i = 0; i < 4; i++) { - spice_marshaller_add_uint8(m, *ipv4__element); - ipv4__element++; - } - } - } -} - -static void spice_marshall_msgc_tunnel_service_remove(SpiceMarshaller *m, SpiceMsgcTunnelRemoveService *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcTunnelRemoveService *src; - src = (SpiceMsgcTunnelRemoveService *)msg; - - spice_marshaller_add_uint32(m, src->id); -} - -static void spice_marshall_msgc_tunnel_socket_open_ack(SpiceMarshaller *m, SpiceMsgcTunnelSocketOpenAck *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcTunnelSocketOpenAck *src; - src = (SpiceMsgcTunnelSocketOpenAck *)msg; - - spice_marshaller_add_uint16(m, src->connection_id); - spice_marshaller_add_uint32(m, src->tokens); -} - -static void spice_marshall_msgc_tunnel_socket_open_nack(SpiceMarshaller *m, SpiceMsgcTunnelSocketOpenNack *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcTunnelSocketOpenNack *src; - src = (SpiceMsgcTunnelSocketOpenNack *)msg; - - spice_marshaller_add_uint16(m, src->connection_id); -} - -static void spice_marshall_msgc_tunnel_socket_fin(SpiceMarshaller *m, SpiceMsgcTunnelSocketFin *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcTunnelSocketFin *src; - src = (SpiceMsgcTunnelSocketFin *)msg; - - spice_marshaller_add_uint16(m, src->connection_id); -} - -static void spice_marshall_msgc_tunnel_socket_closed(SpiceMarshaller *m, SpiceMsgcTunnelSocketClosed *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcTunnelSocketClosed *src; - src = (SpiceMsgcTunnelSocketClosed *)msg; - - spice_marshaller_add_uint16(m, src->connection_id); -} - -static void spice_marshall_msgc_tunnel_socket_closed_ack(SpiceMarshaller *m, SpiceMsgcTunnelSocketClosedAck *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcTunnelSocketClosedAck *src; - src = (SpiceMsgcTunnelSocketClosedAck *)msg; - - spice_marshaller_add_uint16(m, src->connection_id); -} - -static void spice_marshall_msgc_tunnel_socket_data(SpiceMarshaller *m, SpiceMsgcTunnelSocketData *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcTunnelSocketData *src; - src = (SpiceMsgcTunnelSocketData *)msg; - - spice_marshaller_add_uint16(m, src->connection_id); - /* Remaining data must be appended manually */ -} - -static void spice_marshall_msgc_tunnel_socket_token(SpiceMarshaller *m, SpiceMsgcTunnelSocketTokens *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcTunnelSocketTokens *src; - src = (SpiceMsgcTunnelSocketTokens *)msg; - - spice_marshaller_add_uint16(m, src->connection_id); - spice_marshaller_add_uint32(m, src->num_tokens); -} - -#ifdef USE_SMARTCARD -static void spice_marshall_msgc_smartcard_msg(SpiceMarshaller *m, SpiceMsgcSmartcard *msg, SpiceMarshaller **reader_name_out) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcSmartcard *src; - *reader_name_out = NULL; - src = (SpiceMsgcSmartcard *)msg; - - /* header */ { - spice_marshaller_add_uint32(m, src->header.type); - spice_marshaller_add_uint32(m, src->header.reader_id); - spice_marshaller_add_uint32(m, src->header.length); - } - if (src->header.type == VSC_ReaderAdd) { - /* Don't marshall @nomarshal reader_name */ - } else if (src->header.type == VSC_ATR || src->header.type == VSC_APDU) { - /* Remaining data must be appended manually */ - } else if (src->header.type == VSC_Error) { - spice_marshaller_add_uint32(m, src->error.code); - } -} - -static void spice_marshall_msgc_smartcard_header(SpiceMarshaller *m, VSCMsgHeader *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - VSCMsgHeader *src; - src = (VSCMsgHeader *)msg; - - spice_marshaller_add_uint32(m, src->type); - spice_marshaller_add_uint32(m, src->reader_id); - spice_marshaller_add_uint32(m, src->length); -} - -static void spice_marshall_msgc_smartcard_error(SpiceMarshaller *m, VSCMsgError *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - VSCMsgError *src; - src = (VSCMsgError *)msg; - - spice_marshaller_add_uint32(m, src->code); -} - -static void spice_marshall_msgc_smartcard_atr(SpiceMarshaller *m, VSCMsgATR *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; -} - -static void spice_marshall_msgc_smartcard_reader_add(SpiceMarshaller *m, VSCMsgReaderAdd *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; -} - -#endif /* USE_SMARTCARD */ -SpiceMessageMarshallers * spice_message_marshallers_get(void) -{ - static SpiceMessageMarshallers marshallers = {NULL}; - - marshallers.msg_SpiceMsgData = spice_marshall_SpiceMsgData; - marshallers.msg_SpiceMsgEmpty = spice_marshall_SpiceMsgEmpty; - marshallers.msgc_ack_sync = spice_marshall_msgc_ack_sync; - marshallers.msgc_disconnecting = spice_marshall_msgc_disconnecting; - marshallers.msgc_display_init = spice_marshall_msgc_display_init; - marshallers.msgc_inputs_key_down = spice_marshall_msgc_inputs_key_down; - marshallers.msgc_inputs_key_modifiers = spice_marshall_msgc_inputs_key_modifiers; - marshallers.msgc_inputs_key_up = spice_marshall_msgc_inputs_key_up; - marshallers.msgc_inputs_mouse_motion = spice_marshall_msgc_inputs_mouse_motion; - marshallers.msgc_inputs_mouse_position = spice_marshall_msgc_inputs_mouse_position; - marshallers.msgc_inputs_mouse_press = spice_marshall_msgc_inputs_mouse_press; - marshallers.msgc_inputs_mouse_release = spice_marshall_msgc_inputs_mouse_release; - marshallers.msgc_main_agent_start = spice_marshall_msgc_main_agent_start; - marshallers.msgc_main_agent_token = spice_marshall_msgc_main_agent_token; - marshallers.msgc_main_client_info = spice_marshall_msgc_main_client_info; - marshallers.msgc_main_mouse_mode_request = spice_marshall_msgc_main_mouse_mode_request; - marshallers.msgc_pong = spice_marshall_msgc_pong; - marshallers.msgc_record_data = spice_marshall_msgc_record_data; - marshallers.msgc_record_mode = spice_marshall_msgc_record_mode; - marshallers.msgc_record_start_mark = spice_marshall_msgc_record_start_mark; -#ifdef USE_SMARTCARD - marshallers.msgc_smartcard_atr = spice_marshall_msgc_smartcard_atr; -#endif /* USE_SMARTCARD */ -#ifdef USE_SMARTCARD - marshallers.msgc_smartcard_error = spice_marshall_msgc_smartcard_error; -#endif /* USE_SMARTCARD */ -#ifdef USE_SMARTCARD - marshallers.msgc_smartcard_header = spice_marshall_msgc_smartcard_header; -#endif /* USE_SMARTCARD */ -#ifdef USE_SMARTCARD - marshallers.msgc_smartcard_msg = spice_marshall_msgc_smartcard_msg; -#endif /* USE_SMARTCARD */ -#ifdef USE_SMARTCARD - marshallers.msgc_smartcard_reader_add = spice_marshall_msgc_smartcard_reader_add; -#endif /* USE_SMARTCARD */ - marshallers.msgc_tunnel_service_add = spice_marshall_msgc_tunnel_service_add; - marshallers.msgc_tunnel_service_remove = spice_marshall_msgc_tunnel_service_remove; - marshallers.msgc_tunnel_socket_closed = spice_marshall_msgc_tunnel_socket_closed; - marshallers.msgc_tunnel_socket_closed_ack = spice_marshall_msgc_tunnel_socket_closed_ack; - marshallers.msgc_tunnel_socket_data = spice_marshall_msgc_tunnel_socket_data; - marshallers.msgc_tunnel_socket_fin = spice_marshall_msgc_tunnel_socket_fin; - marshallers.msgc_tunnel_socket_open_ack = spice_marshall_msgc_tunnel_socket_open_ack; - marshallers.msgc_tunnel_socket_open_nack = spice_marshall_msgc_tunnel_socket_open_nack; - marshallers.msgc_tunnel_socket_token = spice_marshall_msgc_tunnel_socket_token; - - return &marshallers; -} - diff -Nru spice-gtk-0.9/gtk/Makefile.am spice-gtk-0.12/gtk/Makefile.am --- spice-gtk-0.9/gtk/Makefile.am 2012-01-31 13:31:38.000000000 +0000 +++ spice-gtk-0.12/gtk/Makefile.am 2012-04-11 13:51:02.000000000 +0000 @@ -2,21 +2,38 @@ SUBDIRS = controller -COMMON_DIR=$(SPICE_COMMON_SRCDIR) -CLIENT_DIR=$(top_srcdir)/client +# Avoid need for perl(Text::CSV) by end users +KEYMAPS = \ + vncdisplaykeymap_xorgevdev2xtkbd.c \ + vncdisplaykeymap_xorgkbd2xtkbd.c \ + vncdisplaykeymap_xorgxquartz2xtkbd.c \ + vncdisplaykeymap_xorgxwin2xtkbd.c \ + vncdisplaykeymap_osx2xtkbd.c \ + vncdisplaykeymap_win322xtkbd.c \ + $(NULL) + +# End users build dependencies can be cleaned +GLIBGENS = \ + spice-glib-enums.c \ + spice-glib-enums.h \ + spice-marshal.c \ + spice-marshal.h \ + spice-widget-enums.c \ + spice-widget-enums.h \ + $(NULL) + +CLEANFILES = $(GLIBGENS) +BUILT_SOURCES = $(GLIBGENS) $(KEYMAPS) EXTRA_DIST = \ - spice-marshal.txt \ + $(KEYMAPS) \ + decode-glz-tmpl.c \ keymap-gen.pl \ keymaps.csv \ - decode-glz-tmpl.c \ map-file \ - generated_demarshallers.c \ - generated_demarshallers1.c \ - generated_marshallers.c \ - generated_marshallers1.c \ - spice-client-gtk.override \ spice-client-gtk-manual.defs \ + spice-client-gtk.override \ + spice-marshal.txt \ $(NULL) bin_PROGRAMS = spicy snappy spicy-stats @@ -25,15 +42,12 @@ acl_PROGRAMS = spice-client-glib-usb-acl-helper endif -lib_LTLIBRARIES = \ - libspice-client-glib-2.0.la +lib_LTLIBRARIES = libspice-client-glib-2.0.la if HAVE_GTK_2 -lib_LTLIBRARIES += \ - libspice-client-gtk-2.0.la +lib_LTLIBRARIES += libspice-client-gtk-2.0.la else -lib_LTLIBRARIES += \ - libspice-client-gtk-3.0.la +lib_LTLIBRARIES += libspice-client-gtk-3.0.la endif if HAVE_LD_VERSION_SCRIPT @@ -44,46 +58,36 @@ KEYMAP_GEN = $(srcdir)/keymap-gen.pl -KEYMAPS = \ - vncdisplaykeymap_xorgevdev2xtkbd.c \ - vncdisplaykeymap_xorgkbd2xtkbd.c \ - vncdisplaykeymap_xorgxquartz2xtkbd.c \ - vncdisplaykeymap_xorgxwin2xtkbd.c \ - vncdisplaykeymap_osx2xtkbd.c \ - vncdisplaykeymap_win322xtkbd.c - -# Avoid need for perl(Text::CSV) by end users -EXTRA_DIST += $(KEYMAPS) +SPICE_COMMON_CPPFLAGS = \ + -DG_LOG_DOMAIN=\"GSpice\" \ + -DSPICE_NO_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED \ + -DSW_CANVAS_CACHE \ + -DSPICE_GTK_LOCALEDIR=\"${SPICE_GTK_LOCALEDIR}\" \ + -DPNP_IDS=\""$(PNP_IDS)"\" \ + -DUSB_IDS=\""$(USB_IDS)"\" \ + -DSPICE_DISABLE_ABORT \ + -I$(top_srcdir) \ + $(COMMON_CFLAGS) \ + $(PIXMAN_CFLAGS) \ + $(CELT051_CFLAGS) \ + $(PULSE_CFLAGS) \ + $(GTK_CFLAGS) \ + $(CAIRO_CFLAGS) \ + $(GLIB2_CFLAGS) \ + $(GIO_CFLAGS) \ + $(GOBJECT2_CFLAGS) \ + $(SSL_CFLAGS) \ + $(SASL_CFLAGS) \ + $(GST_CFLAGS) \ + $(SMARTCARD_CFLAGS) \ + $(USBREDIR_CFLAGS) \ + $(NULL) -SPICE_COMMON_CPPFLAGS = \ - -DG_LOG_DOMAIN=\"GSpice\" \ - -DSW_CANVAS_CACHE \ - -DSPICE_GTK_LOCALEDIR=\"${SPICE_GTK_LOCALEDIR}\" \ - -DPNP_IDS=\""$(PNP_IDS)"\"\ - \ - -I$(COMMON_DIR) \ - -I$(CLIENT_DIR) \ - -I$(CLIENT_DIR)/x11 \ - \ - $(PROTOCOL_CFLAGS) \ - $(PIXMAN_CFLAGS) \ - $(CELT051_CFLAGS) \ - $(PULSE_CFLAGS) \ - $(GTK_CFLAGS) \ - $(CAIRO_CFLAGS) \ - $(GLIB2_CFLAGS) \ - $(GIO_CFLAGS) \ - $(GOBJECT2_CFLAGS) \ - $(SSL_CFLAGS) \ - $(SASL_CFLAGS) \ - $(GST_CFLAGS) \ - $(SMARTCARD_CFLAGS) \ - $(USBREDIR_CFLAGS) \ - $(NULL) - -AM_CPPFLAGS = \ - $(SPICE_COMMON_CPPFLAGS) \ - $(SPICE_CFLAGS) +AM_CPPFLAGS = \ + $(SPICE_COMMON_CPPFLAGS) \ + $(SPICE_CFLAGS) \ + $(NULL) # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html SPICE_GTK_LDFLAGS_COMMON = \ @@ -101,7 +105,6 @@ $(NULL) SPICE_GTK_SOURCES_COMMON = \ - glib-compat.c \ glib-compat.h \ spice-gtk-session.c \ spice-gtk-session-priv.h \ @@ -151,116 +154,99 @@ $(NULL) nodist_libspice_client_gtkinclude_HEADERS = \ - spice-widget-enums.h \ + spice-widget-enums.h \ $(NULL) libspice_client_glib_2_0_la_LDFLAGS = \ - -version-info 5:0:4 \ + -version-info 7:0:6 \ -no-undefined \ $(VERSION_LDFLAGS) \ $(NULL) -libspice_client_glib_2_0_la_LIBADD = \ - $(GLIB2_LIBS) \ - $(GIO_LIBS) \ - $(GOBJECT2_LIBS) \ - $(CELT051_LIBS) \ - $(JPEG_LIBS) \ - $(Z_LIBS) \ - $(PIXMAN_LIBS) \ - $(SSL_LIBS) \ - $(PULSE_LIBS) \ - $(GST_LIBS) \ - $(SASL_LIBS) \ - $(SMARTCARD_LIBS) \ - $(USBREDIR_LIBS) \ +libspice_client_glib_2_0_la_LIBADD = \ + $(top_builddir)/spice-common/common/libspice-common.la \ + $(top_builddir)/spice-common/common/libspice-common-client.la \ + $(GLIB2_LIBS) \ + $(GIO_LIBS) \ + $(GOBJECT2_LIBS) \ + $(CELT051_LIBS) \ + $(JPEG_LIBS) \ + $(Z_LIBS) \ + $(PIXMAN_LIBS) \ + $(SSL_LIBS) \ + $(PULSE_LIBS) \ + $(GST_LIBS) \ + $(SASL_LIBS) \ + $(SMARTCARD_LIBS) \ + $(USBREDIR_LIBS) \ $(NULL) if WITH_POLKIT -USB_ACL_HELPER_SRCS = \ - usb-acl-helper.c \ - usb-acl-helper.h +USB_ACL_HELPER_SRCS = \ + usb-acl-helper.c \ + usb-acl-helper.h \ + $(NULL) AM_CPPFLAGS += -DACL_HELPER_PATH="\"$(ACL_HELPER_DIR)\"" else USB_ACL_HELPER_SRCS = endif -libspice_client_glib_2_0_la_SOURCES = \ - glib-compat.c \ - glib-compat.h \ - spice-audio.c \ - spice-audio-priv.h \ - spice-common.h \ - spice-util.c \ - spice-util-priv.h \ - spice-option.h \ - spice-option.c \ - \ - spice-client.c \ - spice-session.c \ - spice-session-priv.h \ - spice-channel.c \ - spice-channel-cache.h \ - spice-channel-priv.h \ - coroutine.h \ - gio-coroutine.c \ - gio-coroutine.h \ - \ - channel-base.c \ - channel-cursor.c \ - channel-display.c \ - channel-display-priv.h \ - channel-display-mjpeg.c \ - channel-inputs.c \ - channel-main.c \ - channel-playback.c \ - channel-record.c \ - channel-smartcard.c \ - channel-usbredir.c \ - channel-usbredir-priv.h \ - smartcard-manager.c \ - smartcard-manager-priv.h \ - usb-device-manager.c \ - usb-device-manager-priv.h \ - $(USB_ACL_HELPER_SRCS) \ - \ - decode.h \ - decode-glz.c \ - decode-jpeg.c \ - decode-zlib.c \ - \ - $(COMMON_DIR)/mem.c \ - $(COMMON_DIR)/mem.h \ - $(COMMON_DIR)/marshaller.c \ - $(COMMON_DIR)/marshaller.h \ - $(COMMON_DIR)/canvas_utils.c \ - $(COMMON_DIR)/canvas_utils.h \ - $(COMMON_DIR)/sw_canvas.c \ - $(COMMON_DIR)/sw_canvas.h \ - $(COMMON_DIR)/pixman_utils.c \ - $(COMMON_DIR)/pixman_utils.h \ - $(COMMON_DIR)/lines.c \ - $(COMMON_DIR)/lines.h \ - $(COMMON_DIR)/rop3.c \ - $(COMMON_DIR)/rop3.h \ - $(COMMON_DIR)/quic.c \ - $(COMMON_DIR)/quic.h \ - $(COMMON_DIR)/lz.c \ - $(COMMON_DIR)/lz.h \ - $(COMMON_DIR)/region.c \ - $(COMMON_DIR)/region.h \ - $(COMMON_DIR)/ssl_verify.c \ - $(COMMON_DIR)/ssl_verify.h \ +libspice_client_glib_2_0_la_SOURCES = \ + bio-gsocket.c \ + bio-gsocket.h \ + glib-compat.c \ + glib-compat.h \ + spice-audio.c \ + spice-audio-priv.h \ + spice-common.h \ + spice-util.c \ + spice-util-priv.h \ + spice-option.h \ + spice-option.c \ + \ + spice-client.c \ + spice-session.c \ + spice-session-priv.h \ + spice-channel.c \ + spice-channel-cache.h \ + spice-channel-priv.h \ + coroutine.h \ + gio-coroutine.c \ + gio-coroutine.h \ + \ + channel-base.c \ + channel-cursor.c \ + channel-display.c \ + channel-display-priv.h \ + channel-display-mjpeg.c \ + channel-inputs.c \ + channel-main.c \ + channel-playback.c \ + channel-record.c \ + channel-smartcard.c \ + channel-usbredir.c \ + channel-usbredir-priv.h \ + smartcard-manager.c \ + smartcard-manager-priv.h \ + usb-device-manager.c \ + usb-device-manager-priv.h \ + usbutil.c \ + usbutil.h \ + $(USB_ACL_HELPER_SRCS) \ + \ + decode.h \ + decode-glz.c \ + decode-jpeg.c \ + decode-zlib.c \ + \ + $(top_srcdir)/spice-common/common/sw_canvas.c \ + $(top_srcdir)/spice-common/common/sw_canvas.h \ $(NULL) nodist_libspice_client_glib_2_0_la_SOURCES = \ - generated_demarshallers.c \ - generated_demarshallers1.c \ - generated_marshallers.c \ - generated_marshallers1.c \ - spice-glib-enums.c \ - spice-marshal.c \ - spice-marshal.h \ + spice-glib-enums.c \ + spice-marshal.c \ + spice-marshal.h \ $(NULL) libspice_client_glibincludedir = $(includedir)/spice-client-glib-2.0 @@ -285,7 +271,7 @@ $(NULL) nodist_libspice_client_glibinclude_HEADERS = \ - spice-glib-enums.h \ + spice-glib-enums.h \ $(NULL) # file for API compatibility, but we don't want warning during our compilation @@ -320,7 +306,7 @@ libspice_client_glib_2_0_la_LIBADD += $(GTHREAD_LIBS) endif -displaysrc = \ +displaysrc = \ glib-compat.h \ display/edid.h \ display/edid-parse.c \ @@ -350,19 +336,20 @@ $(displaysrc) \ $(NULL) -spicy_LDADD = \ - libspice-client-gtk-$(SPICE_GTK_API_VERSION).la \ - libspice-client-glib-2.0.la \ - $(XRANDR_LIBS) \ - $(GTHREAD_LIBS) \ - $(GTK_LIBS) \ - $(LIBM) \ +spicy_LDADD = \ + libspice-client-gtk-$(SPICE_GTK_API_VERSION).la \ + libspice-client-glib-2.0.la \ + $(XRANDR_LIBS) \ + $(GTHREAD_LIBS) \ + $(GTK_LIBS) \ + $(LIBM) \ $(NULL) spicy_CPPFLAGS = \ $(AM_CPPFLAGS) \ $(XRANDR_CFLAGS) \ $(GTHREAD_CFLAGS) \ + -DSPICE_DISABLE_DEPRECATED \ $(NULL) @@ -402,9 +389,9 @@ spice-cmdline.c \ $(NULL) -snappy_LDADD = \ +snappy_LDADD = \ libspice-client-glib-2.0.la \ - $(GOBJECT2_LIBS) \ + $(GOBJECT2_LIBS) \ $(NULL) spicy_stats_SOURCES = \ @@ -415,7 +402,7 @@ spicy_stats_LDADD = \ libspice-client-glib-2.0.la \ - $(GOBJECT2_LIBS) \ + $(GOBJECT2_LIBS) \ $(NULL) @@ -490,20 +477,6 @@ $< > $@ -# Note despite being autogenerated these are not part of CLEANFILES, they are -# actually a part of EXTRA_DIST, to avoid the need for pyparser by end users -generated_demarshallers.c: $(top_srcdir)/spice.proto - $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include messages.h $< $@ >/dev/null - -generated_demarshallers1.c: $(top_srcdir)/spice1.proto - $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include messages.h --prefix 1 --ptrsize 8 $< $@ >/dev/null - -generated_marshallers.c: $(top_srcdir)/spice.proto - $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include messages.h --include marshallers.h --client $< $@ >/dev/null - -generated_marshallers1.c: $(top_srcdir)/spice1.proto - $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include messages.h --include marshallers.h --client --prefix 1 --ptrsize 8 $< $@ >/dev/null - vncdisplaykeymap.c: $(KEYMAPS) $(KEYMAPS): $(KEYMAP_GEN) keymaps.csv @@ -529,18 +502,11 @@ vncdisplaykeymap_win322xtkbd.c: $(AM_V_GEN)$(KEYMAP_GEN) $(srcdir)/keymaps.csv win32 xtkbd > $@ || rm $@ -CLEANFILES = spice-marshal.c spice-marshal.h \ - spice-glib-enums.c spice-glib-enums.h \ - spice-widget-enums.c spice-widget-enums.h -MAINTAINERCLEANFILES = $(KEYMAPS) - -BUILT_SOURCES = $(CLEANFILES) $(MAINTAINERCLEANFILES) - if WITH_PYTHON pyexec_LTLIBRARIES = SpiceClientGtk.la SpiceClientGtk_la_LIBADD = libspice-client-gtk-2.0.la libspice-client-glib-2.0.la $(PYGTK_LIBS) -SpiceClientGtk_la_CFLAGS = $(GTK_CFLAGS) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) +SpiceClientGtk_la_CFLAGS = $(GTK_CFLAGS) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) $(WARN_PYFLAGS) SpiceClientGtk_la_LDFLAGS = -module -avoid-version -fPIC SpiceClientGtk_la_SOURCES = spice-client-gtk-module.c nodist_SpiceClientGtk_la_SOURCES = spice-client-gtk-module.defs.c @@ -578,34 +544,34 @@ INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) if HAVE_INTROSPECTION -glib_introspection_files = \ - $(libspice_client_glibinclude_HEADERS) \ +glib_introspection_files = \ + $(libspice_client_glibinclude_HEADERS) \ $(nodist_libspice_client_glibinclude_HEADERS) \ - spice-audio.c \ - spice-client.c \ - spice-session.c \ - spice-channel.c \ - spice-glib-enums.c \ - spice-option.c \ - spice-util.c \ - channel-cursor.c \ - channel-display.c \ - channel-inputs.c \ - channel-main.c \ - channel-playback.c \ - channel-record.c \ - channel-smartcard.c \ - channel-usbredir.c \ - smartcard-manager.c \ - usb-device-manager.c \ + spice-audio.c \ + spice-client.c \ + spice-session.c \ + spice-channel.c \ + spice-glib-enums.c \ + spice-option.c \ + spice-util.c \ + channel-cursor.c \ + channel-display.c \ + channel-inputs.c \ + channel-main.c \ + channel-playback.c \ + channel-record.c \ + channel-smartcard.c \ + channel-usbredir.c \ + smartcard-manager.c \ + usb-device-manager.c \ $(NULL) -gtk_introspection_files = \ - $(libspice_client_gtkinclude_HEADERS) \ +gtk_introspection_files = \ + $(libspice_client_gtkinclude_HEADERS) \ $(nodist_libspice_client_gtkinclude_HEADERS) \ - spice-gtk-session.c \ - spice-widget.c \ - spice-grabsequence.c \ + spice-gtk-session.c \ + spice-widget.c \ + spice-grabsequence.c \ $(NULL) SpiceClientGLib-2.0.gir: libspice-client-glib-2.0.la diff -Nru spice-gtk-0.9/gtk/Makefile.in spice-gtk-0.12/gtk/Makefile.in --- spice-gtk-0.9/gtk/Makefile.in 2012-01-31 13:32:26.000000000 +0000 +++ spice-gtk-0.12/gtk/Makefile.in 2012-04-24 11:21:03.000000000 +0000 @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -40,12 +40,8 @@ bin_PROGRAMS = spicy$(EXEEXT) snappy$(EXEEXT) spicy-stats$(EXEEXT) @WITH_POLKIT_TRUE@acl_PROGRAMS = \ @WITH_POLKIT_TRUE@ spice-client-glib-usb-acl-helper$(EXEEXT) -@HAVE_GTK_2_TRUE@am__append_1 = \ -@HAVE_GTK_2_TRUE@ libspice-client-gtk-2.0.la - -@HAVE_GTK_2_FALSE@am__append_2 = \ -@HAVE_GTK_2_FALSE@ libspice-client-gtk-3.0.la - +@HAVE_GTK_2_TRUE@am__append_1 = libspice-client-gtk-2.0.la +@HAVE_GTK_2_FALSE@am__append_2 = libspice-client-gtk-3.0.la @WITH_X11_TRUE@am__append_3 = \ @WITH_X11_TRUE@ spice-widget-x11.c \ @WITH_X11_TRUE@ $(NULL) @@ -83,11 +79,13 @@ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/check_python.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/intltool.m4 \ - $(top_srcdir)/m4/ld-version.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/ld-version.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/manywarnings.m4 \ + $(top_srcdir)/m4/spice-compile-warnings.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -115,6 +113,12 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pyexecdir)" \ "$(DESTDIR)$(acldir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(libspice_client_glibincludedir)" \ @@ -134,8 +138,8 @@ @WITH_PYTHON_TRUE@nodist_SpiceClientGtk_la_OBJECTS = SpiceClientGtk_la-spice-client-gtk-module.defs.lo SpiceClientGtk_la_OBJECTS = $(am_SpiceClientGtk_la_OBJECTS) \ $(nodist_SpiceClientGtk_la_OBJECTS) -AM_V_lt = $(am__v_lt_$(V)) -am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent SpiceClientGtk_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ @@ -143,64 +147,57 @@ $(SpiceClientGtk_la_LDFLAGS) $(LDFLAGS) -o $@ @WITH_PYTHON_TRUE@am_SpiceClientGtk_la_rpath = -rpath $(pyexecdir) @WITH_GTHREAD_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) -libspice_client_glib_2_0_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +libspice_client_glib_2_0_la_DEPENDENCIES = \ + $(top_builddir)/spice-common/common/libspice-common.la \ + $(top_builddir)/spice-common/common/libspice-common-client.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) -am__libspice_client_glib_2_0_la_SOURCES_DIST = glib-compat.c \ - glib-compat.h spice-audio.c spice-audio-priv.h spice-common.h \ - spice-util.c spice-util-priv.h spice-option.h spice-option.c \ - spice-client.c spice-session.c spice-session-priv.h \ - spice-channel.c spice-channel-cache.h spice-channel-priv.h \ - coroutine.h gio-coroutine.c gio-coroutine.h channel-base.c \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_2) +am__libspice_client_glib_2_0_la_SOURCES_DIST = bio-gsocket.c \ + bio-gsocket.h glib-compat.c glib-compat.h spice-audio.c \ + spice-audio-priv.h spice-common.h spice-util.c \ + spice-util-priv.h spice-option.h spice-option.c spice-client.c \ + spice-session.c spice-session-priv.h spice-channel.c \ + spice-channel-cache.h spice-channel-priv.h coroutine.h \ + gio-coroutine.c gio-coroutine.h channel-base.c \ channel-cursor.c channel-display.c channel-display-priv.h \ channel-display-mjpeg.c channel-inputs.c channel-main.c \ channel-playback.c channel-record.c channel-smartcard.c \ channel-usbredir.c channel-usbredir-priv.h smartcard-manager.c \ smartcard-manager-priv.h usb-device-manager.c \ - usb-device-manager-priv.h usb-acl-helper.c usb-acl-helper.h \ - decode.h decode-glz.c decode-jpeg.c decode-zlib.c \ - $(COMMON_DIR)/mem.c $(COMMON_DIR)/mem.h \ - $(COMMON_DIR)/marshaller.c $(COMMON_DIR)/marshaller.h \ - $(COMMON_DIR)/canvas_utils.c $(COMMON_DIR)/canvas_utils.h \ - $(COMMON_DIR)/sw_canvas.c $(COMMON_DIR)/sw_canvas.h \ - $(COMMON_DIR)/pixman_utils.c $(COMMON_DIR)/pixman_utils.h \ - $(COMMON_DIR)/lines.c $(COMMON_DIR)/lines.h \ - $(COMMON_DIR)/rop3.c $(COMMON_DIR)/rop3.h $(COMMON_DIR)/quic.c \ - $(COMMON_DIR)/quic.h $(COMMON_DIR)/lz.c $(COMMON_DIR)/lz.h \ - $(COMMON_DIR)/region.c $(COMMON_DIR)/region.h \ - $(COMMON_DIR)/ssl_verify.c $(COMMON_DIR)/ssl_verify.h \ - spice-pulse.c spice-pulse.h spice-gstaudio.c spice-gstaudio.h \ - continuation.h continuation.c coroutine_ucontext.c \ - coroutine_winfibers.c coroutine_gthread.c -@WITH_POLKIT_TRUE@am__objects_1 = usb-acl-helper.lo -am__objects_2 = -@WITH_PULSE_TRUE@am__objects_3 = spice-pulse.lo $(am__objects_2) -@WITH_GSTAUDIO_TRUE@am__objects_4 = spice-gstaudio.lo $(am__objects_2) + usb-device-manager-priv.h usbutil.c usbutil.h usb-acl-helper.c \ + usb-acl-helper.h decode.h decode-glz.c decode-jpeg.c \ + decode-zlib.c $(top_srcdir)/spice-common/common/sw_canvas.c \ + $(top_srcdir)/spice-common/common/sw_canvas.h spice-pulse.c \ + spice-pulse.h spice-gstaudio.c spice-gstaudio.h continuation.h \ + continuation.c coroutine_ucontext.c coroutine_winfibers.c \ + coroutine_gthread.c +am__objects_1 = +@WITH_POLKIT_TRUE@am__objects_2 = usb-acl-helper.lo $(am__objects_1) +@WITH_PULSE_TRUE@am__objects_3 = spice-pulse.lo $(am__objects_1) +@WITH_GSTAUDIO_TRUE@am__objects_4 = spice-gstaudio.lo $(am__objects_1) @WITH_UCONTEXT_TRUE@am__objects_5 = continuation.lo \ @WITH_UCONTEXT_TRUE@ coroutine_ucontext.lo @WITH_WINFIBER_TRUE@am__objects_6 = coroutine_winfibers.lo @WITH_GTHREAD_TRUE@am__objects_7 = coroutine_gthread.lo -am_libspice_client_glib_2_0_la_OBJECTS = glib-compat.lo spice-audio.lo \ - spice-util.lo spice-option.lo spice-client.lo spice-session.lo \ - spice-channel.lo gio-coroutine.lo channel-base.lo \ - channel-cursor.lo channel-display.lo channel-display-mjpeg.lo \ - channel-inputs.lo channel-main.lo channel-playback.lo \ - channel-record.lo channel-smartcard.lo channel-usbredir.lo \ - smartcard-manager.lo usb-device-manager.lo $(am__objects_1) \ - decode-glz.lo decode-jpeg.lo decode-zlib.lo mem.lo \ - marshaller.lo canvas_utils.lo sw_canvas.lo pixman_utils.lo \ - lines.lo rop3.lo quic.lo lz.lo region.lo ssl_verify.lo \ - $(am__objects_2) $(am__objects_3) $(am__objects_4) \ - $(am__objects_5) $(am__objects_6) $(am__objects_7) -nodist_libspice_client_glib_2_0_la_OBJECTS = \ - generated_demarshallers.lo generated_demarshallers1.lo \ - generated_marshallers.lo generated_marshallers1.lo \ - spice-glib-enums.lo spice-marshal.lo $(am__objects_2) +am_libspice_client_glib_2_0_la_OBJECTS = bio-gsocket.lo glib-compat.lo \ + spice-audio.lo spice-util.lo spice-option.lo spice-client.lo \ + spice-session.lo spice-channel.lo gio-coroutine.lo \ + channel-base.lo channel-cursor.lo channel-display.lo \ + channel-display-mjpeg.lo channel-inputs.lo channel-main.lo \ + channel-playback.lo channel-record.lo channel-smartcard.lo \ + channel-usbredir.lo smartcard-manager.lo usb-device-manager.lo \ + usbutil.lo $(am__objects_2) decode-glz.lo decode-jpeg.lo \ + decode-zlib.lo sw_canvas.lo $(am__objects_1) $(am__objects_3) \ + $(am__objects_4) $(am__objects_5) $(am__objects_6) \ + $(am__objects_7) +nodist_libspice_client_glib_2_0_la_OBJECTS = spice-glib-enums.lo \ + spice-marshal.lo $(am__objects_1) libspice_client_glib_2_0_la_OBJECTS = \ $(am_libspice_client_glib_2_0_la_OBJECTS) \ $(nodist_libspice_client_glib_2_0_la_OBJECTS) @@ -213,20 +210,20 @@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) @HAVE_GTK_2_TRUE@libspice_client_gtk_2_0_la_DEPENDENCIES = \ @HAVE_GTK_2_TRUE@ $(am__DEPENDENCIES_3) -am__libspice_client_gtk_2_0_la_SOURCES_DIST = glib-compat.c \ - glib-compat.h spice-gtk-session.c spice-gtk-session-priv.h \ - spice-widget.c spice-widget-priv.h vncdisplaykeymap.c \ - vncdisplaykeymap.h spice-grabsequence.c spice-grabsequence.h \ - usb-device-widget.c spice-widget-x11.c spice-widget-cairo.c -@WITH_X11_TRUE@am__objects_8 = spice-widget-x11.lo $(am__objects_2) -@WITH_X11_FALSE@am__objects_9 = spice-widget-cairo.lo $(am__objects_2) -am__objects_10 = glib-compat.lo spice-gtk-session.lo spice-widget.lo \ +am__libspice_client_gtk_2_0_la_SOURCES_DIST = glib-compat.h \ + spice-gtk-session.c spice-gtk-session-priv.h spice-widget.c \ + spice-widget-priv.h vncdisplaykeymap.c vncdisplaykeymap.h \ + spice-grabsequence.c spice-grabsequence.h usb-device-widget.c \ + spice-widget-x11.c spice-widget-cairo.c +@WITH_X11_TRUE@am__objects_8 = spice-widget-x11.lo $(am__objects_1) +@WITH_X11_FALSE@am__objects_9 = spice-widget-cairo.lo $(am__objects_1) +am__objects_10 = spice-gtk-session.lo spice-widget.lo \ vncdisplaykeymap.lo spice-grabsequence.lo usb-device-widget.lo \ - $(am__objects_2) $(am__objects_8) $(am__objects_9) + $(am__objects_1) $(am__objects_8) $(am__objects_9) @HAVE_GTK_2_TRUE@am_libspice_client_gtk_2_0_la_OBJECTS = \ @HAVE_GTK_2_TRUE@ $(am__objects_10) am__objects_11 = spice-widget-enums.lo spice-marshal.lo \ - $(am__objects_2) + $(am__objects_1) @HAVE_GTK_2_TRUE@nodist_libspice_client_gtk_2_0_la_OBJECTS = \ @HAVE_GTK_2_TRUE@ $(am__objects_11) libspice_client_gtk_2_0_la_OBJECTS = \ @@ -240,11 +237,11 @@ @HAVE_GTK_2_TRUE@ $(libdir) @HAVE_GTK_2_FALSE@libspice_client_gtk_3_0_la_DEPENDENCIES = \ @HAVE_GTK_2_FALSE@ $(am__DEPENDENCIES_3) -am__libspice_client_gtk_3_0_la_SOURCES_DIST = glib-compat.c \ - glib-compat.h spice-gtk-session.c spice-gtk-session-priv.h \ - spice-widget.c spice-widget-priv.h vncdisplaykeymap.c \ - vncdisplaykeymap.h spice-grabsequence.c spice-grabsequence.h \ - usb-device-widget.c spice-widget-x11.c spice-widget-cairo.c +am__libspice_client_gtk_3_0_la_SOURCES_DIST = glib-compat.h \ + spice-gtk-session.c spice-gtk-session-priv.h spice-widget.c \ + spice-widget-priv.h vncdisplaykeymap.c vncdisplaykeymap.h \ + spice-grabsequence.c spice-grabsequence.h usb-device-widget.c \ + spice-widget-x11.c spice-widget-cairo.c @HAVE_GTK_2_FALSE@am_libspice_client_gtk_3_0_la_OBJECTS = \ @HAVE_GTK_2_FALSE@ $(am__objects_10) @HAVE_GTK_2_FALSE@nodist_libspice_client_gtk_3_0_la_OBJECTS = \ @@ -260,7 +257,7 @@ @HAVE_GTK_2_FALSE@ $(libdir) PROGRAMS = $(acl_PROGRAMS) $(bin_PROGRAMS) am_snappy_OBJECTS = snappy.$(OBJEXT) spice-cmdline.$(OBJEXT) \ - $(am__objects_2) + $(am__objects_1) snappy_OBJECTS = $(am_snappy_OBJECTS) snappy_DEPENDENCIES = libspice-client-glib-2.0.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) @@ -268,7 +265,7 @@ glib-compat.h spice-client-glib-usb-acl-helper.c @WITH_POLKIT_TRUE@am_spice_client_glib_usb_acl_helper_OBJECTS = spice_client_glib_usb_acl_helper-glib-compat.$(OBJEXT) \ @WITH_POLKIT_TRUE@ spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.$(OBJEXT) \ -@WITH_POLKIT_TRUE@ $(am__objects_2) +@WITH_POLKIT_TRUE@ $(am__objects_1) spice_client_glib_usb_acl_helper_OBJECTS = \ $(am_spice_client_glib_usb_acl_helper_OBJECTS) @WITH_POLKIT_TRUE@spice_client_glib_usb_acl_helper_DEPENDENCIES = \ @@ -290,17 +287,17 @@ am__objects_15 = spicy-edid-parse.$(OBJEXT) \ spicy-display-name.$(OBJEXT) spicy-gnome-rr-config.$(OBJEXT) \ spicy-gnome-rr-output-info.$(OBJEXT) spicy-gnome-rr.$(OBJEXT) \ - $(am__objects_2) $(am__objects_12) $(am__objects_13) \ + $(am__objects_1) $(am__objects_12) $(am__objects_13) \ $(am__objects_14) am_spicy_OBJECTS = spicy-spicy.$(OBJEXT) spicy-spice-cmdline.$(OBJEXT) \ - $(am__objects_15) $(am__objects_2) + $(am__objects_15) $(am__objects_1) spicy_OBJECTS = $(am_spicy_OBJECTS) spicy_DEPENDENCIES = libspice-client-gtk-$(SPICE_GTK_API_VERSION).la \ libspice-client-glib-2.0.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_spicy_stats_OBJECTS = spicy-stats.$(OBJEXT) spice-cmdline.$(OBJEXT) \ - $(am__objects_2) + $(am__objects_1) spicy_stats_OBJECTS = $(am_spicy_stats_OBJECTS) spicy_stats_DEPENDENCIES = libspice-client-glib-2.0.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) @@ -314,21 +311,21 @@ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_$(V)) -am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_$(V)) -am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(SpiceClientGtk_la_SOURCES) \ $(nodist_SpiceClientGtk_la_SOURCES) \ @@ -415,6 +412,7 @@ CELT051_LIBDIR = @CELT051_LIBDIR@ CELT051_LIBS = @CELT051_LIBS@ CFLAGS = @CFLAGS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ @@ -465,6 +463,10 @@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ @@ -520,8 +522,6 @@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PROTOCOL_CFLAGS = @PROTOCOL_CFLAGS@ -PROTOCOL_LIBS = @PROTOCOL_LIBS@ PULSE_CFLAGS = @PULSE_CFLAGS@ PULSE_LIBS = @PULSE_LIBS@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ @@ -541,7 +541,6 @@ SMARTCARD_CFLAGS = @SMARTCARD_CFLAGS@ SMARTCARD_LIBS = @SMARTCARD_LIBS@ SPICE_CFLAGS = @SPICE_CFLAGS@ -SPICE_COMMON_SRCDIR = @SPICE_COMMON_SRCDIR@ SPICE_GLIB_CFLAGS = @SPICE_GLIB_CFLAGS@ SPICE_GLIB_REQUIRES = @SPICE_GLIB_REQUIRES@ SPICE_GTK_API_VERSION = @SPICE_GTK_API_VERSION@ @@ -550,14 +549,19 @@ SPICE_GTK_REQUIRES = @SPICE_GTK_REQUIRES@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ +STOW = @STOW@ STRIP = @STRIP@ USBREDIR_CFLAGS = @USBREDIR_CFLAGS@ USBREDIR_LIBS = @USBREDIR_LIBS@ +USB_IDS = @USB_IDS@ USE_NLS = @USE_NLS@ VALAC = @VALAC@ VAPIDIR = @VAPIDIR@ VAPIGEN = @VAPIGEN@ VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_LDFLAGS = @WARN_LDFLAGS@ +WARN_PYFLAGS = @WARN_PYFLAGS@ XGETTEXT = @XGETTEXT@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ @@ -595,6 +599,8 @@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ @@ -613,6 +619,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ @@ -620,56 +627,75 @@ top_srcdir = @top_srcdir@ NULL = SUBDIRS = controller -COMMON_DIR = $(SPICE_COMMON_SRCDIR) -CLIENT_DIR = $(top_srcdir)/client # Avoid need for perl(Text::CSV) by end users -EXTRA_DIST = spice-marshal.txt keymap-gen.pl keymaps.csv \ - decode-glz-tmpl.c map-file generated_demarshallers.c \ - generated_demarshallers1.c generated_marshallers.c \ - generated_marshallers1.c spice-client-gtk.override \ - spice-client-gtk-manual.defs $(NULL) $(KEYMAPS) +KEYMAPS = \ + vncdisplaykeymap_xorgevdev2xtkbd.c \ + vncdisplaykeymap_xorgkbd2xtkbd.c \ + vncdisplaykeymap_xorgxquartz2xtkbd.c \ + vncdisplaykeymap_xorgxwin2xtkbd.c \ + vncdisplaykeymap_osx2xtkbd.c \ + vncdisplaykeymap_win322xtkbd.c \ + $(NULL) + + +# End users build dependencies can be cleaned +GLIBGENS = \ + spice-glib-enums.c \ + spice-glib-enums.h \ + spice-marshal.c \ + spice-marshal.h \ + spice-widget-enums.c \ + spice-widget-enums.h \ + $(NULL) + +CLEANFILES = $(GLIBGENS) $(am__append_15) $(am__append_17) +BUILT_SOURCES = $(GLIBGENS) $(KEYMAPS) +EXTRA_DIST = \ + $(KEYMAPS) \ + decode-glz-tmpl.c \ + keymap-gen.pl \ + keymaps.csv \ + map-file \ + spice-client-gtk-manual.defs \ + spice-client-gtk.override \ + spice-marshal.txt \ + $(NULL) + @WITH_POLKIT_TRUE@acldir = $(ACL_HELPER_DIR) lib_LTLIBRARIES = libspice-client-glib-2.0.la $(am__append_1) \ $(am__append_2) @HAVE_LD_VERSION_SCRIPT_FALSE@VERSION_LDFLAGS = -export-symbols ${srcdir}/sym-file @HAVE_LD_VERSION_SCRIPT_TRUE@VERSION_LDFLAGS = -Wl,--version-script=${srcdir}/map-file KEYMAP_GEN = $(srcdir)/keymap-gen.pl -KEYMAPS = \ - vncdisplaykeymap_xorgevdev2xtkbd.c \ - vncdisplaykeymap_xorgkbd2xtkbd.c \ - vncdisplaykeymap_xorgxquartz2xtkbd.c \ - vncdisplaykeymap_xorgxwin2xtkbd.c \ - vncdisplaykeymap_osx2xtkbd.c \ - vncdisplaykeymap_win322xtkbd.c - SPICE_COMMON_CPPFLAGS = \ - -DG_LOG_DOMAIN=\"GSpice\" \ - -DSW_CANVAS_CACHE \ - -DSPICE_GTK_LOCALEDIR=\"${SPICE_GTK_LOCALEDIR}\" \ - -DPNP_IDS=\""$(PNP_IDS)"\"\ - \ - -I$(COMMON_DIR) \ - -I$(CLIENT_DIR) \ - -I$(CLIENT_DIR)/x11 \ - \ - $(PROTOCOL_CFLAGS) \ - $(PIXMAN_CFLAGS) \ - $(CELT051_CFLAGS) \ - $(PULSE_CFLAGS) \ - $(GTK_CFLAGS) \ - $(CAIRO_CFLAGS) \ - $(GLIB2_CFLAGS) \ - $(GIO_CFLAGS) \ - $(GOBJECT2_CFLAGS) \ - $(SSL_CFLAGS) \ - $(SASL_CFLAGS) \ - $(GST_CFLAGS) \ - $(SMARTCARD_CFLAGS) \ - $(USBREDIR_CFLAGS) \ + -DG_LOG_DOMAIN=\"GSpice\" \ + -DSPICE_NO_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED \ + -DSW_CANVAS_CACHE \ + -DSPICE_GTK_LOCALEDIR=\"${SPICE_GTK_LOCALEDIR}\" \ + -DPNP_IDS=\""$(PNP_IDS)"\" \ + -DUSB_IDS=\""$(USB_IDS)"\" \ + -DSPICE_DISABLE_ABORT \ + -I$(top_srcdir) \ + $(COMMON_CFLAGS) \ + $(PIXMAN_CFLAGS) \ + $(CELT051_CFLAGS) \ + $(PULSE_CFLAGS) \ + $(GTK_CFLAGS) \ + $(CAIRO_CFLAGS) \ + $(GLIB2_CFLAGS) \ + $(GIO_CFLAGS) \ + $(GOBJECT2_CFLAGS) \ + $(SSL_CFLAGS) \ + $(SASL_CFLAGS) \ + $(GST_CFLAGS) \ + $(SMARTCARD_CFLAGS) \ + $(USBREDIR_CFLAGS) \ $(NULL) -AM_CPPFLAGS = $(SPICE_COMMON_CPPFLAGS) $(SPICE_CFLAGS) $(am__append_5) +AM_CPPFLAGS = $(SPICE_COMMON_CPPFLAGS) $(SPICE_CFLAGS) $(NULL) \ + $(am__append_5) # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html SPICE_GTK_LDFLAGS_COMMON = \ @@ -686,11 +712,11 @@ $(LIBM) \ $(NULL) -SPICE_GTK_SOURCES_COMMON = glib-compat.c glib-compat.h \ - spice-gtk-session.c spice-gtk-session-priv.h spice-widget.c \ - spice-widget-priv.h vncdisplaykeymap.c vncdisplaykeymap.h \ - spice-grabsequence.c spice-grabsequence.h usb-device-widget.c \ - $(NULL) $(am__append_3) $(am__append_4) +SPICE_GTK_SOURCES_COMMON = glib-compat.h spice-gtk-session.c \ + spice-gtk-session-priv.h spice-widget.c spice-widget-priv.h \ + vncdisplaykeymap.c vncdisplaykeymap.h spice-grabsequence.c \ + spice-grabsequence.h usb-device-widget.c $(NULL) \ + $(am__append_3) $(am__append_4) nodist_SPICE_GTK_SOURCES_COMMON = \ spice-widget-enums.c \ spice-marshal.c \ @@ -713,58 +739,50 @@ $(NULL) nodist_libspice_client_gtkinclude_HEADERS = \ - spice-widget-enums.h \ + spice-widget-enums.h \ $(NULL) libspice_client_glib_2_0_la_LDFLAGS = \ - -version-info 5:0:4 \ + -version-info 7:0:6 \ -no-undefined \ $(VERSION_LDFLAGS) \ $(NULL) -libspice_client_glib_2_0_la_LIBADD = $(GLIB2_LIBS) $(GIO_LIBS) \ - $(GOBJECT2_LIBS) $(CELT051_LIBS) $(JPEG_LIBS) $(Z_LIBS) \ - $(PIXMAN_LIBS) $(SSL_LIBS) $(PULSE_LIBS) $(GST_LIBS) \ - $(SASL_LIBS) $(SMARTCARD_LIBS) $(USBREDIR_LIBS) $(NULL) \ - $(am__append_11) +libspice_client_glib_2_0_la_LIBADD = \ + $(top_builddir)/spice-common/common/libspice-common.la \ + $(top_builddir)/spice-common/common/libspice-common-client.la \ + $(GLIB2_LIBS) $(GIO_LIBS) $(GOBJECT2_LIBS) $(CELT051_LIBS) \ + $(JPEG_LIBS) $(Z_LIBS) $(PIXMAN_LIBS) $(SSL_LIBS) \ + $(PULSE_LIBS) $(GST_LIBS) $(SASL_LIBS) $(SMARTCARD_LIBS) \ + $(USBREDIR_LIBS) $(NULL) $(am__append_11) @WITH_POLKIT_FALSE@USB_ACL_HELPER_SRCS = @WITH_POLKIT_TRUE@USB_ACL_HELPER_SRCS = \ -@WITH_POLKIT_TRUE@ usb-acl-helper.c \ -@WITH_POLKIT_TRUE@ usb-acl-helper.h +@WITH_POLKIT_TRUE@ usb-acl-helper.c \ +@WITH_POLKIT_TRUE@ usb-acl-helper.h \ +@WITH_POLKIT_TRUE@ $(NULL) -libspice_client_glib_2_0_la_SOURCES = glib-compat.c glib-compat.h \ - spice-audio.c spice-audio-priv.h spice-common.h spice-util.c \ - spice-util-priv.h spice-option.h spice-option.c spice-client.c \ - spice-session.c spice-session-priv.h spice-channel.c \ - spice-channel-cache.h spice-channel-priv.h coroutine.h \ - gio-coroutine.c gio-coroutine.h channel-base.c \ - channel-cursor.c channel-display.c channel-display-priv.h \ +libspice_client_glib_2_0_la_SOURCES = bio-gsocket.c bio-gsocket.h \ + glib-compat.c glib-compat.h spice-audio.c spice-audio-priv.h \ + spice-common.h spice-util.c spice-util-priv.h spice-option.h \ + spice-option.c spice-client.c spice-session.c \ + spice-session-priv.h spice-channel.c spice-channel-cache.h \ + spice-channel-priv.h coroutine.h gio-coroutine.c \ + gio-coroutine.h channel-base.c channel-cursor.c \ + channel-display.c channel-display-priv.h \ channel-display-mjpeg.c channel-inputs.c channel-main.c \ channel-playback.c channel-record.c channel-smartcard.c \ channel-usbredir.c channel-usbredir-priv.h smartcard-manager.c \ smartcard-manager-priv.h usb-device-manager.c \ - usb-device-manager-priv.h $(USB_ACL_HELPER_SRCS) decode.h \ - decode-glz.c decode-jpeg.c decode-zlib.c $(COMMON_DIR)/mem.c \ - $(COMMON_DIR)/mem.h $(COMMON_DIR)/marshaller.c \ - $(COMMON_DIR)/marshaller.h $(COMMON_DIR)/canvas_utils.c \ - $(COMMON_DIR)/canvas_utils.h $(COMMON_DIR)/sw_canvas.c \ - $(COMMON_DIR)/sw_canvas.h $(COMMON_DIR)/pixman_utils.c \ - $(COMMON_DIR)/pixman_utils.h $(COMMON_DIR)/lines.c \ - $(COMMON_DIR)/lines.h $(COMMON_DIR)/rop3.c \ - $(COMMON_DIR)/rop3.h $(COMMON_DIR)/quic.c $(COMMON_DIR)/quic.h \ - $(COMMON_DIR)/lz.c $(COMMON_DIR)/lz.h $(COMMON_DIR)/region.c \ - $(COMMON_DIR)/region.h $(COMMON_DIR)/ssl_verify.c \ - $(COMMON_DIR)/ssl_verify.h $(NULL) $(am__append_6) \ - $(am__append_7) $(am__append_8) $(am__append_9) \ - $(am__append_10) + usb-device-manager-priv.h usbutil.c usbutil.h \ + $(USB_ACL_HELPER_SRCS) decode.h decode-glz.c decode-jpeg.c \ + decode-zlib.c $(top_srcdir)/spice-common/common/sw_canvas.c \ + $(top_srcdir)/spice-common/common/sw_canvas.h $(NULL) \ + $(am__append_6) $(am__append_7) $(am__append_8) \ + $(am__append_9) $(am__append_10) nodist_libspice_client_glib_2_0_la_SOURCES = \ - generated_demarshallers.c \ - generated_demarshallers1.c \ - generated_marshallers.c \ - generated_marshallers1.c \ - spice-glib-enums.c \ - spice-marshal.c \ - spice-marshal.h \ + spice-glib-enums.c \ + spice-marshal.c \ + spice-marshal.h \ $(NULL) libspice_client_glibincludedir = $(includedir)/spice-client-glib-2.0 @@ -789,7 +807,7 @@ $(NULL) nodist_libspice_client_glibinclude_HEADERS = \ - spice-glib-enums.h \ + spice-glib-enums.h \ $(NULL) @@ -812,18 +830,19 @@ $(NULL) spicy_LDADD = \ - libspice-client-gtk-$(SPICE_GTK_API_VERSION).la \ - libspice-client-glib-2.0.la \ - $(XRANDR_LIBS) \ - $(GTHREAD_LIBS) \ - $(GTK_LIBS) \ - $(LIBM) \ + libspice-client-gtk-$(SPICE_GTK_API_VERSION).la \ + libspice-client-glib-2.0.la \ + $(XRANDR_LIBS) \ + $(GTHREAD_LIBS) \ + $(GTK_LIBS) \ + $(LIBM) \ $(NULL) spicy_CPPFLAGS = \ $(AM_CPPFLAGS) \ $(XRANDR_CFLAGS) \ $(GTHREAD_CFLAGS) \ + -DSPICE_DISABLE_DEPRECATED \ $(NULL) @WITH_POLKIT_TRUE@spice_client_glib_usb_acl_helper_SOURCES = \ @@ -856,7 +875,7 @@ snappy_LDADD = \ libspice-client-glib-2.0.la \ - $(GOBJECT2_LIBS) \ + $(GOBJECT2_LIBS) \ $(NULL) spicy_stats_SOURCES = \ @@ -867,17 +886,12 @@ spicy_stats_LDADD = \ libspice-client-glib-2.0.la \ - $(GOBJECT2_LIBS) \ + $(GOBJECT2_LIBS) \ $(NULL) -CLEANFILES = spice-marshal.c spice-marshal.h spice-glib-enums.c \ - spice-glib-enums.h spice-widget-enums.c spice-widget-enums.h \ - $(am__append_15) $(am__append_17) -MAINTAINERCLEANFILES = $(KEYMAPS) -BUILT_SOURCES = $(CLEANFILES) $(MAINTAINERCLEANFILES) @WITH_PYTHON_TRUE@pyexec_LTLIBRARIES = SpiceClientGtk.la @WITH_PYTHON_TRUE@SpiceClientGtk_la_LIBADD = libspice-client-gtk-2.0.la libspice-client-glib-2.0.la $(PYGTK_LIBS) -@WITH_PYTHON_TRUE@SpiceClientGtk_la_CFLAGS = $(GTK_CFLAGS) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) +@WITH_PYTHON_TRUE@SpiceClientGtk_la_CFLAGS = $(GTK_CFLAGS) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) $(WARN_PYFLAGS) @WITH_PYTHON_TRUE@SpiceClientGtk_la_LDFLAGS = -module -avoid-version -fPIC @WITH_PYTHON_TRUE@SpiceClientGtk_la_SOURCES = spice-client-gtk-module.c @WITH_PYTHON_TRUE@nodist_SpiceClientGtk_la_SOURCES = spice-client-gtk-module.defs.c @@ -889,33 +903,33 @@ INTROSPECTION_SCANNER_ARGS = --warn-all --accept-unprefixed --add-include-path=$(builddir) $(PREFIX_ARGS) INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) @HAVE_INTROSPECTION_TRUE@glib_introspection_files = \ -@HAVE_INTROSPECTION_TRUE@ $(libspice_client_glibinclude_HEADERS) \ +@HAVE_INTROSPECTION_TRUE@ $(libspice_client_glibinclude_HEADERS) \ @HAVE_INTROSPECTION_TRUE@ $(nodist_libspice_client_glibinclude_HEADERS) \ -@HAVE_INTROSPECTION_TRUE@ spice-audio.c \ -@HAVE_INTROSPECTION_TRUE@ spice-client.c \ -@HAVE_INTROSPECTION_TRUE@ spice-session.c \ -@HAVE_INTROSPECTION_TRUE@ spice-channel.c \ -@HAVE_INTROSPECTION_TRUE@ spice-glib-enums.c \ -@HAVE_INTROSPECTION_TRUE@ spice-option.c \ -@HAVE_INTROSPECTION_TRUE@ spice-util.c \ -@HAVE_INTROSPECTION_TRUE@ channel-cursor.c \ -@HAVE_INTROSPECTION_TRUE@ channel-display.c \ -@HAVE_INTROSPECTION_TRUE@ channel-inputs.c \ -@HAVE_INTROSPECTION_TRUE@ channel-main.c \ -@HAVE_INTROSPECTION_TRUE@ channel-playback.c \ -@HAVE_INTROSPECTION_TRUE@ channel-record.c \ -@HAVE_INTROSPECTION_TRUE@ channel-smartcard.c \ -@HAVE_INTROSPECTION_TRUE@ channel-usbredir.c \ -@HAVE_INTROSPECTION_TRUE@ smartcard-manager.c \ -@HAVE_INTROSPECTION_TRUE@ usb-device-manager.c \ +@HAVE_INTROSPECTION_TRUE@ spice-audio.c \ +@HAVE_INTROSPECTION_TRUE@ spice-client.c \ +@HAVE_INTROSPECTION_TRUE@ spice-session.c \ +@HAVE_INTROSPECTION_TRUE@ spice-channel.c \ +@HAVE_INTROSPECTION_TRUE@ spice-glib-enums.c \ +@HAVE_INTROSPECTION_TRUE@ spice-option.c \ +@HAVE_INTROSPECTION_TRUE@ spice-util.c \ +@HAVE_INTROSPECTION_TRUE@ channel-cursor.c \ +@HAVE_INTROSPECTION_TRUE@ channel-display.c \ +@HAVE_INTROSPECTION_TRUE@ channel-inputs.c \ +@HAVE_INTROSPECTION_TRUE@ channel-main.c \ +@HAVE_INTROSPECTION_TRUE@ channel-playback.c \ +@HAVE_INTROSPECTION_TRUE@ channel-record.c \ +@HAVE_INTROSPECTION_TRUE@ channel-smartcard.c \ +@HAVE_INTROSPECTION_TRUE@ channel-usbredir.c \ +@HAVE_INTROSPECTION_TRUE@ smartcard-manager.c \ +@HAVE_INTROSPECTION_TRUE@ usb-device-manager.c \ @HAVE_INTROSPECTION_TRUE@ $(NULL) @HAVE_INTROSPECTION_TRUE@gtk_introspection_files = \ -@HAVE_INTROSPECTION_TRUE@ $(libspice_client_gtkinclude_HEADERS) \ +@HAVE_INTROSPECTION_TRUE@ $(libspice_client_gtkinclude_HEADERS) \ @HAVE_INTROSPECTION_TRUE@ $(nodist_libspice_client_gtkinclude_HEADERS) \ -@HAVE_INTROSPECTION_TRUE@ spice-gtk-session.c \ -@HAVE_INTROSPECTION_TRUE@ spice-widget.c \ -@HAVE_INTROSPECTION_TRUE@ spice-grabsequence.c \ +@HAVE_INTROSPECTION_TRUE@ spice-gtk-session.c \ +@HAVE_INTROSPECTION_TRUE@ spice-widget.c \ +@HAVE_INTROSPECTION_TRUE@ spice-grabsequence.c \ @HAVE_INTROSPECTION_TRUE@ $(NULL) @HAVE_INTROSPECTION_TRUE@SpiceClientGLib_2_0_gir_INCLUDES = GObject-2.0 Gio-2.0 @@ -1037,13 +1051,13 @@ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -SpiceClientGtk.la: $(SpiceClientGtk_la_OBJECTS) $(SpiceClientGtk_la_DEPENDENCIES) +SpiceClientGtk.la: $(SpiceClientGtk_la_OBJECTS) $(SpiceClientGtk_la_DEPENDENCIES) $(EXTRA_SpiceClientGtk_la_DEPENDENCIES) $(AM_V_CCLD)$(SpiceClientGtk_la_LINK) $(am_SpiceClientGtk_la_rpath) $(SpiceClientGtk_la_OBJECTS) $(SpiceClientGtk_la_LIBADD) $(LIBS) -libspice-client-glib-2.0.la: $(libspice_client_glib_2_0_la_OBJECTS) $(libspice_client_glib_2_0_la_DEPENDENCIES) +libspice-client-glib-2.0.la: $(libspice_client_glib_2_0_la_OBJECTS) $(libspice_client_glib_2_0_la_DEPENDENCIES) $(EXTRA_libspice_client_glib_2_0_la_DEPENDENCIES) $(AM_V_CCLD)$(libspice_client_glib_2_0_la_LINK) -rpath $(libdir) $(libspice_client_glib_2_0_la_OBJECTS) $(libspice_client_glib_2_0_la_LIBADD) $(LIBS) -libspice-client-gtk-2.0.la: $(libspice_client_gtk_2_0_la_OBJECTS) $(libspice_client_gtk_2_0_la_DEPENDENCIES) +libspice-client-gtk-2.0.la: $(libspice_client_gtk_2_0_la_OBJECTS) $(libspice_client_gtk_2_0_la_DEPENDENCIES) $(EXTRA_libspice_client_gtk_2_0_la_DEPENDENCIES) $(AM_V_CCLD)$(libspice_client_gtk_2_0_la_LINK) $(am_libspice_client_gtk_2_0_la_rpath) $(libspice_client_gtk_2_0_la_OBJECTS) $(libspice_client_gtk_2_0_la_LIBADD) $(LIBS) -libspice-client-gtk-3.0.la: $(libspice_client_gtk_3_0_la_OBJECTS) $(libspice_client_gtk_3_0_la_DEPENDENCIES) +libspice-client-gtk-3.0.la: $(libspice_client_gtk_3_0_la_OBJECTS) $(libspice_client_gtk_3_0_la_DEPENDENCIES) $(EXTRA_libspice_client_gtk_3_0_la_DEPENDENCIES) $(AM_V_CCLD)$(libspice_client_gtk_3_0_la_LINK) $(am_libspice_client_gtk_3_0_la_rpath) $(libspice_client_gtk_3_0_la_OBJECTS) $(libspice_client_gtk_3_0_la_LIBADD) $(LIBS) install-aclPROGRAMS: $(acl_PROGRAMS) @$(NORMAL_INSTALL) @@ -1131,16 +1145,16 @@ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list -snappy$(EXEEXT): $(snappy_OBJECTS) $(snappy_DEPENDENCIES) +snappy$(EXEEXT): $(snappy_OBJECTS) $(snappy_DEPENDENCIES) $(EXTRA_snappy_DEPENDENCIES) @rm -f snappy$(EXEEXT) $(AM_V_CCLD)$(LINK) $(snappy_OBJECTS) $(snappy_LDADD) $(LIBS) -spice-client-glib-usb-acl-helper$(EXEEXT): $(spice_client_glib_usb_acl_helper_OBJECTS) $(spice_client_glib_usb_acl_helper_DEPENDENCIES) +spice-client-glib-usb-acl-helper$(EXEEXT): $(spice_client_glib_usb_acl_helper_OBJECTS) $(spice_client_glib_usb_acl_helper_DEPENDENCIES) $(EXTRA_spice_client_glib_usb_acl_helper_DEPENDENCIES) @rm -f spice-client-glib-usb-acl-helper$(EXEEXT) $(AM_V_CCLD)$(LINK) $(spice_client_glib_usb_acl_helper_OBJECTS) $(spice_client_glib_usb_acl_helper_LDADD) $(LIBS) -spicy$(EXEEXT): $(spicy_OBJECTS) $(spicy_DEPENDENCIES) +spicy$(EXEEXT): $(spicy_OBJECTS) $(spicy_DEPENDENCIES) $(EXTRA_spicy_DEPENDENCIES) @rm -f spicy$(EXEEXT) $(AM_V_CCLD)$(LINK) $(spicy_OBJECTS) $(spicy_LDADD) $(LIBS) -spicy-stats$(EXEEXT): $(spicy_stats_OBJECTS) $(spicy_stats_DEPENDENCIES) +spicy-stats$(EXEEXT): $(spicy_stats_OBJECTS) $(spicy_stats_DEPENDENCIES) $(EXTRA_spicy_stats_DEPENDENCIES) @rm -f spicy-stats$(EXEEXT) $(AM_V_CCLD)$(LINK) $(spicy_stats_OBJECTS) $(spicy_stats_LDADD) $(LIBS) @@ -1152,7 +1166,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SpiceClientGtk_la-spice-client-gtk-module.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SpiceClientGtk_la-spice-client-gtk-module.defs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canvas_utils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bio-gsocket.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/channel-base.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/channel-cursor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/channel-display-mjpeg.Plo@am__quote@ @@ -1170,20 +1184,8 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode-glz.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode-jpeg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode-zlib.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generated_demarshallers.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generated_demarshallers1.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generated_marshallers.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generated_marshallers1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gio-coroutine.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glib-compat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lines.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lz.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/marshaller.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman_utils.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quic.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/region.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rop3.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smartcard-manager.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snappy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spice-audio.Plo@am__quote@ @@ -1216,332 +1218,222 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spicy-spice-cmdline.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spicy-spicy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spicy-stats.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_verify.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sw_canvas.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-acl-helper.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-device-manager.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-device-widget.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usbutil.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncdisplaykeymap.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< SpiceClientGtk_la-spice-client-gtk-module.lo: spice-client-gtk-module.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(SpiceClientGtk_la_CFLAGS) $(CFLAGS) -MT SpiceClientGtk_la-spice-client-gtk-module.lo -MD -MP -MF $(DEPDIR)/SpiceClientGtk_la-spice-client-gtk-module.Tpo -c -o SpiceClientGtk_la-spice-client-gtk-module.lo `test -f 'spice-client-gtk-module.c' || echo '$(srcdir)/'`spice-client-gtk-module.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/SpiceClientGtk_la-spice-client-gtk-module.Tpo $(DEPDIR)/SpiceClientGtk_la-spice-client-gtk-module.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='spice-client-gtk-module.c' object='SpiceClientGtk_la-spice-client-gtk-module.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spice-client-gtk-module.c' object='SpiceClientGtk_la-spice-client-gtk-module.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(SpiceClientGtk_la_CFLAGS) $(CFLAGS) -c -o SpiceClientGtk_la-spice-client-gtk-module.lo `test -f 'spice-client-gtk-module.c' || echo '$(srcdir)/'`spice-client-gtk-module.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(SpiceClientGtk_la_CFLAGS) $(CFLAGS) -c -o SpiceClientGtk_la-spice-client-gtk-module.lo `test -f 'spice-client-gtk-module.c' || echo '$(srcdir)/'`spice-client-gtk-module.c SpiceClientGtk_la-spice-client-gtk-module.defs.lo: spice-client-gtk-module.defs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(SpiceClientGtk_la_CFLAGS) $(CFLAGS) -MT SpiceClientGtk_la-spice-client-gtk-module.defs.lo -MD -MP -MF $(DEPDIR)/SpiceClientGtk_la-spice-client-gtk-module.defs.Tpo -c -o SpiceClientGtk_la-spice-client-gtk-module.defs.lo `test -f 'spice-client-gtk-module.defs.c' || echo '$(srcdir)/'`spice-client-gtk-module.defs.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/SpiceClientGtk_la-spice-client-gtk-module.defs.Tpo $(DEPDIR)/SpiceClientGtk_la-spice-client-gtk-module.defs.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='spice-client-gtk-module.defs.c' object='SpiceClientGtk_la-spice-client-gtk-module.defs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(SpiceClientGtk_la_CFLAGS) $(CFLAGS) -c -o SpiceClientGtk_la-spice-client-gtk-module.defs.lo `test -f 'spice-client-gtk-module.defs.c' || echo '$(srcdir)/'`spice-client-gtk-module.defs.c - -mem.lo: $(COMMON_DIR)/mem.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mem.lo -MD -MP -MF $(DEPDIR)/mem.Tpo -c -o mem.lo `test -f '$(COMMON_DIR)/mem.c' || echo '$(srcdir)/'`$(COMMON_DIR)/mem.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mem.Tpo $(DEPDIR)/mem.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(COMMON_DIR)/mem.c' object='mem.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spice-client-gtk-module.defs.c' object='SpiceClientGtk_la-spice-client-gtk-module.defs.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mem.lo `test -f '$(COMMON_DIR)/mem.c' || echo '$(srcdir)/'`$(COMMON_DIR)/mem.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(SpiceClientGtk_la_CFLAGS) $(CFLAGS) -c -o SpiceClientGtk_la-spice-client-gtk-module.defs.lo `test -f 'spice-client-gtk-module.defs.c' || echo '$(srcdir)/'`spice-client-gtk-module.defs.c -marshaller.lo: $(COMMON_DIR)/marshaller.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT marshaller.lo -MD -MP -MF $(DEPDIR)/marshaller.Tpo -c -o marshaller.lo `test -f '$(COMMON_DIR)/marshaller.c' || echo '$(srcdir)/'`$(COMMON_DIR)/marshaller.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/marshaller.Tpo $(DEPDIR)/marshaller.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(COMMON_DIR)/marshaller.c' object='marshaller.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o marshaller.lo `test -f '$(COMMON_DIR)/marshaller.c' || echo '$(srcdir)/'`$(COMMON_DIR)/marshaller.c - -canvas_utils.lo: $(COMMON_DIR)/canvas_utils.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT canvas_utils.lo -MD -MP -MF $(DEPDIR)/canvas_utils.Tpo -c -o canvas_utils.lo `test -f '$(COMMON_DIR)/canvas_utils.c' || echo '$(srcdir)/'`$(COMMON_DIR)/canvas_utils.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/canvas_utils.Tpo $(DEPDIR)/canvas_utils.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(COMMON_DIR)/canvas_utils.c' object='canvas_utils.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o canvas_utils.lo `test -f '$(COMMON_DIR)/canvas_utils.c' || echo '$(srcdir)/'`$(COMMON_DIR)/canvas_utils.c - -sw_canvas.lo: $(COMMON_DIR)/sw_canvas.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sw_canvas.lo -MD -MP -MF $(DEPDIR)/sw_canvas.Tpo -c -o sw_canvas.lo `test -f '$(COMMON_DIR)/sw_canvas.c' || echo '$(srcdir)/'`$(COMMON_DIR)/sw_canvas.c +sw_canvas.lo: $(top_srcdir)/spice-common/common/sw_canvas.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sw_canvas.lo -MD -MP -MF $(DEPDIR)/sw_canvas.Tpo -c -o sw_canvas.lo `test -f '$(top_srcdir)/spice-common/common/sw_canvas.c' || echo '$(srcdir)/'`$(top_srcdir)/spice-common/common/sw_canvas.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sw_canvas.Tpo $(DEPDIR)/sw_canvas.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(COMMON_DIR)/sw_canvas.c' object='sw_canvas.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sw_canvas.lo `test -f '$(COMMON_DIR)/sw_canvas.c' || echo '$(srcdir)/'`$(COMMON_DIR)/sw_canvas.c - -pixman_utils.lo: $(COMMON_DIR)/pixman_utils.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pixman_utils.lo -MD -MP -MF $(DEPDIR)/pixman_utils.Tpo -c -o pixman_utils.lo `test -f '$(COMMON_DIR)/pixman_utils.c' || echo '$(srcdir)/'`$(COMMON_DIR)/pixman_utils.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/pixman_utils.Tpo $(DEPDIR)/pixman_utils.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(COMMON_DIR)/pixman_utils.c' object='pixman_utils.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pixman_utils.lo `test -f '$(COMMON_DIR)/pixman_utils.c' || echo '$(srcdir)/'`$(COMMON_DIR)/pixman_utils.c - -lines.lo: $(COMMON_DIR)/lines.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lines.lo -MD -MP -MF $(DEPDIR)/lines.Tpo -c -o lines.lo `test -f '$(COMMON_DIR)/lines.c' || echo '$(srcdir)/'`$(COMMON_DIR)/lines.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lines.Tpo $(DEPDIR)/lines.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(COMMON_DIR)/lines.c' object='lines.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lines.lo `test -f '$(COMMON_DIR)/lines.c' || echo '$(srcdir)/'`$(COMMON_DIR)/lines.c - -rop3.lo: $(COMMON_DIR)/rop3.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rop3.lo -MD -MP -MF $(DEPDIR)/rop3.Tpo -c -o rop3.lo `test -f '$(COMMON_DIR)/rop3.c' || echo '$(srcdir)/'`$(COMMON_DIR)/rop3.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rop3.Tpo $(DEPDIR)/rop3.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(COMMON_DIR)/rop3.c' object='rop3.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rop3.lo `test -f '$(COMMON_DIR)/rop3.c' || echo '$(srcdir)/'`$(COMMON_DIR)/rop3.c - -quic.lo: $(COMMON_DIR)/quic.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT quic.lo -MD -MP -MF $(DEPDIR)/quic.Tpo -c -o quic.lo `test -f '$(COMMON_DIR)/quic.c' || echo '$(srcdir)/'`$(COMMON_DIR)/quic.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/quic.Tpo $(DEPDIR)/quic.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(COMMON_DIR)/quic.c' object='quic.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o quic.lo `test -f '$(COMMON_DIR)/quic.c' || echo '$(srcdir)/'`$(COMMON_DIR)/quic.c - -lz.lo: $(COMMON_DIR)/lz.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lz.lo -MD -MP -MF $(DEPDIR)/lz.Tpo -c -o lz.lo `test -f '$(COMMON_DIR)/lz.c' || echo '$(srcdir)/'`$(COMMON_DIR)/lz.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lz.Tpo $(DEPDIR)/lz.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(COMMON_DIR)/lz.c' object='lz.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lz.lo `test -f '$(COMMON_DIR)/lz.c' || echo '$(srcdir)/'`$(COMMON_DIR)/lz.c - -region.lo: $(COMMON_DIR)/region.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT region.lo -MD -MP -MF $(DEPDIR)/region.Tpo -c -o region.lo `test -f '$(COMMON_DIR)/region.c' || echo '$(srcdir)/'`$(COMMON_DIR)/region.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/region.Tpo $(DEPDIR)/region.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(COMMON_DIR)/region.c' object='region.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o region.lo `test -f '$(COMMON_DIR)/region.c' || echo '$(srcdir)/'`$(COMMON_DIR)/region.c - -ssl_verify.lo: $(COMMON_DIR)/ssl_verify.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ssl_verify.lo -MD -MP -MF $(DEPDIR)/ssl_verify.Tpo -c -o ssl_verify.lo `test -f '$(COMMON_DIR)/ssl_verify.c' || echo '$(srcdir)/'`$(COMMON_DIR)/ssl_verify.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ssl_verify.Tpo $(DEPDIR)/ssl_verify.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(COMMON_DIR)/ssl_verify.c' object='ssl_verify.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/spice-common/common/sw_canvas.c' object='sw_canvas.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ssl_verify.lo `test -f '$(COMMON_DIR)/ssl_verify.c' || echo '$(srcdir)/'`$(COMMON_DIR)/ssl_verify.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sw_canvas.lo `test -f '$(top_srcdir)/spice-common/common/sw_canvas.c' || echo '$(srcdir)/'`$(top_srcdir)/spice-common/common/sw_canvas.c spice_client_glib_usb_acl_helper-glib-compat.o: glib-compat.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spice_client_glib_usb_acl_helper_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spice_client_glib_usb_acl_helper-glib-compat.o -MD -MP -MF $(DEPDIR)/spice_client_glib_usb_acl_helper-glib-compat.Tpo -c -o spice_client_glib_usb_acl_helper-glib-compat.o `test -f 'glib-compat.c' || echo '$(srcdir)/'`glib-compat.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spice_client_glib_usb_acl_helper-glib-compat.Tpo $(DEPDIR)/spice_client_glib_usb_acl_helper-glib-compat.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glib-compat.c' object='spice_client_glib_usb_acl_helper-glib-compat.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='glib-compat.c' object='spice_client_glib_usb_acl_helper-glib-compat.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spice_client_glib_usb_acl_helper_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spice_client_glib_usb_acl_helper-glib-compat.o `test -f 'glib-compat.c' || echo '$(srcdir)/'`glib-compat.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spice_client_glib_usb_acl_helper_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spice_client_glib_usb_acl_helper-glib-compat.o `test -f 'glib-compat.c' || echo '$(srcdir)/'`glib-compat.c spice_client_glib_usb_acl_helper-glib-compat.obj: glib-compat.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spice_client_glib_usb_acl_helper_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spice_client_glib_usb_acl_helper-glib-compat.obj -MD -MP -MF $(DEPDIR)/spice_client_glib_usb_acl_helper-glib-compat.Tpo -c -o spice_client_glib_usb_acl_helper-glib-compat.obj `if test -f 'glib-compat.c'; then $(CYGPATH_W) 'glib-compat.c'; else $(CYGPATH_W) '$(srcdir)/glib-compat.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spice_client_glib_usb_acl_helper-glib-compat.Tpo $(DEPDIR)/spice_client_glib_usb_acl_helper-glib-compat.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glib-compat.c' object='spice_client_glib_usb_acl_helper-glib-compat.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='glib-compat.c' object='spice_client_glib_usb_acl_helper-glib-compat.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spice_client_glib_usb_acl_helper_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spice_client_glib_usb_acl_helper-glib-compat.obj `if test -f 'glib-compat.c'; then $(CYGPATH_W) 'glib-compat.c'; else $(CYGPATH_W) '$(srcdir)/glib-compat.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spice_client_glib_usb_acl_helper_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spice_client_glib_usb_acl_helper-glib-compat.obj `if test -f 'glib-compat.c'; then $(CYGPATH_W) 'glib-compat.c'; else $(CYGPATH_W) '$(srcdir)/glib-compat.c'; fi` spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.o: spice-client-glib-usb-acl-helper.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spice_client_glib_usb_acl_helper_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.o -MD -MP -MF $(DEPDIR)/spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.Tpo -c -o spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.o `test -f 'spice-client-glib-usb-acl-helper.c' || echo '$(srcdir)/'`spice-client-glib-usb-acl-helper.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.Tpo $(DEPDIR)/spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='spice-client-glib-usb-acl-helper.c' object='spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spice-client-glib-usb-acl-helper.c' object='spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spice_client_glib_usb_acl_helper_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.o `test -f 'spice-client-glib-usb-acl-helper.c' || echo '$(srcdir)/'`spice-client-glib-usb-acl-helper.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spice_client_glib_usb_acl_helper_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.o `test -f 'spice-client-glib-usb-acl-helper.c' || echo '$(srcdir)/'`spice-client-glib-usb-acl-helper.c spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.obj: spice-client-glib-usb-acl-helper.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spice_client_glib_usb_acl_helper_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.obj -MD -MP -MF $(DEPDIR)/spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.Tpo -c -o spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.obj `if test -f 'spice-client-glib-usb-acl-helper.c'; then $(CYGPATH_W) 'spice-client-glib-usb-acl-helper.c'; else $(CYGPATH_W) '$(srcdir)/spice-client-glib-usb-acl-helper.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.Tpo $(DEPDIR)/spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='spice-client-glib-usb-acl-helper.c' object='spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spice-client-glib-usb-acl-helper.c' object='spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spice_client_glib_usb_acl_helper_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.obj `if test -f 'spice-client-glib-usb-acl-helper.c'; then $(CYGPATH_W) 'spice-client-glib-usb-acl-helper.c'; else $(CYGPATH_W) '$(srcdir)/spice-client-glib-usb-acl-helper.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spice_client_glib_usb_acl_helper_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spice_client_glib_usb_acl_helper-spice-client-glib-usb-acl-helper.obj `if test -f 'spice-client-glib-usb-acl-helper.c'; then $(CYGPATH_W) 'spice-client-glib-usb-acl-helper.c'; else $(CYGPATH_W) '$(srcdir)/spice-client-glib-usb-acl-helper.c'; fi` spicy-spicy.o: spicy.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-spicy.o -MD -MP -MF $(DEPDIR)/spicy-spicy.Tpo -c -o spicy-spicy.o `test -f 'spicy.c' || echo '$(srcdir)/'`spicy.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-spicy.Tpo $(DEPDIR)/spicy-spicy.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='spicy.c' object='spicy-spicy.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spicy.c' object='spicy-spicy.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-spicy.o `test -f 'spicy.c' || echo '$(srcdir)/'`spicy.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-spicy.o `test -f 'spicy.c' || echo '$(srcdir)/'`spicy.c spicy-spicy.obj: spicy.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-spicy.obj -MD -MP -MF $(DEPDIR)/spicy-spicy.Tpo -c -o spicy-spicy.obj `if test -f 'spicy.c'; then $(CYGPATH_W) 'spicy.c'; else $(CYGPATH_W) '$(srcdir)/spicy.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-spicy.Tpo $(DEPDIR)/spicy-spicy.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='spicy.c' object='spicy-spicy.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spicy.c' object='spicy-spicy.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-spicy.obj `if test -f 'spicy.c'; then $(CYGPATH_W) 'spicy.c'; else $(CYGPATH_W) '$(srcdir)/spicy.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-spicy.obj `if test -f 'spicy.c'; then $(CYGPATH_W) 'spicy.c'; else $(CYGPATH_W) '$(srcdir)/spicy.c'; fi` spicy-spice-cmdline.o: spice-cmdline.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-spice-cmdline.o -MD -MP -MF $(DEPDIR)/spicy-spice-cmdline.Tpo -c -o spicy-spice-cmdline.o `test -f 'spice-cmdline.c' || echo '$(srcdir)/'`spice-cmdline.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-spice-cmdline.Tpo $(DEPDIR)/spicy-spice-cmdline.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='spice-cmdline.c' object='spicy-spice-cmdline.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spice-cmdline.c' object='spicy-spice-cmdline.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-spice-cmdline.o `test -f 'spice-cmdline.c' || echo '$(srcdir)/'`spice-cmdline.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-spice-cmdline.o `test -f 'spice-cmdline.c' || echo '$(srcdir)/'`spice-cmdline.c spicy-spice-cmdline.obj: spice-cmdline.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-spice-cmdline.obj -MD -MP -MF $(DEPDIR)/spicy-spice-cmdline.Tpo -c -o spicy-spice-cmdline.obj `if test -f 'spice-cmdline.c'; then $(CYGPATH_W) 'spice-cmdline.c'; else $(CYGPATH_W) '$(srcdir)/spice-cmdline.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-spice-cmdline.Tpo $(DEPDIR)/spicy-spice-cmdline.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='spice-cmdline.c' object='spicy-spice-cmdline.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spice-cmdline.c' object='spicy-spice-cmdline.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-spice-cmdline.obj `if test -f 'spice-cmdline.c'; then $(CYGPATH_W) 'spice-cmdline.c'; else $(CYGPATH_W) '$(srcdir)/spice-cmdline.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-spice-cmdline.obj `if test -f 'spice-cmdline.c'; then $(CYGPATH_W) 'spice-cmdline.c'; else $(CYGPATH_W) '$(srcdir)/spice-cmdline.c'; fi` spicy-edid-parse.o: display/edid-parse.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-edid-parse.o -MD -MP -MF $(DEPDIR)/spicy-edid-parse.Tpo -c -o spicy-edid-parse.o `test -f 'display/edid-parse.c' || echo '$(srcdir)/'`display/edid-parse.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-edid-parse.Tpo $(DEPDIR)/spicy-edid-parse.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/edid-parse.c' object='spicy-edid-parse.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/edid-parse.c' object='spicy-edid-parse.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-edid-parse.o `test -f 'display/edid-parse.c' || echo '$(srcdir)/'`display/edid-parse.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-edid-parse.o `test -f 'display/edid-parse.c' || echo '$(srcdir)/'`display/edid-parse.c spicy-edid-parse.obj: display/edid-parse.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-edid-parse.obj -MD -MP -MF $(DEPDIR)/spicy-edid-parse.Tpo -c -o spicy-edid-parse.obj `if test -f 'display/edid-parse.c'; then $(CYGPATH_W) 'display/edid-parse.c'; else $(CYGPATH_W) '$(srcdir)/display/edid-parse.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-edid-parse.Tpo $(DEPDIR)/spicy-edid-parse.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/edid-parse.c' object='spicy-edid-parse.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/edid-parse.c' object='spicy-edid-parse.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-edid-parse.obj `if test -f 'display/edid-parse.c'; then $(CYGPATH_W) 'display/edid-parse.c'; else $(CYGPATH_W) '$(srcdir)/display/edid-parse.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-edid-parse.obj `if test -f 'display/edid-parse.c'; then $(CYGPATH_W) 'display/edid-parse.c'; else $(CYGPATH_W) '$(srcdir)/display/edid-parse.c'; fi` spicy-display-name.o: display/display-name.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-display-name.o -MD -MP -MF $(DEPDIR)/spicy-display-name.Tpo -c -o spicy-display-name.o `test -f 'display/display-name.c' || echo '$(srcdir)/'`display/display-name.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-display-name.Tpo $(DEPDIR)/spicy-display-name.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/display-name.c' object='spicy-display-name.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/display-name.c' object='spicy-display-name.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-display-name.o `test -f 'display/display-name.c' || echo '$(srcdir)/'`display/display-name.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-display-name.o `test -f 'display/display-name.c' || echo '$(srcdir)/'`display/display-name.c spicy-display-name.obj: display/display-name.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-display-name.obj -MD -MP -MF $(DEPDIR)/spicy-display-name.Tpo -c -o spicy-display-name.obj `if test -f 'display/display-name.c'; then $(CYGPATH_W) 'display/display-name.c'; else $(CYGPATH_W) '$(srcdir)/display/display-name.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-display-name.Tpo $(DEPDIR)/spicy-display-name.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/display-name.c' object='spicy-display-name.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/display-name.c' object='spicy-display-name.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-display-name.obj `if test -f 'display/display-name.c'; then $(CYGPATH_W) 'display/display-name.c'; else $(CYGPATH_W) '$(srcdir)/display/display-name.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-display-name.obj `if test -f 'display/display-name.c'; then $(CYGPATH_W) 'display/display-name.c'; else $(CYGPATH_W) '$(srcdir)/display/display-name.c'; fi` spicy-gnome-rr-config.o: display/gnome-rr-config.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-gnome-rr-config.o -MD -MP -MF $(DEPDIR)/spicy-gnome-rr-config.Tpo -c -o spicy-gnome-rr-config.o `test -f 'display/gnome-rr-config.c' || echo '$(srcdir)/'`display/gnome-rr-config.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-gnome-rr-config.Tpo $(DEPDIR)/spicy-gnome-rr-config.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/gnome-rr-config.c' object='spicy-gnome-rr-config.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/gnome-rr-config.c' object='spicy-gnome-rr-config.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-config.o `test -f 'display/gnome-rr-config.c' || echo '$(srcdir)/'`display/gnome-rr-config.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-config.o `test -f 'display/gnome-rr-config.c' || echo '$(srcdir)/'`display/gnome-rr-config.c spicy-gnome-rr-config.obj: display/gnome-rr-config.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-gnome-rr-config.obj -MD -MP -MF $(DEPDIR)/spicy-gnome-rr-config.Tpo -c -o spicy-gnome-rr-config.obj `if test -f 'display/gnome-rr-config.c'; then $(CYGPATH_W) 'display/gnome-rr-config.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-config.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-gnome-rr-config.Tpo $(DEPDIR)/spicy-gnome-rr-config.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/gnome-rr-config.c' object='spicy-gnome-rr-config.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/gnome-rr-config.c' object='spicy-gnome-rr-config.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-config.obj `if test -f 'display/gnome-rr-config.c'; then $(CYGPATH_W) 'display/gnome-rr-config.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-config.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-config.obj `if test -f 'display/gnome-rr-config.c'; then $(CYGPATH_W) 'display/gnome-rr-config.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-config.c'; fi` spicy-gnome-rr-output-info.o: display/gnome-rr-output-info.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-gnome-rr-output-info.o -MD -MP -MF $(DEPDIR)/spicy-gnome-rr-output-info.Tpo -c -o spicy-gnome-rr-output-info.o `test -f 'display/gnome-rr-output-info.c' || echo '$(srcdir)/'`display/gnome-rr-output-info.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-gnome-rr-output-info.Tpo $(DEPDIR)/spicy-gnome-rr-output-info.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/gnome-rr-output-info.c' object='spicy-gnome-rr-output-info.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/gnome-rr-output-info.c' object='spicy-gnome-rr-output-info.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-output-info.o `test -f 'display/gnome-rr-output-info.c' || echo '$(srcdir)/'`display/gnome-rr-output-info.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-output-info.o `test -f 'display/gnome-rr-output-info.c' || echo '$(srcdir)/'`display/gnome-rr-output-info.c spicy-gnome-rr-output-info.obj: display/gnome-rr-output-info.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-gnome-rr-output-info.obj -MD -MP -MF $(DEPDIR)/spicy-gnome-rr-output-info.Tpo -c -o spicy-gnome-rr-output-info.obj `if test -f 'display/gnome-rr-output-info.c'; then $(CYGPATH_W) 'display/gnome-rr-output-info.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-output-info.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-gnome-rr-output-info.Tpo $(DEPDIR)/spicy-gnome-rr-output-info.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/gnome-rr-output-info.c' object='spicy-gnome-rr-output-info.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/gnome-rr-output-info.c' object='spicy-gnome-rr-output-info.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-output-info.obj `if test -f 'display/gnome-rr-output-info.c'; then $(CYGPATH_W) 'display/gnome-rr-output-info.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-output-info.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-output-info.obj `if test -f 'display/gnome-rr-output-info.c'; then $(CYGPATH_W) 'display/gnome-rr-output-info.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-output-info.c'; fi` spicy-gnome-rr.o: display/gnome-rr.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-gnome-rr.o -MD -MP -MF $(DEPDIR)/spicy-gnome-rr.Tpo -c -o spicy-gnome-rr.o `test -f 'display/gnome-rr.c' || echo '$(srcdir)/'`display/gnome-rr.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-gnome-rr.Tpo $(DEPDIR)/spicy-gnome-rr.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/gnome-rr.c' object='spicy-gnome-rr.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/gnome-rr.c' object='spicy-gnome-rr.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr.o `test -f 'display/gnome-rr.c' || echo '$(srcdir)/'`display/gnome-rr.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr.o `test -f 'display/gnome-rr.c' || echo '$(srcdir)/'`display/gnome-rr.c spicy-gnome-rr.obj: display/gnome-rr.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-gnome-rr.obj -MD -MP -MF $(DEPDIR)/spicy-gnome-rr.Tpo -c -o spicy-gnome-rr.obj `if test -f 'display/gnome-rr.c'; then $(CYGPATH_W) 'display/gnome-rr.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-gnome-rr.Tpo $(DEPDIR)/spicy-gnome-rr.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/gnome-rr.c' object='spicy-gnome-rr.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/gnome-rr.c' object='spicy-gnome-rr.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr.obj `if test -f 'display/gnome-rr.c'; then $(CYGPATH_W) 'display/gnome-rr.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr.obj `if test -f 'display/gnome-rr.c'; then $(CYGPATH_W) 'display/gnome-rr.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr.c'; fi` spicy-gnome-rr-x11.o: display/gnome-rr-x11.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-gnome-rr-x11.o -MD -MP -MF $(DEPDIR)/spicy-gnome-rr-x11.Tpo -c -o spicy-gnome-rr-x11.o `test -f 'display/gnome-rr-x11.c' || echo '$(srcdir)/'`display/gnome-rr-x11.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-gnome-rr-x11.Tpo $(DEPDIR)/spicy-gnome-rr-x11.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/gnome-rr-x11.c' object='spicy-gnome-rr-x11.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/gnome-rr-x11.c' object='spicy-gnome-rr-x11.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-x11.o `test -f 'display/gnome-rr-x11.c' || echo '$(srcdir)/'`display/gnome-rr-x11.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-x11.o `test -f 'display/gnome-rr-x11.c' || echo '$(srcdir)/'`display/gnome-rr-x11.c spicy-gnome-rr-x11.obj: display/gnome-rr-x11.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-gnome-rr-x11.obj -MD -MP -MF $(DEPDIR)/spicy-gnome-rr-x11.Tpo -c -o spicy-gnome-rr-x11.obj `if test -f 'display/gnome-rr-x11.c'; then $(CYGPATH_W) 'display/gnome-rr-x11.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-x11.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-gnome-rr-x11.Tpo $(DEPDIR)/spicy-gnome-rr-x11.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/gnome-rr-x11.c' object='spicy-gnome-rr-x11.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/gnome-rr-x11.c' object='spicy-gnome-rr-x11.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-x11.obj `if test -f 'display/gnome-rr-x11.c'; then $(CYGPATH_W) 'display/gnome-rr-x11.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-x11.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-x11.obj `if test -f 'display/gnome-rr-x11.c'; then $(CYGPATH_W) 'display/gnome-rr-x11.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-x11.c'; fi` spicy-gnome-rr-windows.o: display/gnome-rr-windows.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-gnome-rr-windows.o -MD -MP -MF $(DEPDIR)/spicy-gnome-rr-windows.Tpo -c -o spicy-gnome-rr-windows.o `test -f 'display/gnome-rr-windows.c' || echo '$(srcdir)/'`display/gnome-rr-windows.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-gnome-rr-windows.Tpo $(DEPDIR)/spicy-gnome-rr-windows.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/gnome-rr-windows.c' object='spicy-gnome-rr-windows.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/gnome-rr-windows.c' object='spicy-gnome-rr-windows.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-windows.o `test -f 'display/gnome-rr-windows.c' || echo '$(srcdir)/'`display/gnome-rr-windows.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-windows.o `test -f 'display/gnome-rr-windows.c' || echo '$(srcdir)/'`display/gnome-rr-windows.c spicy-gnome-rr-windows.obj: display/gnome-rr-windows.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-gnome-rr-windows.obj -MD -MP -MF $(DEPDIR)/spicy-gnome-rr-windows.Tpo -c -o spicy-gnome-rr-windows.obj `if test -f 'display/gnome-rr-windows.c'; then $(CYGPATH_W) 'display/gnome-rr-windows.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-windows.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-gnome-rr-windows.Tpo $(DEPDIR)/spicy-gnome-rr-windows.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/gnome-rr-windows.c' object='spicy-gnome-rr-windows.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/gnome-rr-windows.c' object='spicy-gnome-rr-windows.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-windows.obj `if test -f 'display/gnome-rr-windows.c'; then $(CYGPATH_W) 'display/gnome-rr-windows.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-windows.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-windows.obj `if test -f 'display/gnome-rr-windows.c'; then $(CYGPATH_W) 'display/gnome-rr-windows.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-windows.c'; fi` spicy-gnome-rr-generic.o: display/gnome-rr-generic.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-gnome-rr-generic.o -MD -MP -MF $(DEPDIR)/spicy-gnome-rr-generic.Tpo -c -o spicy-gnome-rr-generic.o `test -f 'display/gnome-rr-generic.c' || echo '$(srcdir)/'`display/gnome-rr-generic.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-gnome-rr-generic.Tpo $(DEPDIR)/spicy-gnome-rr-generic.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/gnome-rr-generic.c' object='spicy-gnome-rr-generic.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/gnome-rr-generic.c' object='spicy-gnome-rr-generic.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-generic.o `test -f 'display/gnome-rr-generic.c' || echo '$(srcdir)/'`display/gnome-rr-generic.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-generic.o `test -f 'display/gnome-rr-generic.c' || echo '$(srcdir)/'`display/gnome-rr-generic.c spicy-gnome-rr-generic.obj: display/gnome-rr-generic.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT spicy-gnome-rr-generic.obj -MD -MP -MF $(DEPDIR)/spicy-gnome-rr-generic.Tpo -c -o spicy-gnome-rr-generic.obj `if test -f 'display/gnome-rr-generic.c'; then $(CYGPATH_W) 'display/gnome-rr-generic.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-generic.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/spicy-gnome-rr-generic.Tpo $(DEPDIR)/spicy-gnome-rr-generic.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display/gnome-rr-generic.c' object='spicy-gnome-rr-generic.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='display/gnome-rr-generic.c' object='spicy-gnome-rr-generic.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-generic.obj `if test -f 'display/gnome-rr-generic.c'; then $(CYGPATH_W) 'display/gnome-rr-generic.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-generic.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(spicy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spicy-gnome-rr-generic.obj `if test -f 'display/gnome-rr-generic.c'; then $(CYGPATH_W) 'display/gnome-rr-generic.c'; else $(CYGPATH_W) '$(srcdir)/display/gnome-rr-generic.c'; fi` mostlyclean-libtool: -rm -f *.lo @@ -1565,9 +1457,7 @@ @$(NORMAL_UNINSTALL) @list='$(dist_libspice_client_glibinclude_DATA)'; test -n "$(libspice_client_glibincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(libspice_client_glibincludedir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(libspice_client_glibincludedir)" && rm -f $$files + dir='$(DESTDIR)$(libspice_client_glibincludedir)'; $(am__uninstall_files_from_dir) install-girDATA: $(gir_DATA) @$(NORMAL_INSTALL) test -z "$(girdir)" || $(MKDIR_P) "$(DESTDIR)$(girdir)" @@ -1585,9 +1475,7 @@ @$(NORMAL_UNINSTALL) @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(girdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(girdir)" && rm -f $$files + dir='$(DESTDIR)$(girdir)'; $(am__uninstall_files_from_dir) install-typelibsDATA: $(typelibs_DATA) @$(NORMAL_INSTALL) test -z "$(typelibsdir)" || $(MKDIR_P) "$(DESTDIR)$(typelibsdir)" @@ -1605,9 +1493,7 @@ @$(NORMAL_UNINSTALL) @list='$(typelibs_DATA)'; test -n "$(typelibsdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(typelibsdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(typelibsdir)" && rm -f $$files + dir='$(DESTDIR)$(typelibsdir)'; $(am__uninstall_files_from_dir) install-libspice_client_glibincludeHEADERS: $(libspice_client_glibinclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(libspice_client_glibincludedir)" || $(MKDIR_P) "$(DESTDIR)$(libspice_client_glibincludedir)" @@ -1625,9 +1511,7 @@ @$(NORMAL_UNINSTALL) @list='$(libspice_client_glibinclude_HEADERS)'; test -n "$(libspice_client_glibincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(libspice_client_glibincludedir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(libspice_client_glibincludedir)" && rm -f $$files + dir='$(DESTDIR)$(libspice_client_glibincludedir)'; $(am__uninstall_files_from_dir) install-libspice_client_gtkincludeHEADERS: $(libspice_client_gtkinclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(libspice_client_gtkincludedir)" || $(MKDIR_P) "$(DESTDIR)$(libspice_client_gtkincludedir)" @@ -1645,9 +1529,7 @@ @$(NORMAL_UNINSTALL) @list='$(libspice_client_gtkinclude_HEADERS)'; test -n "$(libspice_client_gtkincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(libspice_client_gtkincludedir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(libspice_client_gtkincludedir)" && rm -f $$files + dir='$(DESTDIR)$(libspice_client_gtkincludedir)'; $(am__uninstall_files_from_dir) install-nodist_libspice_client_glibincludeHEADERS: $(nodist_libspice_client_glibinclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(libspice_client_glibincludedir)" || $(MKDIR_P) "$(DESTDIR)$(libspice_client_glibincludedir)" @@ -1665,9 +1547,7 @@ @$(NORMAL_UNINSTALL) @list='$(nodist_libspice_client_glibinclude_HEADERS)'; test -n "$(libspice_client_glibincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(libspice_client_glibincludedir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(libspice_client_glibincludedir)" && rm -f $$files + dir='$(DESTDIR)$(libspice_client_glibincludedir)'; $(am__uninstall_files_from_dir) install-nodist_libspice_client_gtkincludeHEADERS: $(nodist_libspice_client_gtkinclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(libspice_client_gtkincludedir)" || $(MKDIR_P) "$(DESTDIR)$(libspice_client_gtkincludedir)" @@ -1685,9 +1565,7 @@ @$(NORMAL_UNINSTALL) @list='$(nodist_libspice_client_gtkinclude_HEADERS)'; test -n "$(libspice_client_gtkincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(libspice_client_gtkincludedir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(libspice_client_gtkincludedir)" && rm -f $$files + dir='$(DESTDIR)$(libspice_client_gtkincludedir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -1904,10 +1782,15 @@ installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -1921,7 +1804,6 @@ @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) @WITH_POLKIT_FALSE@install-data-hook: clean: clean-recursive @@ -2116,20 +1998,6 @@ --eprod "GType @enum_name@_get_type (void);\n" \ $< > $@ -# Note despite being autogenerated these are not part of CLEANFILES, they are -# actually a part of EXTRA_DIST, to avoid the need for pyparser by end users -generated_demarshallers.c: $(top_srcdir)/spice.proto - $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include messages.h $< $@ >/dev/null - -generated_demarshallers1.c: $(top_srcdir)/spice1.proto - $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include messages.h --prefix 1 --ptrsize 8 $< $@ >/dev/null - -generated_marshallers.c: $(top_srcdir)/spice.proto - $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include messages.h --include marshallers.h --client $< $@ >/dev/null - -generated_marshallers1.c: $(top_srcdir)/spice1.proto - $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include messages.h --include marshallers.h --client --prefix 1 --ptrsize 8 $< $@ >/dev/null - vncdisplaykeymap.c: $(KEYMAPS) $(KEYMAPS): $(KEYMAP_GEN) keymaps.csv diff -Nru spice-gtk-0.9/gtk/map-file spice-gtk-0.12/gtk/map-file --- spice-gtk-0.9/gtk/map-file 2012-01-31 13:27:18.000000000 +0000 +++ spice-gtk-0.12/gtk/map-file 2012-04-11 13:51:02.000000000 +0000 @@ -27,6 +27,7 @@ spice_display_paste_from_guest; spice_display_send_keys; spice_display_set_grab_keys; +spice_error_get_type; spice_get_option_group; spice_grab_sequence_as_string; spice_grab_sequence_copy; @@ -48,6 +49,7 @@ spice_inputs_motion; spice_inputs_position; spice_inputs_set_key_locks; +spice_main_agent_test_capability; spice_main_channel_get_type; spice_main_clipboard_grab; spice_main_clipboard_notify; @@ -84,6 +86,7 @@ spice_smartcard_reader_is_software; spice_usb_device_get_description; spice_usb_device_get_type; +spice_usb_device_manager_can_redirect_device; spice_usb_device_manager_connect_device_async; spice_usb_device_manager_connect_device_finish; spice_usb_device_manager_disconnect_device; diff -Nru spice-gtk-0.9/gtk/snappy.c spice-gtk-0.12/gtk/snappy.c --- spice-gtk-0.9/gtk/snappy.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/snappy.c 2012-04-11 13:51:02.000000000 +0000 @@ -25,7 +25,7 @@ #include "spice-cmdline.h" /* config */ -static char *outf = "snappy.ppm"; +static const char *outf = "snappy.ppm"; static gboolean version = FALSE; /* state */ diff -Nru spice-gtk-0.9/gtk/spice-audio.c spice-gtk-0.12/gtk/spice-audio.c --- spice-gtk-0.9/gtk/spice-audio.c 2012-01-17 10:04:30.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-audio.c 2012-04-11 13:51:02.000000000 +0000 @@ -204,7 +204,6 @@ * Returns: a new #SpiceAudio instance or %NULL if no backend or failed. * Deprecated: 0.8: Use spice_audio_get() instead **/ -G_GNUC_DEPRECATED_FOR(spice_audio_get) SpiceAudio *spice_audio_new(SpiceSession *session, GMainContext *context, const char *name) { diff -Nru spice-gtk-0.9/gtk/spice-audio.h spice-gtk-0.12/gtk/spice-audio.h --- spice-gtk-0.9/gtk/spice-audio.h 2011-12-02 13:09:31.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-audio.h 2012-04-11 13:51:02.000000000 +0000 @@ -47,7 +47,6 @@ /** * SpiceAudio: - * @parent: Parent instance. * * The #SpiceAudio struct is opaque and should not be accessed directly. */ @@ -73,10 +72,13 @@ GType spice_audio_get_type(void); -SpiceAudio* spice_audio_new(SpiceSession *session, GMainContext *context, const char *name); - SpiceAudio* spice_audio_get(SpiceSession *session, GMainContext *context); +#ifndef SPICE_DISABLE_DEPRECATED +SPICE_DEPRECATED_FOR(spice_audio_get) +SpiceAudio* spice_audio_new(SpiceSession *session, GMainContext *context, const char *name); +#endif + G_END_DECLS #endif /* __SPICE_CLIENT_AUDIO_H__ */ diff -Nru spice-gtk-0.9/gtk/spice-channel.c spice-gtk-0.12/gtk/spice-channel.c --- spice-gtk-0.9/gtk/spice-channel.c 2012-01-17 11:27:10.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-channel.c 2012-04-24 10:41:41.000000000 +0000 @@ -21,6 +21,7 @@ #include "spice-channel-priv.h" #include "spice-session-priv.h" #include "spice-marshal.h" +#include "bio-gsocket.h" #include #include @@ -109,7 +110,7 @@ spice_channel_set_common_capability(channel, SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION); spice_channel_set_common_capability(channel, SPICE_COMMON_CAP_MINI_HEADER); g_queue_init(&c->xmit_queue); - g_static_mutex_init(&c->xmit_queue_lock); + STATIC_MUTEX_INIT(c->xmit_queue_lock); } static void spice_channel_constructed(GObject *gobject) @@ -159,7 +160,9 @@ SPICE_DEBUG("%s: %s %p", c->name, __FUNCTION__, gobject); - g_idle_remove_by_data (gobject); + g_idle_remove_by_data(gobject); + + STATIC_MUTEX_CLEAR(c->xmit_queue_lock); if (c->caps) g_array_free(c->caps, TRUE); @@ -529,7 +532,7 @@ return in->data; } -static void hexdump(char *prefix, unsigned char *data, int len) +static void hexdump(const char *prefix, unsigned char *data, int len) { int i; @@ -664,9 +667,9 @@ * 5) xmit_queue_wakeup_id now says there is a wakeup pending which is * false */ - g_static_mutex_lock(&c->xmit_queue_lock); + STATIC_MUTEX_LOCK(c->xmit_queue_lock); c->xmit_queue_wakeup_id = 0; - g_static_mutex_unlock(&c->xmit_queue_lock); + STATIC_MUTEX_UNLOCK(c->xmit_queue_lock); spice_channel_wakeup(channel, FALSE); @@ -677,27 +680,32 @@ G_GNUC_INTERNAL void spice_msg_out_send(SpiceMsgOut *out) { + gboolean was_empty; + g_return_if_fail(out != NULL); g_return_if_fail(out->channel != NULL); - g_static_mutex_lock(&out->channel->priv->xmit_queue_lock); - if (!out->channel->priv->xmit_queue_blocked) { - gboolean was_empty; - - was_empty = g_queue_is_empty(&out->channel->priv->xmit_queue); - g_queue_push_tail(&out->channel->priv->xmit_queue, out); - - /* One wakeup is enough to empty the entire queue -> only do a wakeup - if the queue was empty, and there isn't one pending already. */ - if (was_empty && !out->channel->priv->xmit_queue_wakeup_id) { - out->channel->priv->xmit_queue_wakeup_id = - /* Use g_timeout_add_full so that can specify the priority */ - g_timeout_add_full(G_PRIORITY_HIGH, 0, - spice_channel_idle_wakeup, - out->channel, NULL); - } + STATIC_MUTEX_LOCK(out->channel->priv->xmit_queue_lock); + if (out->channel->priv->xmit_queue_blocked) { + g_warning("message queue is blocked, dropping message"); + goto end; } - g_static_mutex_unlock(&out->channel->priv->xmit_queue_lock); + + was_empty = g_queue_is_empty(&out->channel->priv->xmit_queue); + g_queue_push_tail(&out->channel->priv->xmit_queue, out); + + /* One wakeup is enough to empty the entire queue -> only do a wakeup + if the queue was empty, and there isn't one pending already. */ + if (was_empty && !out->channel->priv->xmit_queue_wakeup_id) { + out->channel->priv->xmit_queue_wakeup_id = + /* Use g_timeout_add_full so that can specify the priority */ + g_timeout_add_full(G_PRIORITY_HIGH, 0, + spice_channel_idle_wakeup, + out->channel, NULL); + } + +end: + STATIC_MUTEX_UNLOCK(out->channel->priv->xmit_queue_lock); } /* coroutine context */ @@ -1055,14 +1063,14 @@ rc = spice_channel_read(channel, &link_res, sizeof(link_res)); if (rc != sizeof(link_res)) { - g_critical("incomplete auth reply (%d/%" G_GSIZE_FORMAT ")", - rc, sizeof(link_res)); + SPICE_DEBUG("incomplete auth reply (%d/%" G_GSIZE_FORMAT ")", + rc, sizeof(link_res)); emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_ERROR_LINK); return; } if (link_res != SPICE_LINK_ERR_OK) { - g_critical("link result: reply %d", link_res); + SPICE_DEBUG("link result: reply %d", link_res); emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_ERROR_AUTH); return; } @@ -1431,7 +1439,7 @@ /* Need to gather some credentials from the client */ if (err == SASL_INTERACT) { if (!spice_channel_gather_sasl_credentials(channel, interact)) { - g_critical("Failed to collect auth credentials"); + SPICE_DEBUG("Failed to collect auth credentials"); goto error; } goto restart; @@ -1512,7 +1520,7 @@ if (err == SASL_INTERACT) { if (!spice_channel_gather_sasl_credentials(channel, interact)) { - g_critical("%s", "Failed to collect auth credentials"); + SPICE_DEBUG("%s", "Failed to collect auth credentials"); goto error; } goto restep; @@ -1612,8 +1620,7 @@ error: if (saslconn) sasl_dispose(&saslconn); - if (!c->has_error) - emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_ERROR_AUTH); + emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_ERROR_AUTH); c->has_error = TRUE; /* force disconnect */ return FALSE; } @@ -1624,6 +1631,7 @@ { SpiceChannelPrivate *c; int rc, num_caps, i; + uint32_t *caps; g_return_if_fail(channel != NULL); g_return_if_fail(channel->priv != NULL); @@ -1661,7 +1669,7 @@ /* see original spice/client code: */ /* g_return_if_fail(c->peer_msg + c->peer_msg->caps_offset * sizeof(uint32_t) > c->peer_msg + c->peer_hdr.size); */ - uint32_t *caps = (uint32_t *)((uint8_t *)c->peer_msg + c->peer_msg->caps_offset); + caps = (uint32_t *)((uint8_t *)c->peer_msg + c->peer_msg->caps_offset); g_array_set_size(c->remote_common_caps, c->peer_msg->num_common_caps); for (i = 0; i < c->peer_msg->num_common_caps; i++, caps++) { @@ -1855,7 +1863,7 @@ }; const char *str = NULL; - if (type >= 0 && type < sizeof(to_string)) { + if (type >= 0 && type < G_N_ELEMENTS(to_string)) { str = to_string[type]; } @@ -1964,9 +1972,9 @@ SpiceMsgOut *out; do { - g_static_mutex_lock(&c->xmit_queue_lock); + STATIC_MUTEX_LOCK(c->xmit_queue_lock); out = g_queue_pop_head(&c->xmit_queue); - g_static_mutex_unlock(&c->xmit_queue_lock); + STATIC_MUTEX_UNLOCK(c->xmit_queue_lock); if (out) spice_channel_write_msg(channel, out); } while (out); @@ -2090,12 +2098,13 @@ goto cleanup; } - if (!(c->sock = g_socket_new_from_fd(c->fd, NULL))) { - SPICE_DEBUG("Failed to open socket from fd %d", c->fd); - return FALSE; - } + if (!(c->sock = g_socket_new_from_fd(c->fd, NULL))) { + SPICE_DEBUG("Failed to open socket from fd %d", c->fd); + return FALSE; + } - g_socket_set_blocking(c->sock, FALSE); + g_socket_set_blocking(c->sock, FALSE); + g_socket_set_keepalive(c->sock, TRUE); goto connected; } @@ -2156,13 +2165,11 @@ g_critical("SSL_new failed"); goto cleanup; } - rc = SSL_set_fd(c->ssl, g_socket_get_fd(c->sock)); - if (rc <= 0) { - g_critical("SSL_set_fd failed"); - goto cleanup; - } + BIO *bio = bio_new_gsocket(c->sock); + SSL_set_bio(c->ssl, bio, bio); + { guint8 *pubkey; guint pubkey_len; @@ -2193,7 +2200,11 @@ connected: rc = setsockopt(g_socket_get_fd(c->sock), IPPROTO_TCP, TCP_NODELAY, (const char*)&delay_val, sizeof(delay_val)); - if (rc != 0) { + if ((rc != 0) +#ifdef ENOTSUP + && (errno != ENOTSUP) +#endif + ) { g_warning("%s: could not set sockopt TCP_NODELAY: %s", c->name, strerror(errno)); } @@ -2302,10 +2313,14 @@ /** * spice_channel_open_fd: * @channel: - * @fd: a file descriptor (socket) + * @fd: a file descriptor (socket) or -1. + * request mechanism * * Connect the channel using @fd socket. * + * If @fd is -1, a valid fd will be requested later via the + * SpiceChannel::open-fd signal. + * * Returns: %TRUE on success. **/ gboolean spice_channel_open_fd(SpiceChannel *channel, int fd) @@ -2313,7 +2328,7 @@ SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel); g_return_val_if_fail(c != NULL, FALSE); - g_return_val_if_fail(fd >= 0, FALSE); + g_return_val_if_fail(fd >= -1, FALSE); c->fd = fd; @@ -2362,7 +2377,7 @@ c->peer_msg = NULL; c->peer_pos = 0; - g_static_mutex_lock(&c->xmit_queue_lock); + STATIC_MUTEX_LOCK(c->xmit_queue_lock); c->xmit_queue_blocked = TRUE; /* Disallow queuing new messages */ g_queue_foreach(&c->xmit_queue, (GFunc)spice_msg_out_unref, NULL); g_queue_clear(&c->xmit_queue); @@ -2370,7 +2385,7 @@ g_source_remove(c->xmit_queue_wakeup_id); c->xmit_queue_wakeup_id = 0; } - g_static_mutex_unlock(&c->xmit_queue_lock); + STATIC_MUTEX_UNLOCK(c->xmit_queue_lock); g_array_set_size(c->remote_common_caps, 0); g_array_set_size(c->remote_caps, 0); @@ -2400,11 +2415,11 @@ c->has_error = TRUE; /* break the loop */ - spice_channel_reset(channel, FALSE); - if (c->state == SPICE_CHANNEL_STATE_READY) emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_CLOSED); + spice_channel_reset(channel, FALSE); + g_return_if_fail(SPICE_IS_CHANNEL(channel)); c->state = SPICE_CHANNEL_STATE_UNCONNECTED; } @@ -2462,7 +2477,7 @@ /** * spice_channel_test_capability: - * @self: + * @channel: * @cap: * * Test availability of remote "channel kind capability". @@ -2481,7 +2496,7 @@ /** * spice_channel_test_common_capability: - * @self: + * @channel: * @cap: * * Test availability of remote "common channel capability". @@ -2549,6 +2564,15 @@ } G_GNUC_INTERNAL +enum spice_channel_state spice_channel_get_state(SpiceChannel *channel) +{ + g_return_val_if_fail(SPICE_IS_CHANNEL(channel), + SPICE_CHANNEL_STATE_UNCONNECTED); + + return channel->priv->state; +} + +G_GNUC_INTERNAL void spice_channel_swap(SpiceChannel *channel, SpiceChannel *swap) { SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel); @@ -2560,49 +2584,32 @@ g_return_if_fail(s->session != NULL); g_return_if_fail(s->sock != NULL); - { - GSocket *sock = c->sock; - SSL_CTX *ctx = c->ctx; - SSL *ssl = c->ssl; - SpiceOpenSSLVerify *sslverify = c->sslverify; - uint64_t in_serial = c->in_serial; - uint64_t out_serial = c->out_serial; - gboolean use_mini_header = c->use_mini_header; - - c->sock = s->sock; - c->ctx = s->ctx; - c->ssl = s->ssl; - c->sslverify = s->sslverify; - c->in_serial = s->in_serial; - c->out_serial = s->out_serial; - c->use_mini_header = s->use_mini_header; - - s->sock = sock; - s->ctx = ctx; - s->ssl = ssl; - s->sslverify = sslverify; - s->in_serial = in_serial; - s->out_serial = out_serial; - s->use_mini_header = use_mini_header; - } - +#define SWAP(Field) ({ \ + typeof (c->Field) Field = c->Field; \ + c->Field = s->Field; \ + s->Field = Field; \ +}) + + /* TODO: split channel in 2 objects: a controller and a swappable + state object */ + SWAP(sock); + SWAP(ctx); + SWAP(ssl); + SWAP(sslverify); + SWAP(in_serial); + SWAP(out_serial); + SWAP(use_mini_header); + SWAP(xmit_queue); + SWAP(xmit_queue_blocked); + SWAP(caps); + SWAP(common_caps); + SWAP(remote_caps); + SWAP(remote_common_caps); #if HAVE_SASL - { - sasl_conn_t *sasl_conn = c->sasl_conn; - const char *sasl_decoded = c->sasl_decoded; - unsigned int sasl_decoded_length = c->sasl_decoded_length; - unsigned int sasl_decoded_offset = c->sasl_decoded_offset; - - c->sasl_conn = s->sasl_conn; - c->sasl_decoded = s->sasl_decoded; - c->sasl_decoded_length = s->sasl_decoded_length; - c->sasl_decoded_offset = s->sasl_decoded_offset; - - s->sasl_conn = sasl_conn; - s->sasl_decoded = sasl_decoded; - s->sasl_decoded_length = sasl_decoded_length; - s->sasl_decoded_offset = sasl_decoded_offset; - } + SWAP(sasl_conn); + SWAP(sasl_decoded); + SWAP(sasl_decoded_length); + SWAP(sasl_decoded_offset); #endif } diff -Nru spice-gtk-0.9/gtk/spice-channel-cache.h spice-gtk-0.12/gtk/spice-channel-cache.h --- spice-gtk-0.9/gtk/spice-channel-cache.h 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-channel-cache.h 2012-04-11 13:51:02.000000000 +0000 @@ -18,10 +18,9 @@ #ifndef SPICE_CHANNEL_CACHE_H_ # define SPICE_CHANNEL_CACHE_H_ -/* spice/common */ #include /* For PRIx64 */ -#include "mem.h" -#include "ring.h" +#include "common/mem.h" +#include "common/ring.h" G_BEGIN_DECLS diff -Nru spice-gtk-0.9/gtk/spice-channel-priv.h spice-gtk-0.12/gtk/spice-channel-priv.h --- spice-gtk-0.9/gtk/spice-channel-priv.h 2012-01-17 10:18:20.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-channel-priv.h 2012-04-11 13:51:02.000000000 +0000 @@ -29,14 +29,13 @@ #include #endif +#include "spice-util-priv.h" #include "coroutine.h" #include "gio-coroutine.h" -/* common/ */ -#include "marshallers.h" -#include "demarshallers.h" - -#include "ssl_verify.h" +#include "common/client_marshallers.h" +#include "common/client_demarshallers.h" +#include "common/ssl_verify.h" G_BEGIN_DECLS @@ -101,7 +100,7 @@ GQueue xmit_queue; gboolean xmit_queue_blocked; - GStaticMutex xmit_queue_lock; + STATIC_MUTEX xmit_queue_lock; guint xmit_queue_wakeup_id; char name[16]; @@ -157,6 +156,7 @@ void spice_channel_wakeup(SpiceChannel *channel, gboolean cancel); SpiceSession* spice_channel_get_session(SpiceChannel *channel); +enum spice_channel_state spice_channel_get_state(SpiceChannel *channel); /* coroutine context */ typedef void (*handler_msg_in)(SpiceChannel *channel, SpiceMsgIn *msg, gpointer data); diff -Nru spice-gtk-0.9/gtk/spice-client.c spice-gtk-0.12/gtk/spice-client.c --- spice-gtk-0.9/gtk/spice-client.c 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-client.c 2012-04-11 13:51:02.000000000 +0000 @@ -17,6 +17,8 @@ */ #include +#include "spice-client.h" + GQuark spice_client_error_quark(void) { return g_quark_from_static_string("spice-client-error-quark"); diff -Nru spice-gtk-0.9/gtk/spice-client-glib-usb-acl-helper.c spice-gtk-0.12/gtk/spice-client-glib-usb-acl-helper.c --- spice-gtk-0.9/gtk/spice-client-glib-usb-acl-helper.c 2012-01-30 10:26:20.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-client-glib-usb-acl-helper.c 2012-04-11 13:51:02.000000000 +0000 @@ -150,7 +150,7 @@ return ret; } -static void cleanup() +static void cleanup(void) { if (polkit_cancellable) g_cancellable_cancel(polkit_cancellable); @@ -161,6 +161,25 @@ g_main_loop_quit(loop); } +/* Not available in polkit < 0.101 */ +#if !HAVE_POLKIT_AUTHORIZATION_RESULT_GET_DISMISSED +static gboolean +polkit_authorization_result_get_dismissed(PolkitAuthorizationResult *result) +{ + gboolean ret; + PolkitDetails *details; + + g_return_val_if_fail(POLKIT_IS_AUTHORIZATION_RESULT(result), FALSE); + + ret = FALSE; + details = polkit_authorization_result_get_details(result); + if (details != NULL && polkit_details_lookup(details, "polkit.dismissed")) + ret = TRUE; + + return ret; +} +#endif + static void check_authorization_cb(PolkitAuthority *authority, GAsyncResult *res, gpointer data) { @@ -177,6 +196,11 @@ return; } + if (polkit_authorization_result_get_dismissed(result)) { + ERROR("CANCELED\n"); + return; + } + if (!polkit_authorization_result_get_is_authorized(result)) { ERROR("Not authorized\n"); return; diff -Nru spice-gtk-0.9/gtk/spice-client.h spice-gtk-0.12/gtk/spice-client.h --- spice-gtk-0.9/gtk/spice-client.h 2011-12-14 11:53:38.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-client.h 2012-04-11 13:51:02.000000000 +0000 @@ -45,6 +45,8 @@ #include "usb-device-manager.h" #include "spice-audio.h" +G_BEGIN_DECLS + #define SPICE_CLIENT_ERROR spice_client_error_quark() /** @@ -56,8 +58,12 @@ typedef enum { SPICE_CLIENT_ERROR_FAILED, + SPICE_CLIENT_USB_DEVICE_REJECTED, + SPICE_CLIENT_USB_DEVICE_LOST, } SpiceClientError; GQuark spice_client_error_quark(void); +G_END_DECLS + #endif /* __SPICE_CLIENT_CLIENT_H__ */ diff -Nru spice-gtk-0.9/gtk/spice-common.h spice-gtk-0.12/gtk/spice-common.h --- spice-gtk-0.9/gtk/spice-common.h 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-common.h 2012-04-11 13:51:02.000000000 +0000 @@ -27,10 +27,9 @@ #include #include -/* spice/common */ -#include "mem.h" -#include "messages.h" -#include "marshaller.h" +#include "common/mem.h" +#include "common/messages.h" +#include "common/marshaller.h" #include "spice-util.h" diff -Nru spice-gtk-0.9/gtk/spice-gtk-session.c spice-gtk-0.12/gtk/spice-gtk-session.c --- spice-gtk-0.9/gtk/spice-gtk-session.c 2012-01-27 08:56:56.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-gtk-session.c 2012-04-11 13:51:02.000000000 +0000 @@ -478,7 +478,9 @@ } if (!s->clip_grabbed[selection] && t > 0) { s->clip_grabbed[selection] = TRUE; - spice_main_clipboard_selection_grab(s->main, selection, types, t); + + if (spice_main_agent_test_capability(s->main, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) + spice_main_clipboard_selection_grab(s->main, selection, types, t); /* Sending a grab causes the agent to do an impicit release */ s->nclip_targets[selection] = 0; } @@ -502,7 +504,8 @@ if (s->clip_grabbed[selection]) { s->clip_grabbed[selection] = FALSE; - spice_main_clipboard_selection_release(s->main, selection); + if (spice_main_agent_test_capability(s->main, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) + spice_main_clipboard_selection_release(s->main, selection); } switch (event->reason) { diff -Nru spice-gtk-0.9/gtk/spice-option.c spice-gtk-0.12/gtk/spice-option.c --- spice-gtk-0.9/gtk/spice-option.c 2012-01-27 08:56:56.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-option.c 2012-04-19 12:39:26.000000000 +0000 @@ -39,15 +39,17 @@ static gint cache_size = 0; static gint glz_window_size = 0; +G_GNUC_NORETURN static void option_version(void) { g_print(PACKAGE_STRING "\n"); exit(0); } -static void option_debug(void) +static gboolean option_debug(void) { spice_util_set_debug(TRUE); + return TRUE; } /** @@ -155,5 +157,5 @@ if (cache_size) g_object_set(session, "cache-size", cache_size, NULL); if (glz_window_size) - g_object_set(session, "glz_window_size", glz_window_size, NULL); + g_object_set(session, "glz-window-size", glz_window_size, NULL); } diff -Nru spice-gtk-0.9/gtk/spice-session.c spice-gtk-0.12/gtk/spice-session.c --- spice-gtk-0.9/gtk/spice-session.c 2012-01-27 08:56:56.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-session.c 2012-04-24 10:41:41.000000000 +0000 @@ -17,16 +17,14 @@ */ #include #include + +#include "common/ring.h" + #include "spice-client.h" #include "spice-common.h" #include "spice-channel-priv.h" #include "spice-util-priv.h" - #include "spice-session-priv.h" - -/* spice/common */ -#include "ring.h" - #include "gio-coroutine.h" #include "glib-compat.h" @@ -103,6 +101,8 @@ PROP_READ_ONLY, PROP_CACHE_SIZE, PROP_GLZ_WINDOW_SIZE, + PROP_UUID, + PROP_NAME, }; /* signals */ @@ -222,6 +222,10 @@ G_OBJECT_CLASS(spice_session_parent_class)->finalize(gobject); } +#define URI_SCHEME_SPICE "spice://" +#define URI_QUERY_START ";?" +#define URI_QUERY_SEP ";&" + static int spice_uri_create(SpiceSession *session, char *dest, int len) { SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session); @@ -242,50 +246,88 @@ static int spice_uri_parse(SpiceSession *session, const char *original_uri) { SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session); - char host[128], key[32], value[128]; - char *port = NULL, *tls_port = NULL, *uri = NULL, *password = NULL; - char **target_key; - int punctuation = 0; - int len, pos = 0; + gchar key[32], value[128]; + gchar *host = NULL, *port = NULL, *tls_port = NULL, *uri = NULL, *password = NULL; + gchar **target_key; + int len; + gchar *path = NULL; + gchar *authority = NULL; + gchar *query = NULL; g_return_val_if_fail(original_uri != NULL, -1); uri = g_uri_unescape_string(original_uri, NULL); g_return_val_if_fail(uri != NULL, -1); - if (sscanf(uri, "spice://%127[-.0-9a-zA-Z]%n", host, &len) != 1) - goto fail; - pos += len; - if (uri[pos] == '/') - pos++; - - for (;;) { - if (uri[pos] == '?' || uri[pos] == ';' || uri[pos] == '&') { - pos++; - punctuation++; - continue; + /* Break up the URI into its various parts, scheme, authority, + * path (ignored) and query + */ + if (strncmp(uri, URI_SCHEME_SPICE, strlen(URI_SCHEME_SPICE)) != 0) { + g_warning("Expected a URI scheme of '%s' in URI '%s'", + URI_SCHEME_SPICE, uri); + goto fail; + } + authority = uri + strlen(URI_SCHEME_SPICE); + path = strchr(authority, '/'); + if (path) { + path[0] = '\0'; + path++; + } + + if (path) { + size_t prefix = strcspn(path, URI_QUERY_START); + if (len) + query = path + prefix; + } else { + size_t prefix = strcspn(authority, URI_QUERY_START); + if (len) + query = authority + prefix; + } + + if (query && query[0]) { + query[0] = '\0'; + query++; + } + + /* Now process the individual parts */ + + if (authority[0] == '[') { + gchar *tmp = strchr(authority, ']'); + if (!tmp) { + g_warning("Missing closing ']' in authority for URI '%s'", uri); + goto fail; } - if (uri[pos] == 0) { - break; + tmp[0] = '\0'; + tmp++; + host = g_strdup(authority + 1); + if (tmp[0] == ':') + port = g_strdup(tmp + 1); + } else { + gchar *tmp = strchr(authority, ':'); + if (tmp) { + *tmp = '\0'; + tmp++; + port = g_strdup(tmp); } - if (uri[pos] == ':') { - if (punctuation++) { - g_warning("colon seen after a previous punctuation (?;&:)"); - goto fail; - } - pos++; - /* port numbers are 16 bit, fits in five decimal figures. */ - if (sscanf(uri + pos, "%5[0-9]%n", value, &len) != 1) - goto fail; - port = g_strdup(value); - pos += len; - continue; - } else { - if (sscanf(uri + pos, "%31[-a-zA-Z0-9]=%127[^;&]%n", key, value, &len) != 2) - goto fail; + host = g_strdup(authority); + } + + if (path && !(g_str_equal(path, "") || + g_str_equal(path, "/"))) { + g_warning("Unexpected path data '%s' for URI '%s'", path, uri); + /* don't fail, just ignore */ + } + + while (query && query[0] != '\0') { + if (sscanf(query, "%31[-a-zA-Z0-9]=%127[^;&]%n", key, value, &len) != 2) { + g_warning("Failed to parse URI query '%s'", query); + goto fail; } - pos += len; + query += len; + if (*query) + query++; + target_key = NULL; if (g_str_equal(key, "port")) { target_key = &port; @@ -295,12 +337,12 @@ target_key = &password; g_warning("password may be visible in process listings"); } else { - g_warning("unknown key in spice URI parsing: %s", key); + g_warning("unknown key in spice URI parsing: '%s'", key); goto fail; } if (target_key) { if (*target_key) { - g_warning("double set of %s", key); + g_warning("Double set of '%s' in URI '%s'", key, uri); goto fail; } *target_key = g_strdup(value); @@ -308,7 +350,7 @@ } if (port == NULL && tls_port == NULL) { - g_warning("missing port or tls-port in spice URI"); + g_warning("Missing port or tls-port in spice URI '%s'", uri); goto fail; } @@ -318,7 +360,7 @@ g_free(s->port); g_free(s->tls_port); g_free(s->password); - s->host = g_strdup(host); + s->host = host; s->port = port; s->tls_port = tls_port; s->password = password; @@ -326,6 +368,7 @@ fail: g_free(uri); + g_free(host); g_free(port); g_free(tls_port); g_free(password); @@ -416,6 +459,12 @@ case PROP_GLZ_WINDOW_SIZE: g_value_set_int(value, s->glz_window_size); break; + case PROP_NAME: + g_value_set_string(value, s->name); + break; + case PROP_UUID: + g_value_set_pointer(value, s->uuid); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); break; @@ -468,8 +517,9 @@ s->client_provided_sockets = g_value_get_boolean(value); break; case PROP_PUBKEY: - g_byte_array_unref(s->pubkey); - s->pubkey = g_value_get_boxed(value); + if (s->pubkey) + g_byte_array_unref(s->pubkey); + s->pubkey = g_value_dup_boxed(value); if (s->pubkey) s->verify = SPICE_SESSION_VERIFY_PUBKEY; break; @@ -932,6 +982,7 @@ * * Images cache size. If 0, don't set. * + * Since: 0.9 **/ g_object_class_install_property (gobject_class, PROP_CACHE_SIZE, @@ -947,6 +998,7 @@ * * Glz window size. If 0, don't set. * + * Since: 0.9 **/ g_object_class_install_property (gobject_class, PROP_GLZ_WINDOW_SIZE, @@ -957,6 +1009,37 @@ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * SpiceSession:name: + * + * Spice server name. + * + * Since: 0.11 + **/ + g_object_class_install_property + (gobject_class, PROP_NAME, + g_param_spec_string("name", + "Name", + "Spice server name", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + /** + * SpiceSession:uuid: + * + * Spice server uuid. + * + * Since: 0.11 + **/ + g_object_class_install_property + (gobject_class, PROP_UUID, + g_param_spec_pointer("uuid", + "UUID", + "Spice server uuid", + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + g_type_class_add_private(klass, sizeof(SpiceSessionPrivate)); } @@ -1042,12 +1125,15 @@ /** * spice_session_open_fd: * @session: - * @fd: a file descriptor + * @fd: a file descriptor (socket) or -1 * * Open the session using the provided @fd socket file * descriptor. This is useful if you create the fd yourself, for * example to setup a SSH tunnel. * + * If @fd is -1, a valid fd will be requested later via the + * SpiceChannel::open-fd signal. + * * Returns: **/ gboolean spice_session_open_fd(SpiceSession *session, int fd) @@ -1055,14 +1141,17 @@ SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session); g_return_val_if_fail(s != NULL, FALSE); - g_return_val_if_fail(fd >= 0, FALSE); + g_return_val_if_fail(fd >= -1, FALSE); spice_session_disconnect(session); + s->disconnecting = FALSE; s->client_provided_sockets = TRUE; g_warn_if_fail(s->cmain == NULL); s->cmain = spice_channel_new(session, SPICE_CHANNEL_MAIN, 0); + + glz_decoder_window_clear(s->glz_window); return spice_channel_open_fd(s->cmain, fd); } @@ -1076,9 +1165,9 @@ } G_GNUC_INTERNAL -void spice_session_switching_disconnect(SpiceSession *session) +void spice_session_switching_disconnect(SpiceSession *self) { - SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session); + SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(self); struct channel *item; RingItem *ring, *next; @@ -1095,6 +1184,10 @@ } g_warn_if_fail(!ring_is_empty(&s->channels)); /* ring_get_length() == 1 */ + + spice_session_palettes_clear(self); + spice_session_images_clear(self); + glz_decoder_window_clear(s->glz_window); } G_GNUC_INTERNAL @@ -1165,7 +1258,11 @@ struct channel *c; g_return_if_fail(s != NULL); - g_return_if_fail(s->migration != NULL); + + if (s->migration == NULL) { + SPICE_DEBUG("no migration in progress"); + return; + } for (ring = ring_get_head(&s->channels); ring != NULL; ring = next) { @@ -1340,6 +1437,11 @@ } s->connection_id = 0; + + g_free(s->name); + s->name = NULL; + memset(s->uuid, 0, sizeof(s->uuid)); + /* we leave disconnecting = TRUE, so that spice_channel_destroy() is not called multiple times on channels that are in pending destroy state. */ @@ -1417,6 +1519,8 @@ return NULL; g_socket_set_blocking(sock, FALSE); + g_socket_set_keepalive(sock, TRUE); + if (!g_socket_connect(sock, sockaddr, NULL, error)) { if (*error && (*error)->code == G_IO_ERROR_PENDING) { g_clear_error(error); @@ -1732,3 +1836,26 @@ s->glz_window_size = MAX(MIN_GLZ_WINDOW_SIZE_DEFAULT, s->glz_window_size); } } + +G_GNUC_INTERNAL +void spice_session_set_uuid(SpiceSession *session, guint8 uuid[16]) +{ + SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session); + + g_return_if_fail(s != NULL); + memcpy(s->uuid, uuid, sizeof(s->uuid)); + + g_object_notify(G_OBJECT(session), "uuid"); +} + +G_GNUC_INTERNAL +void spice_session_set_name(SpiceSession *session, const gchar *name) +{ + SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session); + + g_return_if_fail(s != NULL); + g_free(s->name); + s->name = g_strdup(name); + + g_object_notify(G_OBJECT(session), "name"); +} diff -Nru spice-gtk-0.9/gtk/spice-session-priv.h spice-gtk-0.12/gtk/spice-session-priv.h --- spice-gtk-0.9/gtk/spice-session-priv.h 2012-01-27 08:56:56.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-session-priv.h 2012-04-11 13:51:02.000000000 +0000 @@ -92,7 +92,8 @@ int glz_window_size; uint32_t pci_ram_size; uint32_t display_channels_count; - + guint8 uuid[16]; + gchar *name; /* associated objects */ SpiceAudio *audio_manager; @@ -141,6 +142,8 @@ void spice_session_migrate_end(SpiceSession *session); gboolean spice_session_migrate_after_main_init(SpiceSession *session); SpiceChannel* spice_session_lookup_channel(SpiceSession *session, gint id, gint type); +void spice_session_set_uuid(SpiceSession *session, guint8 uuid[16]); +void spice_session_set_name(SpiceSession *session, const gchar *name); G_END_DECLS diff -Nru spice-gtk-0.9/gtk/spice-util.c spice-gtk-0.12/gtk/spice-util.c --- spice-gtk-0.9/gtk/spice-util.c 2011-12-01 11:59:57.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-util.c 2012-04-11 13:51:02.000000000 +0000 @@ -20,7 +20,9 @@ # include "config.h" #endif #include +#include "spice-util-priv.h" #include "spice-util.h" +#include "spice-util-priv.h" /** * SECTION:spice-util @@ -76,6 +78,16 @@ return FALSE; } +G_GNUC_INTERNAL +gchar* spice_uuid_to_string(const guint8 uuid[16]) +{ + return g_strdup_printf(UUID_FMT, uuid[0], uuid[1], + uuid[2], uuid[3], uuid[4], uuid[5], + uuid[6], uuid[7], uuid[8], uuid[9], + uuid[10], uuid[11], uuid[12], uuid[13], + uuid[14], uuid[15]); +} + typedef struct { GObject *instance; GObject *observer; @@ -192,3 +204,9 @@ return ctx->handler_id; } + +G_GNUC_INTERNAL +const gchar* spice_yes_no(gboolean value) +{ + return value ? "yes" : "no"; +} diff -Nru spice-gtk-0.9/gtk/spice-util.h spice-gtk-0.12/gtk/spice-util.h --- spice-gtk-0.9/gtk/spice-util.h 2011-12-01 11:59:57.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-util.h 2012-04-11 13:51:02.000000000 +0000 @@ -18,7 +18,7 @@ #ifndef SPICE_UTIL_H #define SPICE_UTIL_H -#include +#include G_BEGIN_DECLS @@ -39,6 +39,13 @@ #define SPICE_RESERVED_PADDING 44 +#ifndef SPICE_NO_DEPRECATED +#define SPICE_DEPRECATED_FOR(f) \ + G_GNUC_DEPRECATED_FOR(f) +#else +#define SPICE_DEPRECATED_FOR(f) +#endif + G_END_DECLS #endif /* SPICE_UTIL_H */ diff -Nru spice-gtk-0.9/gtk/spice-util-priv.h spice-gtk-0.12/gtk/spice-util-priv.h --- spice-gtk-0.9/gtk/spice-util-priv.h 2011-12-01 11:59:57.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-util-priv.h 2012-04-11 13:51:02.000000000 +0000 @@ -22,7 +22,25 @@ G_BEGIN_DECLS +#define UUID_FMT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x" + gboolean spice_strv_contains(const GStrv strv, const gchar *str); +gchar* spice_uuid_to_string(const guint8 uuid[16]); +const gchar* spice_yes_no(gboolean value); + +#if GLIB_CHECK_VERSION(2,32,0) +#define STATIC_MUTEX GMutex +#define STATIC_MUTEX_INIT(m) g_mutex_init(&(m)) +#define STATIC_MUTEX_CLEAR(m) g_mutex_clear(&(m)) +#define STATIC_MUTEX_LOCK(m) g_mutex_lock(&(m)) +#define STATIC_MUTEX_UNLOCK(m) g_mutex_unlock(&(m)) +#else +#define STATIC_MUTEX GStaticMutex +#define STATIC_MUTEX_INIT(m) g_static_mutex_init(&(m)) +#define STATIC_MUTEX_CLEAR(m) g_static_mutex_free(&(m)) +#define STATIC_MUTEX_LOCK(m) g_static_mutex_lock(&(m)) +#define STATIC_MUTEX_UNLOCK(m) g_static_mutex_unlock(&(m)) +#endif G_END_DECLS diff -Nru spice-gtk-0.9/gtk/spice-widget.c spice-gtk-0.12/gtk/spice-widget.c --- spice-gtk-0.9/gtk/spice-widget.c 2012-01-16 09:44:21.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-widget.c 2012-04-23 17:31:56.000000000 +0000 @@ -101,6 +101,7 @@ PROP_AUTO_CLIPBOARD, PROP_SCALING, PROP_DISABLE_INPUTS, + PROP_ZOOM_LEVEL }; /* Signals */ @@ -123,7 +124,7 @@ static void update_mouse_grab(SpiceDisplay *display); static void try_mouse_grab(SpiceDisplay *display); static void try_mouse_ungrab(SpiceDisplay *display); -static void recalc_geometry(GtkWidget *widget, gboolean set_display); +static void recalc_geometry(GtkWidget *widget); static void disconnect_main(SpiceDisplay *display); static void disconnect_cursor(SpiceDisplay *display); static void disconnect_display(SpiceDisplay *display); @@ -169,12 +170,45 @@ case PROP_DISABLE_INPUTS: g_value_set_boolean(value, d->disable_inputs); break; + case PROP_ZOOM_LEVEL: + g_value_set_int(value, d->zoom_level); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } } +static void scaling_updated(SpiceDisplay *display) +{ + SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display); + GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(display)); + + recalc_geometry(GTK_WIDGET(display)); + if (d->ximage && window) { /* if not yet shown */ + int ww, wh; + gdk_drawable_get_size(gtk_widget_get_window(GTK_WIDGET(display)), &ww, &wh); + gtk_widget_queue_draw_area(GTK_WIDGET(display), 0, 0, ww, wh); + } +} + +static void update_size_request(SpiceDisplay *display) +{ + SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display); + gint reqwidth, reqheight; + + if (d->resize_guest_enable) { + reqwidth = 640; + reqheight = 480; + } else { + reqwidth = d->width; + reqheight = d->height; + } + + gtk_widget_set_size_request(GTK_WIDGET(display), reqwidth, reqheight); + recalc_geometry(GTK_WIDGET(display)); +} + static void spice_display_set_property(GObject *object, guint prop_id, const GValue *value, @@ -201,23 +235,11 @@ break; case PROP_RESIZE_GUEST: d->resize_guest_enable = g_value_get_boolean(value); - if (d->resize_guest_enable) { - gtk_widget_set_size_request(GTK_WIDGET(display), 640, 480); - recalc_geometry(GTK_WIDGET(display), TRUE); - } else { - gtk_widget_set_size_request(GTK_WIDGET(display), - d->width, d->height); - } + update_size_request(display); break; case PROP_SCALING: d->allow_scaling = g_value_get_boolean(value); - recalc_geometry(GTK_WIDGET(display), FALSE); - if (d->ximage && - gtk_widget_get_window(GTK_WIDGET(display))) { /* if not yet shown */ - int ww, wh; - gdk_drawable_get_size(gtk_widget_get_window(GTK_WIDGET(display)), &ww, &wh); - gtk_widget_queue_draw_area(GTK_WIDGET(display), 0, 0, ww, wh); - } + scaling_updated(display); break; case PROP_AUTO_CLIPBOARD: g_object_set(d->gtk_session, "auto-clipboard", @@ -229,6 +251,10 @@ update_keyboard_grab(display); update_mouse_grab(display); break; + case PROP_ZOOM_LEVEL: + d->zoom_level = g_value_get_int(value); + scaling_updated(display); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -320,6 +346,23 @@ return gdk_cursor_new(GDK_BLANK_CURSOR); } +static gboolean grab_broken(SpiceDisplay *self, GdkEventGrabBroken *event, + gpointer user_data G_GNUC_UNUSED) +{ + SpiceDisplayPrivate *d = self->priv; + + SPICE_DEBUG("%s (%d)", __FUNCTION__, event->implicit); + if (event->keyboard) { + d->keyboard_grab_active = false; + g_signal_emit(self, signals[SPICE_DISPLAY_KEYBOARD_GRAB], 0, false); + } else { + d->mouse_grab_active = false; + g_signal_emit(self, signals[SPICE_DISPLAY_MOUSE_GRAB], 0, false); + } + + return false; +} + static void spice_display_init(SpiceDisplay *display) { GtkWidget *widget = GTK_WIDGET(display); @@ -327,6 +370,7 @@ d = display->priv = SPICE_DISPLAY_GET_PRIVATE(display); + g_signal_connect(display, "grab-broken-event", G_CALLBACK(grab_broken), NULL); gtk_widget_add_events(widget, GDK_STRUCTURE_MASK | GDK_POINTER_MOTION_MASK | @@ -335,10 +379,11 @@ GDK_BUTTON_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | - GDK_KEY_PRESS_MASK); + GDK_KEY_PRESS_MASK | + GDK_SCROLL_MASK); gtk_widget_set_double_buffered(widget, false); gtk_widget_set_can_focus(widget, true); - + gtk_widget_set_has_window(widget, true); d->keycode_map = vnc_display_keymap_gdk2xtkbd_table(&d->keycode_maplen); d->grabseq = spice_grab_sequence_new_from_string("Control_L+Alt_L"); d->activeseq = g_new0(gboolean, d->grabseq->nkeysyms); @@ -584,7 +629,6 @@ ClipCursor(&client_rect); } #endif - gtk_grab_add(GTK_WIDGET(display)); #ifdef GDK_WINDOWING_X11 if (status == GDK_GRAB_SUCCESS) { @@ -593,7 +637,7 @@ int threshold; GdkWindow *w = GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display))); Display *x_display = GDK_WINDOW_XDISPLAY(w); - + XGetPointerControl(x_display, &accel_numerator, &accel_denominator, &threshold); XChangePointerControl(x_display, False, False, accel_numerator, @@ -656,35 +700,19 @@ d->mouse_last_y = -1; } -static void mouse_check_edges(GtkWidget *widget, GdkEventMotion *motion) +static void mouse_wrap(SpiceDisplay *display, GdkEventMotion *motion) { - SpiceDisplay *display = SPICE_DISPLAY(widget); SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display); - GdkScreen *screen = gtk_widget_get_screen(widget); - gint ww, wh; + GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(display)); - gdk_drawable_get_size(gtk_widget_get_window(widget), &ww, &wh); - int x = (int)motion->x; - int y = (int)motion->y; - int xr = (int)motion->x_root; - int yr = (int)motion->y_root; - - /* from gtk-vnc: In relative mode check to see if client pointer - * hit the window edges, and if so move it back by 100px. This is - * important because the pointer in the server doesn't correspond - * 1-for-1, and so may still be only half way across the - * screen. Without this warp, the server pointer would thus appear - * to hit an invisible wall */ - if (x <= 0) xr += 100; - if (y <= 0) yr += 100; - if (x >= (ww - 1)) xr -= 100; - if (y >= (wh - 1)) yr -= 100; + gint xr = gdk_screen_get_width(screen) / 2; + gint yr = gdk_screen_get_height(screen) / 2; - if (xr != (int)motion->x_root || yr != (int)motion->y_root) { + if (xr != (gint)motion->x_root || yr != (gint)motion->y_root) { /* FIXME: we try our best to ignore that next pointer move event.. */ gdk_display_sync(gdk_screen_get_display(screen)); - gdk_display_warp_pointer(gtk_widget_get_display(widget), + gdk_display_warp_pointer(gtk_widget_get_display(GTK_WIDGET(display)), screen, xr, yr); d->mouse_last_x = -1; d->mouse_last_y = -1; @@ -710,7 +738,7 @@ int threshold; GdkWindow *w = GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display))); Display *x_display = GDK_WINDOW_XDISPLAY(w); - + XGetPointerControl(x_display, &accel_numerator, &accel_denominator, &threshold); XChangePointerControl(x_display, True, True, accel_numerator, @@ -733,10 +761,11 @@ try_mouse_ungrab(display); } -static void recalc_geometry(GtkWidget *widget, gboolean set_display) +static void recalc_geometry(GtkWidget *widget) { SpiceDisplay *display = SPICE_DISPLAY(widget); SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display); + gdouble zoom = 1.0; d->mx = 0; d->my = 0; @@ -745,15 +774,15 @@ d->mx = (d->ww - d->width) / 2; if (d->wh > d->height) d->my = (d->wh - d->height) / 2; - } + } else + zoom = (gdouble)d->zoom_level / 100; - SPICE_DEBUG("monitors: id %d, guest %dx%d, window %dx%d, offset +%d+%d", - d->channel_id, d->width, d->height, d->ww, d->wh, d->mx, d->my); + SPICE_DEBUG("monitors: id %d, guest %dx%d, window %dx%d, zoom %g, offset +%d+%d", + d->channel_id, d->width, d->height, d->ww, d->wh, zoom, d->mx, d->my); - if (d->resize_guest_enable && set_display) { + if (d->resize_guest_enable) spice_main_set_display(d->main, d->channel_id, - 0, 0, d->ww, d->wh); - } + 0, 0, d->ww / zoom, d->wh / zoom); } /* ---------------------------------------------------------------- */ @@ -1127,16 +1156,26 @@ return true; gdk_drawable_get_size(gtk_widget_get_window(widget), &ww, &wh); - if (spicex_is_scaled(display)) { + if (spicex_is_scaled(display) && (d->width != ww || d->height != wh)) { double sx, sy; sx = (double)d->width / (double)ww; sy = (double)d->height / (double)wh; - /* Scaling the desktop, so scale the mouse coords by same - * ratio - ceil() seems to be more accurate - not sure - * though - scaling is more likely reversible.. */ - motion->x = ceil(motion->x * sx); - motion->y = ceil(motion->y * sy); + /* Scaling the desktop, so scale the mouse coords by the same. + * Ratio for the rounding used: + * 1) We should be able to send mouse coords for all 4 corner pixels + * 2) The GdkMotion events are double's, so we've X.Xfrac and Y.Yfrac + * 3) The X and Y integer values always go from 0 - (ww/wh - 1) + * 4) Note that even if Xfrac = .99999, X will still go from 0 - (ww-1) + * so x will go from 0.99999 - (ww-1).99999 + * 5) Given 4, the only way to be sure we can always generate 0 + * coordinates is to first floor the input coordinates + * 6) To avoid rounding errors causing us to be unable to generate + * coordinates for the bottom row / left column of pixels we ceil + * the end result + */ + motion->x = ceil(floor(motion->x) * sx); + motion->y = ceil(floor(motion->y) * sy); } else { motion->x -= d->mx; motion->y -= d->my; @@ -1154,18 +1193,15 @@ break; case SPICE_MOUSE_MODE_SERVER: if (d->mouse_grab_active) { - if (d->mouse_last_x != -1 && - d->mouse_last_y != -1) { - gint dx = motion->x - d->mouse_last_x; - gint dy = motion->y - d->mouse_last_y; + gint dx = d->mouse_last_x != -1 ? motion->x - d->mouse_last_x : 0; + gint dy = d->mouse_last_y != -1 ? motion->y - d->mouse_last_y : 0; - spice_inputs_motion(d->inputs, dx, dy, - button_mask_gdk_to_spice(motion->state)); - } + spice_inputs_motion(d->inputs, dx, dy, + button_mask_gdk_to_spice(motion->state)); d->mouse_last_x = motion->x; d->mouse_last_y = motion->y; - mouse_check_edges(widget, motion); + mouse_wrap(display, motion); } break; default: @@ -1277,7 +1313,7 @@ if (conf->width != d->ww || conf->height != d->wh) { d->ww = conf->width; d->wh = conf->height; - recalc_geometry(widget, TRUE); + recalc_geometry(widget); } return true; } @@ -1417,6 +1453,25 @@ G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); + + /** + * SpiceDisplay:zoom-level: + * + * Zoom level in percentage, from 10 to 400. Default to 100. + * (this option is only supported with cairo backend when scaling + * is enabled) + * + * Since: 0.10 + **/ + g_object_class_install_property + (gobject_class, PROP_ZOOM_LEVEL, + g_param_spec_int("zoom-level", "Zoom Level", + "Zoom Level", + 10, 400, 100, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); + /** * SpiceDisplay::mouse-grab: * @display: the #SpiceDisplay that emitted the signal @@ -1503,7 +1558,6 @@ { SpiceDisplay *display = data; SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display); - gboolean set_display = FALSE; d->format = format; d->stride = stride; @@ -1511,14 +1565,9 @@ d->data_origin = d->data = imgdata; if (d->width != width || d->height != height) { - if (d->width != 0 && d->height != 0) - set_display = TRUE; d->width = width; d->height = height; - recalc_geometry(GTK_WIDGET(display), set_display); - if (!d->resize_guest_enable) { - gtk_widget_set_size_request(GTK_WIDGET(display), width, height); - } + update_size_request(display); } } @@ -1573,19 +1622,10 @@ { SpiceDisplay *display = data; SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display); + GdkCursor *cursor = NULL; cursor_invalidate(display); - if (d->show_cursor) { - gdk_cursor_unref(d->show_cursor); - d->show_cursor = NULL; - } - - if (d->mouse_cursor) { - gdk_cursor_unref(d->mouse_cursor); - d->mouse_cursor = NULL; - } - if (d->mouse_pixbuf) { g_object_unref(d->mouse_pixbuf); d->mouse_pixbuf = NULL; @@ -1601,15 +1641,27 @@ (GdkPixbufDestroyNotify)g_free, NULL); d->mouse_hotspot.x = hot_x; d->mouse_hotspot.y = hot_y; + cursor = gdk_cursor_new_from_pixbuf(gtk_widget_get_display(GTK_WIDGET(display)), + d->mouse_pixbuf, hot_x, hot_y); + } else + g_warn_if_reached(); - /* gdk_cursor_new_from_pixbuf() will copy pixbuf data on - x11/win32/macos. No worries if rgba pointer is freed - after. */ - d->mouse_cursor = gdk_cursor_new_from_pixbuf(gtk_widget_get_display(GTK_WIDGET(display)), - d->mouse_pixbuf, hot_x, hot_y); + if (d->show_cursor) { + /* unhide */ + gdk_cursor_unref(d->show_cursor); + d->show_cursor = NULL; + if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER) { + /* keep a hidden cursor, will be shown in cursor_move() */ + d->show_cursor = cursor; + return; + } } + gdk_cursor_unref(d->mouse_cursor); + d->mouse_cursor = cursor; + update_mouse_pointer(display); + cursor_invalidate(display); } static void cursor_hide(SpiceCursorChannel *channel, gpointer data) @@ -1620,6 +1672,7 @@ if (d->show_cursor != NULL) /* then we are already hidden */ return; + cursor_invalidate(display); d->show_cursor = d->mouse_cursor; d->mouse_cursor = get_blank_cursor(); update_mouse_pointer(display); @@ -1632,7 +1685,7 @@ int fbw = d->width, fbh = d->height; int ww, wh; - if (!spicex_is_scaled(display)) { + if (!spicex_is_scaled(display) || !gtk_widget_get_window(GTK_WIDGET(display))) { *sx = 1.0; *sy = 1.0; return; @@ -1719,6 +1772,7 @@ display); g_signal_handlers_disconnect_by_func(d->display, G_CALLBACK(invalidate), display); + primary_destroy(d->display, display); d->display = NULL; } @@ -1879,7 +1933,6 @@ * * Deprecated: 0.8: Use spice_gtk_session_copy_to_guest() instead **/ -G_GNUC_DEPRECATED_FOR(spice_gtk_session_copy_to_guest) void spice_display_copy_to_guest(SpiceDisplay *display) { SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display); @@ -1897,7 +1950,6 @@ * * Deprecated: 0.8: Use spice_gtk_session_paste_from_guest() instead **/ -G_GNUC_DEPRECATED_FOR(spice_gtk_session_paste_from_guest) void spice_display_paste_from_guest(SpiceDisplay *display) { SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display); diff -Nru spice-gtk-0.9/gtk/spice-widget-cairo.c spice-gtk-0.12/gtk/spice-widget-cairo.c --- spice-gtk-0.9/gtk/spice-widget-cairo.c 2011-12-09 16:25:33.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-widget-cairo.c 2012-04-11 13:51:02.000000000 +0000 @@ -103,7 +103,8 @@ } cairo_paint(cr); - if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER) { + if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER && + !d->show_cursor) { GdkPixbuf *image = d->mouse_pixbuf; if (image != NULL) { gdk_cairo_set_source_pixbuf(cr, image, diff -Nru spice-gtk-0.9/gtk/spice-widget.h spice-gtk-0.12/gtk/spice-widget.h --- spice-gtk-0.9/gtk/spice-widget.h 2011-11-03 10:31:59.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-widget.h 2012-04-11 13:51:02.000000000 +0000 @@ -72,14 +72,19 @@ SpiceDisplay* spice_display_new(SpiceSession *session, int id); void spice_display_mouse_ungrab(SpiceDisplay *display); -void spice_display_copy_to_guest(SpiceDisplay *display); -void spice_display_paste_from_guest(SpiceDisplay *display); void spice_display_set_grab_keys(SpiceDisplay *display, SpiceGrabSequence *seq); SpiceGrabSequence *spice_display_get_grab_keys(SpiceDisplay *display); void spice_display_send_keys(SpiceDisplay *display, const guint *keyvals, int nkeyvals, SpiceDisplayKeyEvent kind); GdkPixbuf *spice_display_get_pixbuf(SpiceDisplay *display); +#ifndef SPICE_DISABLE_DEPRECATED +SPICE_DEPRECATED_FOR(spice_gtk_session_copy_to_guest) +void spice_display_copy_to_guest(SpiceDisplay *display); +SPICE_DEPRECATED_FOR(spice_gtk_session_paste_from_guest) +void spice_display_paste_from_guest(SpiceDisplay *display); +#endif + G_END_DECLS #endif /* __SPICE_CLIENT_WIDGET_H__ */ diff -Nru spice-gtk-0.9/gtk/spice-widget-priv.h spice-gtk-0.12/gtk/spice-widget-priv.h --- spice-gtk-0.9/gtk/spice-widget-priv.h 2011-12-09 16:25:33.000000000 +0000 +++ spice-gtk-0.12/gtk/spice-widget-priv.h 2012-04-21 17:18:21.000000000 +0000 @@ -107,6 +107,7 @@ #ifdef WIN32 HHOOK keyboard_hook; #endif + gint zoom_level; }; int spicex_image_create (SpiceDisplay *display); diff -Nru spice-gtk-0.9/gtk/spicy.c spice-gtk-0.12/gtk/spicy.c --- spice-gtk-0.9/gtk/spicy.c 2012-01-31 13:28:56.000000000 +0000 +++ spice-gtk-0.12/gtk/spicy.c 2012-04-11 13:51:02.000000000 +0000 @@ -40,9 +40,7 @@ #include "spice-option.h" #include "usb-device-widget.h" -/* config */ -static gboolean fullscreen = false; -static gboolean version = false; +typedef struct spice_connection spice_connection; enum { STATE_SCROLL_LOCK, @@ -51,10 +49,18 @@ STATE_MAX, }; -typedef struct spice_window spice_window; -typedef struct spice_connection spice_connection; +#define SPICE_TYPE_WINDOW (spice_window_get_type ()) +#define SPICE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPICE_TYPE_WINDOW, SpiceWindow)) +#define SPICE_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SPICE_TYPE_WINDOW)) +#define SPICE_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SPICE_TYPE_WINDOW, SpiceWindowClass)) +#define SPICE_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SPICE_TYPE_WINDOW)) +#define SPICE_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SPICE_TYPE_WINDOW, SpiceWindowClass)) -struct spice_window { +typedef struct _SpiceWindow SpiceWindow; +typedef struct _SpiceWindowClass SpiceWindowClass; + +struct _SpiceWindow { + GObject object; spice_connection *conn; int id; GtkWidget *toplevel, *spice; @@ -74,37 +80,48 @@ bool enable_mnemonics_save; }; +struct _SpiceWindowClass +{ + GObjectClass parent_class; +}; + +G_DEFINE_TYPE (SpiceWindow, spice_window, G_TYPE_OBJECT); + struct spice_connection { SpiceSession *session; SpiceGtkSession *gtk_session; - spice_window *wins[4]; + SpiceWindow *wins[4]; SpiceAudio *audio; - char *mouse_state; - char *agent_state; + const char *mouse_state; + const char *agent_state; gboolean agent_connected; int channels; int disconnecting; }; -static GMainLoop *mainloop = NULL; -static int connections = 0; -static GKeyFile *keyfile = NULL; -static GnomeRRScreen *rrscreen = NULL; -static GnomeRRConfig *rrsaved = NULL; -static GnomeRRConfig *rrcurrent = NULL; - static spice_connection *connection_new(void); static void connection_connect(spice_connection *conn); static void connection_disconnect(spice_connection *conn); static void connection_destroy(spice_connection *conn); -static void resolution_fullscreen(struct spice_window *win); -static void resolution_restore(struct spice_window *win); +static void resolution_fullscreen(SpiceWindow *win); +static void resolution_restore(SpiceWindow *win); static void usb_connect_failed(GObject *object, SpiceUsbDevice *device, GError *error, gpointer data); static gboolean is_gtk_session_property(const gchar *property); +/* options */ +static gboolean fullscreen = false; +static gboolean version = false; +/* globals */ +static GMainLoop *mainloop = NULL; +static int connections = 0; +static GKeyFile *keyfile = NULL; +static GnomeRRScreen *rrscreen = NULL; +static GnomeRRConfig *rrsaved = NULL; +static GnomeRRConfig *rrcurrent = NULL; + /* ------------------------------------------------------------------ */ static int ask_user(GtkWidget *parent, char *title, char *message, @@ -276,7 +293,7 @@ /* ------------------------------------------------------------------ */ -static void update_status_window(struct spice_window *win) +static void update_status_window(SpiceWindow *win) { char status[256]; @@ -312,26 +329,26 @@ static void menu_cb_close(GtkAction *action, void *data) { - struct spice_window *win = data; + SpiceWindow *win = data; connection_disconnect(win->conn); } static void menu_cb_copy(GtkAction *action, void *data) { - struct spice_window *win = data; + SpiceWindow *win = data; spice_gtk_session_copy_to_guest(win->conn->gtk_session); } static void menu_cb_paste(GtkAction *action, void *data) { - struct spice_window *win = data; + SpiceWindow *win = data; spice_gtk_session_paste_from_guest(win->conn->gtk_session); } -static void window_set_fullscreen(struct spice_window *win, gboolean fs) +static void window_set_fullscreen(SpiceWindow *win, gboolean fs) { if (fs) { #ifdef WIN32 @@ -348,20 +365,20 @@ static void menu_cb_fullscreen(GtkAction *action, void *data) { - struct spice_window *win = data; + SpiceWindow *win = data; window_set_fullscreen(win, !win->fullscreen); } static void menu_cb_ungrab(GtkAction *action, void *data) { - struct spice_window *win = data; + SpiceWindow *win = data; spice_display_mouse_ungrab(SPICE_DISPLAY(win->spice)); } #ifdef USE_SMARTCARD -static void enable_smartcard_actions(spice_window *win, VReader *reader, +static void enable_smartcard_actions(SpiceWindow *win, VReader *reader, gboolean can_insert, gboolean can_remove) { GtkAction *action; @@ -419,10 +436,15 @@ #endif #ifdef USE_USBREDIR +static void remove_cb(GtkContainer *container, GtkWidget *widget, void *data) +{ + gtk_window_resize(GTK_WINDOW(data), 1, 1); +} + static void menu_cb_select_usb_devices(GtkAction *action, void *data) { GtkWidget *dialog, *area, *usb_device_widget; - struct spice_window *win = data; + SpiceWindow *win = data; /* Create the widgets */ dialog = gtk_dialog_new_with_buttons( @@ -432,13 +454,20 @@ GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); + gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); + gtk_box_set_spacing(GTK_BOX(gtk_bin_get_child(GTK_BIN(dialog))), 12); + area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); usb_device_widget = spice_usb_device_widget_new(win->conn->session, "%s %s"); g_signal_connect(usb_device_widget, "connect-failed", G_CALLBACK(usb_connect_failed), NULL); - gtk_box_pack_start(GTK_BOX(area), usb_device_widget, TRUE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(area), usb_device_widget, TRUE, TRUE, 0); + + /* This shrinks the dialog when USB devices are unplugged */ + g_signal_connect(usb_device_widget, "remove", + G_CALLBACK(remove_cb), dialog); /* show and run */ gtk_widget_show_all(dialog); @@ -449,7 +478,7 @@ static void menu_cb_bool_prop(GtkToggleAction *action, gpointer data) { - struct spice_window *win = data; + SpiceWindow *win = data; gboolean state = gtk_toggle_action_get_active(action); const char *name; gpointer object; @@ -471,7 +500,7 @@ GParamSpec *pspec, gpointer user_data) { - struct spice_window *win = user_data; + SpiceWindow *win = user_data; const gchar *property = g_param_spec_get_name(pspec); GtkAction *toggle; gboolean state; @@ -483,7 +512,7 @@ static void menu_cb_toolbar(GtkToggleAction *action, gpointer data) { - struct spice_window *win = data; + SpiceWindow *win = data; gboolean state = gtk_toggle_action_get_active(action); gtk_widget_set_visible(win->toolbar, state); @@ -492,7 +521,7 @@ static void menu_cb_statusbar(GtkToggleAction *action, gpointer data) { - struct spice_window *win = data; + SpiceWindow *win = data; gboolean state = gtk_toggle_action_get_active(action); gtk_widget_set_visible(win->statusbar, state); @@ -503,12 +532,12 @@ { char *comments = _("gtk test client app for the\n" "spice remote desktop protocol"); - static char *copyright = "(c) 2010 Red Hat"; - static char *website = "http://www.spice-space.org"; - static char *authors[] = { "Gerd Hoffmann ", + static const char *copyright = "(c) 2010 Red Hat"; + static const char *website = "http://www.spice-space.org"; + static const char *authors[] = { "Gerd Hoffmann ", "Marc-André Lureau ", NULL }; - struct spice_window *win = data; + SpiceWindow *win = data; gtk_show_about_dialog(GTK_WINDOW(win->toplevel), "authors", authors, @@ -523,7 +552,7 @@ static gboolean delete_cb(GtkWidget *widget, GdkEvent *event, gpointer data) { - struct spice_window *win = data; + SpiceWindow *win = data; connection_disconnect(win->conn); return true; @@ -532,7 +561,7 @@ static gboolean window_state_cb(GtkWidget *widget, GdkEventWindowState *event, gpointer data) { - struct spice_window *win = data; + SpiceWindow *win = data; if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) { win->fullscreen = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN; if (win->fullscreen) { @@ -558,7 +587,7 @@ static void grab_keys_pressed_cb(GtkWidget *widget, gpointer data) { - struct spice_window *win = data; + SpiceWindow *win = data; /* since mnemonics are disabled, we leave fullscreen when ungrabbing mouse. Perhaps we should have a different handling @@ -568,7 +597,7 @@ static void mouse_grab_cb(GtkWidget *widget, gint grabbed, gpointer data) { - struct spice_window *win = data; + SpiceWindow *win = data; win->mouse_grabbed = grabbed; update_status(win->conn); @@ -576,7 +605,7 @@ static void keyboard_grab_cb(GtkWidget *widget, gint grabbed, gpointer data) { - struct spice_window *win = data; + SpiceWindow *win = data; GtkSettings *settings = gtk_widget_get_settings (widget); if (grabbed) { @@ -597,7 +626,7 @@ } } -static void restore_configuration(struct spice_window *win) +static void restore_configuration(SpiceWindow *win) { gboolean state; gchar *str; @@ -614,7 +643,6 @@ return; } - g_return_if_fail(nkeys >= 0); if (nkeys > 0) g_return_if_fail(keys != NULL); @@ -764,9 +792,7 @@ static const char *spice_gtk_session_properties[] = { "auto-clipboard", -#ifdef USE_USBREDIR "auto-usbredir", -#endif }; static const GtkToggleActionEntry tentries[] = { @@ -795,12 +821,10 @@ .label = N_("Automagic clipboard sharing between host and guest"), .callback = G_CALLBACK(menu_cb_bool_prop), },{ -#ifdef USE_USBREDIR .name = "auto-usbredir", .label = N_("Auto redirect newly plugged in USB devices"), .callback = G_CALLBACK(menu_cb_bool_prop), },{ -#endif .name = "Statusbar", .label = N_("Statusbar"), .callback = G_CALLBACK(menu_cb_statusbar), @@ -846,9 +870,7 @@ " \n" " \n" " \n" -#ifdef USE_USBREDIR " \n" -#endif " \n" " \n" " \n" @@ -1011,7 +1033,7 @@ g_clear_error(&error); } -static void resolution_fullscreen(struct spice_window *win) +static void resolution_fullscreen(SpiceWindow *win) { GnomeRROutputInfo *output; int x, y, width, height; @@ -1041,7 +1063,7 @@ #endif } -static void resolution_restore(struct spice_window *win) +static void resolution_restore(SpiceWindow *win) { GnomeRROutputInfo *output, *saved; int x, y, width, height; @@ -1092,7 +1114,7 @@ gpointer data) { gboolean resize_guest; - struct spice_window *win = data; + SpiceWindow *win = data; g_return_val_if_fail(win != NULL, FALSE); g_return_val_if_fail(win->conn != NULL, FALSE); @@ -1109,10 +1131,20 @@ return FALSE; } -static spice_window *create_spice_window(spice_connection *conn, int id, SpiceChannel *channel) +static void +spice_window_class_init (SpiceWindowClass *klass) +{ +} + +static void +spice_window_init (SpiceWindow *self) +{ +} + +static SpiceWindow *create_spice_window(spice_connection *conn, int id, SpiceChannel *channel) { char title[32]; - struct spice_window *win; + SpiceWindow *win; GtkAction *toggle; gboolean state; GtkWidget *vbox, *frame; @@ -1120,7 +1152,7 @@ int i; SpiceGrabSequence *seq; - win = g_new0(struct spice_window, 1); + win = g_object_new(SPICE_TYPE_WINDOW, NULL); win->id = id; win->conn = conn; win->display_channel = channel; @@ -1186,7 +1218,11 @@ G_CALLBACK(grab_keys_pressed_cb), win); /* status line */ +#if GTK_CHECK_VERSION(3,0,0) + win->statusbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1); +#else win->statusbar = gtk_hbox_new(FALSE, 1); +#endif win->status = gtk_label_new("status line"); gtk_misc_set_alignment(GTK_MISC(win->status), 0, 0.5); @@ -1206,7 +1242,11 @@ } /* Make a vbox and put stuff in */ +#if GTK_CHECK_VERSION(3,0,0) + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1); +#else vbox = gtk_vbox_new(FALSE, 1); +#endif gtk_container_set_border_width(GTK_CONTAINER(vbox), 0); gtk_container_add(GTK_CONTAINER(win->toplevel), vbox); gtk_box_pack_start(GTK_BOX(vbox), win->menubar, FALSE, FALSE, 0); @@ -1240,8 +1280,9 @@ snprintf(notify, sizeof(notify), "notify::%s", spice_gtk_session_properties[i]); - g_signal_connect(win->conn->gtk_session, notify, - G_CALLBACK(menu_cb_conn_bool_prop_changed), win); + spice_g_signal_connect_object(win->conn->gtk_session, notify, + G_CALLBACK(menu_cb_conn_bool_prop_changed), + win, 0); } toggle = gtk_action_group_get_action(win->ag, "Toolbar"); @@ -1271,18 +1312,23 @@ } #endif +#ifndef USE_USBREDIR + GtkAction *usbredir = gtk_action_group_get_action(win->ag, "auto-usbredir"); + gtk_action_set_visible(usbredir, FALSE); +#endif + gtk_widget_grab_focus(win->spice); return win; } -static void destroy_spice_window(spice_window *win) +static void destroy_spice_window(SpiceWindow *win) { SPICE_DEBUG("destroy window (#%d)", win->id); g_object_unref(win->ag); g_object_unref(win->ui); gtk_widget_destroy(win->toplevel); - free(win); + g_object_unref(win); } /* ------------------------------------------------------------------ */ @@ -1291,9 +1337,9 @@ { GtkRecentManager *recent; GtkRecentData meta = { - .mime_type = "application/x-spice", - .app_name = "spicy", - .app_exec = "spicy --uri=%u", + .mime_type = (char*)"application/x-spice", + .app_name = (char*)"spicy", + .app_exec = (char*)"spicy --uri=%u", }; char *uri; @@ -1414,7 +1460,7 @@ } } -static void display_mark(SpiceChannel *channel, gint mark, spice_window *win) +static void display_mark(SpiceChannel *channel, gint mark, SpiceWindow *win) { g_return_if_fail(win != NULL); g_return_if_fail(win->toplevel != NULL); @@ -1484,10 +1530,8 @@ } if (SPICE_IS_PLAYBACK_CHANNEL(channel)) { - if (conn->audio != NULL) - return; SPICE_DEBUG("new audio channel"); - conn->audio = spice_audio_new(s, NULL, NULL); + conn->audio = spice_audio_get(s, NULL); } if (SPICE_IS_USBREDIR_CHANNEL(channel)) { @@ -1517,10 +1561,6 @@ if (SPICE_IS_PLAYBACK_CHANNEL(channel)) { SPICE_DEBUG("zap audio channel"); - if (conn->audio != NULL) { - g_object_unref(conn->audio); - conn->audio = NULL; - } } if (SPICE_IS_USBREDIR_CHANNEL(channel)) { @@ -1564,6 +1604,8 @@ if (manager) { g_signal_connect(manager, "auto-connect-failed", G_CALLBACK(usb_connect_failed), NULL); + g_signal_connect(manager, "device-error", + G_CALLBACK(usb_connect_failed), NULL); } connections++; @@ -1678,7 +1720,9 @@ spice_connection *conn; gchar *conf_file, *conf; +#if !GLIB_CHECK_VERSION(2,31,18) g_thread_init(NULL); +#endif bindtextdomain(GETTEXT_PACKAGE, SPICE_GTK_LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); diff -Nru spice-gtk-0.9/gtk/usb-acl-helper.c spice-gtk-0.12/gtk/usb-acl-helper.c --- spice-gtk-0.9/gtk/usb-acl-helper.c 2012-01-15 19:43:53.000000000 +0000 +++ spice-gtk-0.12/gtk/usb-acl-helper.c 2012-04-11 13:51:02.000000000 +0000 @@ -87,6 +87,13 @@ /* ------------------------------------------------------------------ */ /* callbacks */ +static void async_result_set_cancelled(GSimpleAsyncResult *result) +{ + g_simple_async_result_set_error(result, + G_IO_ERROR, G_IO_ERROR_CANCELLED, + "Setting USB device node ACL cancelled"); +} + static gboolean cb_out_watch(GIOChannel *channel, GIOCondition cond, gpointer *user_data) @@ -111,6 +118,8 @@ string[strlen(string) - 1] = 0; if (!strcmp(string, "SUCCESS")) { success = TRUE; + } else if (!strcmp(string, "CANCELED")) { + async_result_set_cancelled(priv->result); } else { g_simple_async_result_set_error(priv->result, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, @@ -126,6 +135,7 @@ g_simple_async_result_set_error(priv->result, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, "Unexpected EOF reading from acl helper stdout"); + break; case G_IO_STATUS_AGAIN: return TRUE; /* Wait for more input */ } @@ -185,7 +195,7 @@ GIOStatus status; GPid helper_pid; gsize bytes_written; - gchar *argv[] = { ACL_HELPER_PATH"/spice-client-glib-usb-acl-helper", NULL }; + gchar *argv[] = { (char*) ACL_HELPER_PATH"/spice-client-glib-usb-acl-helper", NULL }; gint in, out; gchar buf[128]; @@ -278,9 +288,7 @@ /* If the acl open has not completed yet report it as cancelled */ if (priv->result) { - g_simple_async_result_set_error(priv->result, - G_IO_ERROR, G_IO_ERROR_CANCELLED, - "Setting USB device node ACL cancelled"); + async_result_set_cancelled(priv->result); g_simple_async_result_complete_in_idle(priv->result); } diff -Nru spice-gtk-0.9/gtk/usb-acl-helper.h spice-gtk-0.12/gtk/usb-acl-helper.h --- spice-gtk-0.9/gtk/usb-acl-helper.h 2011-11-16 16:07:03.000000000 +0000 +++ spice-gtk-0.12/gtk/usb-acl-helper.h 2012-04-11 13:51:02.000000000 +0000 @@ -35,8 +35,6 @@ #define SPICE_IS_USB_ACL_HELPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SPICE_TYPE_USB_ACL_HELPER)) #define SPICE_USB_ACL_HELPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SPICE_TYPE_USB_ACL_HELPER, SpiceUsbAclHelperClass)) -#define SPICE_TYPE_USB_DEVICE (spice_usb_device_get_type()) - typedef struct _SpiceUsbAclHelper SpiceUsbAclHelper; typedef struct _SpiceUsbAclHelperClass SpiceUsbAclHelperClass; typedef struct _SpiceUsbAclHelperPrivate SpiceUsbAclHelperPrivate; @@ -55,7 +53,6 @@ GObjectClass parent_class; }; -GType spice_usb_device_get_type(void); GType spice_usb_acl_helper_get_type(void); SpiceUsbAclHelper *spice_usb_acl_helper_new(void); diff -Nru spice-gtk-0.9/gtk/usb-device-manager.c spice-gtk-0.12/gtk/usb-device-manager.c --- spice-gtk-0.9/gtk/usb-device-manager.c 2012-01-30 10:26:20.000000000 +0000 +++ spice-gtk-0.12/gtk/usb-device-manager.c 2012-04-11 13:51:02.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* - Copyright (C) 2011 Red Hat, Inc. + Copyright (C) 2011, 2012 Red Hat, Inc. Red Hat Authors: Hans de Goede @@ -22,22 +22,16 @@ #include "config.h" #include -#include #include "glib-compat.h" #ifdef USE_USBREDIR -#ifdef __linux__ -#include -#include -#include -#include -#endif #include #include #include #include "channel-usbredir-priv.h" #include "usbredirhost.h" +#include "usbutil.h" #endif #include "spice-session-priv.h" @@ -45,6 +39,8 @@ #include "spice-marshal.h" #include "usb-device-manager-priv.h" +#include + /** * SECTION:usb-device-manager * @short_description: USB device management @@ -66,13 +62,6 @@ */ /* ------------------------------------------------------------------ */ -/* Prototypes for private functions */ -static void channel_new(SpiceSession *session, SpiceChannel *channel, - gpointer user_data); -static void channel_destroy(SpiceSession *session, SpiceChannel *channel, - gpointer user_data); - -/* ------------------------------------------------------------------ */ /* gobject glue */ #define SPICE_USB_DEVICE_MANAGER_GET_PRIVATE(obj) \ @@ -90,6 +79,7 @@ DEVICE_ADDED, DEVICE_REMOVED, AUTO_CONNECT_FAILED, + DEVICE_ERROR, LAST_SIGNAL, }; @@ -112,6 +102,10 @@ }; #ifdef USE_USBREDIR +static void channel_new(SpiceSession *session, SpiceChannel *channel, + gpointer user_data); +static void channel_destroy(SpiceSession *session, SpiceChannel *channel, + gpointer user_data); static void spice_usb_device_manager_uevent_cb(GUdevClient *client, const gchar *action, GUdevDevice *udevice, @@ -151,11 +145,11 @@ GCancellable *cancellable, GError **err) { - GList *list; - GList *it; SpiceUsbDeviceManager *self; SpiceUsbDeviceManagerPrivate *priv; #ifdef USE_USBREDIR + GList *list; + GList *it; int rc; const gchar *const subsystems[] = {"usb", NULL}; #endif @@ -178,6 +172,18 @@ return FALSE; } +#ifdef USE_USBREDIR + /* Initialize libusb */ + rc = libusb_init(&priv->context); + if (rc < 0) { + const char *desc = spice_usbutil_libusb_strerror(rc); + g_warning("Error initializing USB support: %s [%i]", desc, rc); + g_set_error(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, + "Error initializing USB support: %s [%i]", desc, rc); + return FALSE; + } + + /* Start listening for usb channels connect/disconnect */ g_signal_connect(priv->session, "channel-new", G_CALLBACK(channel_new), self); g_signal_connect(priv->session, "channel-destroy", @@ -188,16 +194,7 @@ } g_list_free(list); -#ifdef USE_USBREDIR - rc = libusb_init(&priv->context); - if (rc < 0) { - const char *desc = spice_usb_device_manager_libusb_strerror(rc); - g_warning("Error initializing USB support: %s [%i]", desc, rc); - g_set_error(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, - "Error initializing USB support: %s [%i]", desc, rc); - return FALSE; - } - + /* Start listening for usb devices plug / unplug */ priv->udev = g_udev_client_new(subsystems); g_signal_connect(G_OBJECT(priv->udev), "uevent", G_CALLBACK(spice_usb_device_manager_uevent_cb), self); @@ -216,7 +213,7 @@ return TRUE; #else g_set_error_literal(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, - "USB redirection support not compiled in"); + _("USB redirection support not compiled in")); return FALSE; #endif } @@ -438,13 +435,36 @@ SPICE_TYPE_USB_DEVICE, G_TYPE_ERROR); + /** + * SpiceUsbDeviceManager::device-error: + * @manager: #SpiceUsbDeviceManager that emitted the signal + * @device: #SpiceUsbDevice boxed object corresponding to the device which has an error + * @error: #GError describing the error + * + * The #SpiceUsbDeviceManager::device-error signal is emitted whenever an + * error happens which causes a device to no longer be available to the + * guest. + **/ + signals[DEVICE_ERROR] = + g_signal_new("device-error", + G_OBJECT_CLASS_TYPE(gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(SpiceUsbDeviceManagerClass, device_error), + NULL, NULL, + g_cclosure_user_marshal_VOID__BOXED_BOXED, + G_TYPE_NONE, + 2, + SPICE_TYPE_USB_DEVICE, + G_TYPE_ERROR); + g_type_class_add_private(klass, sizeof(SpiceUsbDeviceManagerPrivate)); } +#ifdef USE_USBREDIR + /* ------------------------------------------------------------------ */ /* gudev / libusb Helper functions */ -#ifdef USE_USBREDIR static gboolean spice_usb_device_manager_get_udev_bus_n_address( GUdevDevice *udev, int *bus, int *address) { @@ -462,69 +482,6 @@ return *bus && *address; } -const char *spice_usb_device_manager_libusb_strerror(enum libusb_error error_code) -{ - switch (error_code) { - case LIBUSB_SUCCESS: - return "Success"; - case LIBUSB_ERROR_IO: - return "Input/output error"; - case LIBUSB_ERROR_INVALID_PARAM: - return "Invalid parameter"; - case LIBUSB_ERROR_ACCESS: - return "Access denied (insufficient permissions)"; - case LIBUSB_ERROR_NO_DEVICE: - return "No such device (it may have been disconnected)"; - case LIBUSB_ERROR_NOT_FOUND: - return "Entity not found"; - case LIBUSB_ERROR_BUSY: - return "Resource busy"; - case LIBUSB_ERROR_TIMEOUT: - return "Operation timed out"; - case LIBUSB_ERROR_OVERFLOW: - return "Overflow"; - case LIBUSB_ERROR_PIPE: - return "Pipe error"; - case LIBUSB_ERROR_INTERRUPTED: - return "System call interrupted (perhaps due to signal)"; - case LIBUSB_ERROR_NO_MEM: - return "Insufficient memory"; - case LIBUSB_ERROR_NOT_SUPPORTED: - return "Operation not supported or unimplemented on this platform"; - case LIBUSB_ERROR_OTHER: - return "Other error"; - } - return "Unknown error"; -} - -#ifdef __linux__ -/* libusb does not allow getting the manufacturer and product strings - without opening the device, so grab them directly from sysfs */ -static gchar *spice_usb_device_manager_get_sysfs_attribute( - int bus, int address, const char *attribute) -{ - struct stat stat_buf; - char filename[256]; - gchar *contents; - - snprintf(filename, sizeof(filename), "/dev/bus/usb/%03d/%03d", - bus, address); - if (stat(filename, &stat_buf) != 0) - return NULL; - - snprintf(filename, sizeof(filename), "/sys/dev/char/%d:%d/%s", - major(stat_buf.st_rdev), minor(stat_buf.st_rdev), attribute); - if (!g_file_get_contents(filename, &contents, NULL, NULL)) - return NULL; - - /* Remove the newline at the end */ - contents[strlen(contents) - 1] = '\0'; - - return contents; -} -#endif -#endif - /* ------------------------------------------------------------------ */ /* callbacks */ @@ -533,8 +490,12 @@ { SpiceUsbDeviceManager *self = user_data; - if (SPICE_IS_USBREDIR_CHANNEL(channel)) + if (SPICE_IS_USBREDIR_CHANNEL(channel)) { + spice_usbredir_channel_set_context(SPICE_USBREDIR_CHANNEL(channel), + self->priv->context); + spice_channel_connect(channel); g_ptr_array_add(self->priv->channels, channel); + } } static void channel_destroy(SpiceSession *session, SpiceChannel *channel, @@ -546,7 +507,6 @@ g_ptr_array_remove(self->priv->channels, channel); } -#ifdef USE_USBREDIR static void spice_usb_device_manager_auto_connect_cb(GObject *gobject, GAsyncResult *res, gpointer user_data) @@ -616,10 +576,17 @@ g_ptr_array_add(priv->devices, device); if (priv->auto_connect) { - if (usbredirhost_check_device_filter( - priv->auto_conn_filter_rules, - priv->auto_conn_filter_rules_count, - device, 0) == 0) + gboolean can_redirect, auto_ok; + + can_redirect = spice_usb_device_manager_can_redirect_device( + self, (SpiceUsbDevice *)device, NULL); + + auto_ok = usbredirhost_check_device_filter( + priv->auto_conn_filter_rules, + priv->auto_conn_filter_rules_count, + device, 0) == 0; + + if (can_redirect && auto_ok) spice_usb_device_manager_connect_device_async(self, (SpiceUsbDevice *)device, NULL, spice_usb_device_manager_auto_connect_cb, @@ -679,7 +646,7 @@ GSimpleAsyncResult *result = G_SIMPLE_ASYNC_RESULT(user_data); GError *err = NULL; - spice_usbredir_channel_connect_finish(channel, channel_res, &err); + spice_usbredir_channel_connect_device_finish(channel, channel_res, &err); if (err) { g_simple_async_result_take_error(result, err); } @@ -699,7 +666,7 @@ while (priv->event_thread_run) { rc = libusb_handle_events(priv->context); if (rc) { - const char *desc = spice_usb_device_manager_libusb_strerror(rc); + const char *desc = spice_usbutil_libusb_strerror(rc); g_warning("Error handling USB events: %s [%i]", desc, rc); } } @@ -726,9 +693,14 @@ priv->event_thread = NULL; } priv->event_thread_run = TRUE; - priv->event_thread = g_thread_create( - spice_usb_device_manager_usb_ev_thread, - self, TRUE, err); +#if GLIB_CHECK_VERSION(2,31,19) + priv->event_thread = g_thread_new("usb_ev_thread", + spice_usb_device_manager_usb_ev_thread, + self); +#else + priv->event_thread = g_thread_create(spice_usb_device_manager_usb_ev_thread, + self, TRUE, err); +#endif return priv->event_thread != NULL; } @@ -743,6 +715,12 @@ if (priv->event_listeners == 0) priv->event_thread_run = FALSE; } + +void spice_usb_device_manager_device_error( + SpiceUsbDeviceManager *self, SpiceUsbDevice *device, GError *err) +{ + g_signal_emit(self, signals[DEVICE_ERROR], 0, device, err); +} #endif static SpiceUsbredirChannel *spice_usb_device_manager_get_channel_for_dev( @@ -882,8 +860,7 @@ if (spice_usbredir_channel_get_device(channel)) continue; /* Skip already used channels */ - spice_usbredir_channel_connect_async(channel, - priv->context, + spice_usbredir_channel_connect_device_async(channel, (libusb_device *)device, cancellable, spice_usb_device_manager_channel_connect_cb, @@ -894,7 +871,7 @@ g_simple_async_result_set_error(result, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, - "No free USB channel"); + _("No free USB channel")); #ifdef USE_USBREDIR done: #endif @@ -937,7 +914,75 @@ channel = spice_usb_device_manager_get_channel_for_dev(self, device); if (channel) - spice_usbredir_channel_disconnect(channel); + spice_usbredir_channel_disconnect_device(channel); +#endif +} + +gboolean +spice_usb_device_manager_can_redirect_device(SpiceUsbDeviceManager *self, + SpiceUsbDevice *device, + GError **err) +{ +#ifdef USE_USBREDIR + const struct usbredirfilter_rule *guest_filter_rules = NULL; + SpiceUsbDeviceManagerPrivate *priv = self->priv; + int i, guest_filter_rules_count; + gboolean enabled; + + g_return_val_if_fail(SPICE_IS_USB_DEVICE_MANAGER(self), FALSE); + g_return_val_if_fail(device != NULL, FALSE); + g_return_val_if_fail(err == NULL || *err == NULL, FALSE); + + g_object_get(G_OBJECT(priv->session), "enable-usbredir", &enabled, NULL); + if (!enabled) { + g_set_error_literal(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, + _("USB redirection is disabled")); + return FALSE; + } + + if (!priv->channels->len) { + g_set_error_literal(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, + _("The connected VM is not configured for USB redirection")); + return FALSE; + } + + /* Skip the other checks for already connected devices */ + if (spice_usb_device_manager_is_device_connected(self, device)) + return TRUE; + + /* We assume all channels have the same filter, so we just take the + filter from the first channel */ + spice_usbredir_channel_get_guest_filter( + g_ptr_array_index(priv->channels, 0), + &guest_filter_rules, &guest_filter_rules_count); + + if (guest_filter_rules && + usbredirhost_check_device_filter( + guest_filter_rules, guest_filter_rules_count, + (libusb_device *)device, 0) != 0) { + g_set_error_literal(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, + _("Some USB devices are blocked by host policy")); + return FALSE; + } + + /* Check if there are free channels */ + for (i = 0; i < priv->channels->len; i++) { + SpiceUsbredirChannel *channel = g_ptr_array_index(priv->channels, i); + + if (!spice_usbredir_channel_get_device(channel)) + break; + } + if (i == priv->channels->len) { + g_set_error_literal(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, + _("There are no free USB channels")); + return FALSE; + } + + return TRUE; +#else + g_set_error_literal(err, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, + _("USB redirection support not compiled in")); + return FALSE; #endif } @@ -974,34 +1019,16 @@ bus = libusb_get_bus_number(device); address = libusb_get_device_address(device); -#if __linux__ - manufacturer = spice_usb_device_manager_get_sysfs_attribute(bus, address, - "manufacturer"); - product = spice_usb_device_manager_get_sysfs_attribute(bus, address, - "product"); -#endif - if (!manufacturer) - manufacturer = g_strdup(_("USB")); - if (!product) - product = g_strdup(_("Device")); - - /* Some devices have unwanted whitespace in their strings */ - g_strstrip(manufacturer); - g_strstrip(product); - - /* Some devices repeat the manufacturer at the beginning of product */ - if (g_str_has_prefix(product, manufacturer) && - strlen(product) > strlen(manufacturer)) { - gchar *tmp = g_strdup(product + strlen(manufacturer)); - g_free(product); - product = tmp; - g_strstrip(product); - } - - if (libusb_get_device_descriptor(device, &desc) == LIBUSB_SUCCESS) + if (libusb_get_device_descriptor(device, &desc) == LIBUSB_SUCCESS) { + spice_usb_util_get_device_strings(bus, address, + desc.idVendor, desc.idProduct, + &manufacturer, &product); descriptor = g_strdup_printf("[%04x:%04x]", desc.idVendor, desc.idProduct); - else + } else { + spice_usb_util_get_device_strings(bus, address, -1, -1, + &manufacturer, &product); descriptor = g_strdup(""); + } if (!format) format = _("%s %s %s at %d-%d"); diff -Nru spice-gtk-0.9/gtk/usb-device-manager.h spice-gtk-0.12/gtk/usb-device-manager.h --- spice-gtk-0.9/gtk/usb-device-manager.h 2012-01-11 16:11:31.000000000 +0000 +++ spice-gtk-0.12/gtk/usb-device-manager.h 2012-04-11 13:51:02.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* - Copyright (C) 2011 Red Hat, Inc. + Copyright (C) 2011, 2012 Red Hat, Inc. Red Hat Authors: Hans de Goede @@ -43,7 +43,6 @@ /** * SpiceUsbDeviceManager: - * @parent: Parent instance. * * The #SpiceUsbDeviceManager struct is opaque and should not be accessed directly. */ @@ -76,12 +75,14 @@ SpiceUsbDevice *device); void (*auto_connect_failed) (SpiceUsbDeviceManager *manager, SpiceUsbDevice *device, GError *error); + void (*device_error) (SpiceUsbDeviceManager *manager, + SpiceUsbDevice *device, GError *error); /*< private >*/ /* * If adding fields to this struct, remove corresponding * amount of padding to avoid changing overall struct size */ - gchar _spice_reserved[SPICE_RESERVED_PADDING]; + gchar _spice_reserved[SPICE_RESERVED_PADDING - sizeof(void*)]; }; GType spice_usb_device_get_type(void); @@ -108,6 +109,11 @@ void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *manager, SpiceUsbDevice *device); +gboolean +spice_usb_device_manager_can_redirect_device(SpiceUsbDeviceManager *self, + SpiceUsbDevice *device, + GError **err); + G_END_DECLS #endif /* __SPICE_USB_DEVICE_MANAGER_H__ */ diff -Nru spice-gtk-0.9/gtk/usb-device-manager-priv.h spice-gtk-0.12/gtk/usb-device-manager-priv.h --- spice-gtk-0.9/gtk/usb-device-manager-priv.h 2012-01-11 16:11:31.000000000 +0000 +++ spice-gtk-0.12/gtk/usb-device-manager-priv.h 2012-04-11 13:51:02.000000000 +0000 @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* - Copyright (C) 2011 Red Hat, Inc. + Copyright (C) 2011,2012 Red Hat, Inc. Red Hat Authors: Hans de Goede @@ -25,16 +25,15 @@ G_BEGIN_DECLS -#ifdef USE_USBREDIR -const char *spice_usb_device_manager_libusb_strerror(enum libusb_error error_code); -#endif - gboolean spice_usb_device_manager_start_event_listening( SpiceUsbDeviceManager *manager, GError **err); void spice_usb_device_manager_stop_event_listening( SpiceUsbDeviceManager *manager); +void spice_usb_device_manager_device_error( + SpiceUsbDeviceManager *manager, SpiceUsbDevice *device, GError *err); + G_END_DECLS #endif /* __SPICE_USB_DEVICE_MANAGER_PRIV_H__ */ diff -Nru spice-gtk-0.9/gtk/usb-device-widget.c spice-gtk-0.12/gtk/usb-device-widget.c --- spice-gtk-0.9/gtk/usb-device-widget.c 2012-01-31 13:31:38.000000000 +0000 +++ spice-gtk-0.12/gtk/usb-device-widget.c 2012-04-11 13:51:02.000000000 +0000 @@ -45,6 +45,8 @@ SpiceUsbDevice *device, gpointer user_data); static void device_removed_cb(SpiceUsbDeviceManager *manager, SpiceUsbDevice *device, gpointer user_data); +static void device_error_cb(SpiceUsbDeviceManager *manager, + SpiceUsbDevice *device, GError *err, gpointer user_data); /* ------------------------------------------------------------------ */ /* gobject glue */ @@ -68,11 +70,18 @@ SpiceSession *session; gchar *device_format_string; SpiceUsbDeviceManager *manager; + GtkWidget *info_bar; + gchar *err_msg; }; static guint signals[LAST_SIGNAL] = { 0, }; +#if GTK_CHECK_VERSION(3,0,0) +G_DEFINE_TYPE(SpiceUsbDeviceWidget, spice_usb_device_widget, GTK_TYPE_BOX); +#else G_DEFINE_TYPE(SpiceUsbDeviceWidget, spice_usb_device_widget, GTK_TYPE_VBOX); +#endif + static void spice_usb_device_widget_get_property(GObject *gobject, guint prop_id, @@ -116,17 +125,62 @@ } } +static void spice_usb_device_widget_hide_info_bar(SpiceUsbDeviceWidget *self) +{ + SpiceUsbDeviceWidgetPrivate *priv = self->priv; + + if (priv->info_bar) { + gtk_widget_destroy(priv->info_bar); + priv->info_bar = NULL; + } +} + +static void +spice_usb_device_widget_show_info_bar(SpiceUsbDeviceWidget *self, + const gchar *message, + GtkMessageType message_type, + const gchar *stock_icon_id) +{ + SpiceUsbDeviceWidgetPrivate *priv = self->priv; + GtkWidget *info_bar, *content_area, *hbox, *widget; + + spice_usb_device_widget_hide_info_bar(self); + + info_bar = gtk_info_bar_new(); + gtk_info_bar_set_message_type(GTK_INFO_BAR(info_bar), message_type); + + content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(info_bar)); +#if GTK_CHECK_VERSION(3,0,0) + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12); +#else + hbox = gtk_hbox_new(FALSE, 12); +#endif + gtk_container_add(GTK_CONTAINER(content_area), hbox); + + widget = gtk_image_new_from_stock(stock_icon_id, + GTK_ICON_SIZE_SMALL_TOOLBAR); + gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0); + + widget = gtk_label_new(message); + gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0); + + priv->info_bar = gtk_alignment_new(0.0, 0.0, 1.0, 0.0); + gtk_alignment_set_padding(GTK_ALIGNMENT(priv->info_bar), 0, 0, 12, 0); + gtk_container_add(GTK_CONTAINER(priv->info_bar), info_bar); + gtk_box_pack_start(GTK_BOX(self), priv->info_bar, FALSE, FALSE, 0); + gtk_widget_show_all(priv->info_bar); +} + static GObject *spice_usb_device_widget_constructor( GType gtype, guint n_properties, GObjectConstructParam *properties) { GObject *obj; SpiceUsbDeviceWidget *self; SpiceUsbDeviceWidgetPrivate *priv; - const gchar *err_msg = NULL; GPtrArray *devices = NULL; GError *err = NULL; GtkWidget *label; - gboolean enabled; + gchar *str; int i; { @@ -141,41 +195,39 @@ if (!priv->session) g_error("SpiceUsbDeviceWidget constructed without a session"); - g_object_get(G_OBJECT(priv->session), "enable-usbredir", &enabled, NULL); - if (!enabled) - err_msg = _("USB redirection is disabled"); - - if (!err_msg && !spice_session_has_channel_type(priv->session, - SPICE_CHANNEL_USBREDIR)) - err_msg = _("The connected VM is not configured for USB redirection"); - - if (!err_msg) { - priv->manager = spice_usb_device_manager_get(priv->session, &err); - if (!err) { - g_signal_connect(priv->manager, "device-added", - G_CALLBACK(device_added_cb), self); - g_signal_connect(priv->manager, "device-removed", - G_CALLBACK(device_removed_cb), self); - devices = spice_usb_device_manager_get_devices(priv->manager); - } else - err_msg = err->message; - } - - if (err_msg) { - label = gtk_label_new(err_msg); - gtk_box_pack_start(GTK_BOX(self), label, TRUE, TRUE, 5); + label = gtk_label_new(NULL); + str = g_strdup_printf("%s", _("Select USB devices to redirect")); + gtk_label_set_markup(GTK_LABEL (label), str); + g_free(str); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + gtk_box_pack_start(GTK_BOX(self), label, FALSE, FALSE, 0); + + priv->manager = spice_usb_device_manager_get(priv->session, &err); + if (err) { + spice_usb_device_widget_show_info_bar(self, err->message, + GTK_MESSAGE_WARNING, + GTK_STOCK_DIALOG_WARNING); g_clear_error(&err); return obj; } - label = gtk_label_new(_("Select USB devices to redirect")); - gtk_box_pack_start(GTK_BOX(self), label, TRUE, TRUE, 5); + g_signal_connect(priv->manager, "device-added", + G_CALLBACK(device_added_cb), self); + g_signal_connect(priv->manager, "device-removed", + G_CALLBACK(device_removed_cb), self); + g_signal_connect(priv->manager, "device-error", + G_CALLBACK(device_error_cb), self); + + devices = spice_usb_device_manager_get_devices(priv->manager); + if (!devices) + goto end; for (i = 0; i < devices->len; i++) device_added_cb(NULL, g_ptr_array_index(devices, i), self); g_ptr_array_unref(devices); +end: return obj; } @@ -189,6 +241,8 @@ device_added_cb, self); g_signal_handlers_disconnect_by_func(priv->manager, device_removed_cb, self); + g_signal_handlers_disconnect_by_func(priv->manager, + device_error_cb, self); } g_object_unref(priv->session); g_free(priv->device_format_string); @@ -278,13 +332,79 @@ const gchar *device_format_string) { return g_object_new(SPICE_TYPE_USB_DEVICE_WIDGET, + "orientation", GTK_ORIENTATION_VERTICAL, "session", session, "device-format-string", device_format_string, + "spacing", 6, NULL); } /* ------------------------------------------------------------------ */ /* callbacks */ + +static SpiceUsbDevice *get_usb_device(GtkWidget *widget) +{ + if (!GTK_IS_ALIGNMENT(widget)) + return NULL; + + widget = gtk_bin_get_child(GTK_BIN(widget)); + return g_object_get_data(G_OBJECT(widget), "usb-device"); +} + +static void check_can_redirect(GtkWidget *widget, gpointer user_data) +{ + SpiceUsbDeviceWidget *self = SPICE_USB_DEVICE_WIDGET(user_data); + SpiceUsbDeviceWidgetPrivate *priv = self->priv; + SpiceUsbDevice *device; + gboolean can_redirect; + GError *err = NULL; + + device = get_usb_device(widget); + if (!device) + return; /* Non device widget, ie the info_bar */ + + can_redirect = spice_usb_device_manager_can_redirect_device(priv->manager, + device, &err); + gtk_widget_set_sensitive(widget, can_redirect); + + /* If we can not redirect this device, append the error message to + err_msg, but only if it is *not* already there! */ + if (!can_redirect) { + if (priv->err_msg) { + if (!strstr(priv->err_msg, err->message)) { + gchar *old_err_msg = priv->err_msg; + + priv->err_msg = g_strdup_printf("%s\n%s", priv->err_msg, + err->message); + g_free(old_err_msg); + } + } else { + priv->err_msg = g_strdup(err->message); + } + } + + g_clear_error(&err); +} + +static gboolean spice_usb_device_widget_update_status(gpointer user_data) +{ + SpiceUsbDeviceWidget *self = SPICE_USB_DEVICE_WIDGET(user_data); + SpiceUsbDeviceWidgetPrivate *priv = self->priv; + + gtk_container_foreach(GTK_CONTAINER(self), check_can_redirect, self); + + if (priv->err_msg) { + spice_usb_device_widget_show_info_bar(self, priv->err_msg, + GTK_MESSAGE_INFO, + GTK_STOCK_DIALOG_WARNING); + g_free(priv->err_msg); + priv->err_msg = NULL; + } else { + spice_usb_device_widget_hide_info_bar(self); + } + return FALSE; +} + typedef struct _connect_cb_data { GtkWidget *check; SpiceUsbDeviceWidget *self; @@ -313,6 +433,7 @@ g_error_free(err); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->check), FALSE); + spice_usb_device_widget_update_status(self); } g_object_unref(data->check); @@ -341,6 +462,7 @@ spice_usb_device_manager_disconnect_device(priv->manager, device); } + spice_usb_device_widget_update_status(self); } static void checkbox_usb_device_destroy_notify(gpointer data) @@ -353,13 +475,13 @@ { SpiceUsbDeviceWidget *self = SPICE_USB_DEVICE_WIDGET(user_data); SpiceUsbDeviceWidgetPrivate *priv = self->priv; - GtkWidget *check; + GtkWidget *align, *check; gchar *desc; desc = spice_usb_device_get_description(device, priv->device_format_string); - check = gtk_check_button_new_with_label(desc); + g_free(desc); if (spice_usb_device_manager_is_device_connected(priv->manager, device)) @@ -372,15 +494,17 @@ g_signal_connect(G_OBJECT(check), "clicked", G_CALLBACK(checkbox_clicked_cb), self); - gtk_box_pack_start(GTK_BOX(self), check, TRUE, TRUE, 5); - gtk_widget_show(check); - - g_free(desc); + align = gtk_alignment_new(0, 0, 0, 0); + gtk_alignment_set_padding(GTK_ALIGNMENT(align), 0, 0, 12, 0); + gtk_container_add(GTK_CONTAINER(align), check); + gtk_box_pack_end(GTK_BOX(self), align, FALSE, FALSE, 0); + spice_usb_device_widget_update_status(self); + gtk_widget_show_all(align); } static void destroy_widget_by_usb_device(GtkWidget *widget, gpointer user_data) { - if (g_object_get_data(G_OBJECT(widget), "usb-device") == user_data) + if (get_usb_device(widget) == user_data) gtk_widget_destroy(widget); } @@ -391,4 +515,25 @@ gtk_container_foreach(GTK_CONTAINER(self), destroy_widget_by_usb_device, device); + + spice_usb_device_widget_update_status(self); +} + +static void set_inactive_by_usb_device(GtkWidget *widget, gpointer user_data) +{ + if (get_usb_device(widget) == user_data) { + GtkWidget *check = gtk_bin_get_child(GTK_BIN(widget)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), FALSE); + } +} + +static void device_error_cb(SpiceUsbDeviceManager *manager, + SpiceUsbDevice *device, GError *err, gpointer user_data) +{ + SpiceUsbDeviceWidget *self = SPICE_USB_DEVICE_WIDGET(user_data); + + gtk_container_foreach(GTK_CONTAINER(self), + set_inactive_by_usb_device, device); + + spice_usb_device_widget_update_status(self); } diff -Nru spice-gtk-0.9/gtk/usb-device-widget.h spice-gtk-0.12/gtk/usb-device-widget.h --- spice-gtk-0.9/gtk/usb-device-widget.h 2012-01-31 13:27:18.000000000 +0000 +++ spice-gtk-0.12/gtk/usb-device-widget.h 2012-04-11 13:51:02.000000000 +0000 @@ -37,15 +37,22 @@ typedef struct _SpiceUsbDeviceWidgetClass SpiceUsbDeviceWidgetClass; typedef struct _SpiceUsbDeviceWidgetPrivate SpiceUsbDeviceWidgetPrivate; +#if GTK_CHECK_VERSION(3,0,0) +typedef struct _GtkBox _SpiceGtkBox; +typedef struct _GtkBoxClass _SpiceGtkBoxClass; +#else +typedef struct _GtkVBox _SpiceGtkBox; +typedef struct _GtkVBoxClass _SpiceGtkBoxClass; +#endif + /** * SpiceUsbDeviceWidget: - * @parent: Parent instance. * * The #SpiceUsbDeviceWidget struct is opaque and should not be accessed directly. */ struct _SpiceUsbDeviceWidget { - GtkVBox parent; + _SpiceGtkBox parent; /*< private >*/ SpiceUsbDeviceWidgetPrivate *priv; @@ -54,14 +61,13 @@ /** * SpiceUsbDeviceWidgetClass: - * @parent_class: Parent class. * @connect_failed: Signal class handler for the #SpiceUsbDeviceWidget::connect-failed signal. * * Class structure for #SpiceUsbDeviceWidget. */ struct _SpiceUsbDeviceWidgetClass { - GtkVBoxClass parent_class; + _SpiceGtkBoxClass parent_class; /* signals */ void (*connect_failed) (SpiceUsbDeviceWidget *widget, diff -Nru spice-gtk-0.9/gtk/usbutil.c spice-gtk-0.12/gtk/usbutil.c --- spice-gtk-0.9/gtk/usbutil.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/gtk/usbutil.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,285 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2012 Red Hat, Inc. + + Red Hat Authors: + Hans de Goede + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#include "config.h" + +#include +#include +#include +#include + +#include "glib-compat.h" + +#ifdef USE_USBREDIR +#ifdef __linux__ +#include +#include +#include +#include +#endif +#include "usbutil.h" + +#ifdef WITH_USBIDS +#define VENDOR_NAME_LEN (122 - sizeof(void *)) +#define PRODUCT_NAME_LEN 126 + +typedef struct _usb_product_info { + guint16 product_id; + char name[PRODUCT_NAME_LEN]; +} usb_product_info; + +typedef struct _usb_vendor_info { + usb_product_info *product_info; + int product_count; + guint16 vendor_id; + char name[VENDOR_NAME_LEN]; +} usb_vendor_info; + +GStaticMutex usbids_parse_mutex = G_STATIC_MUTEX_INIT; +int usbids_vendor_count; +usb_vendor_info *usbids_vendor_info; +#endif + +G_GNUC_INTERNAL +const char *spice_usbutil_libusb_strerror(enum libusb_error error_code) +{ + switch (error_code) { + case LIBUSB_SUCCESS: + return "Success"; + case LIBUSB_ERROR_IO: + return "Input/output error"; + case LIBUSB_ERROR_INVALID_PARAM: + return "Invalid parameter"; + case LIBUSB_ERROR_ACCESS: + return "Access denied (insufficient permissions)"; + case LIBUSB_ERROR_NO_DEVICE: + return "No such device (it may have been disconnected)"; + case LIBUSB_ERROR_NOT_FOUND: + return "Entity not found"; + case LIBUSB_ERROR_BUSY: + return "Resource busy"; + case LIBUSB_ERROR_TIMEOUT: + return "Operation timed out"; + case LIBUSB_ERROR_OVERFLOW: + return "Overflow"; + case LIBUSB_ERROR_PIPE: + return "Pipe error"; + case LIBUSB_ERROR_INTERRUPTED: + return "System call interrupted (perhaps due to signal)"; + case LIBUSB_ERROR_NO_MEM: + return "Insufficient memory"; + case LIBUSB_ERROR_NOT_SUPPORTED: + return "Operation not supported or unimplemented on this platform"; + case LIBUSB_ERROR_OTHER: + return "Other error"; + } + return "Unknown error"; +} + +#ifdef __linux__ +/* libusb does not allow getting the manufacturer and product strings + without opening the device, so grab them directly from sysfs */ +static gchar *spice_usbutil_get_sysfs_attribute(int bus, int address, + const char *attribute) +{ + struct stat stat_buf; + char filename[256]; + gchar *contents; + + snprintf(filename, sizeof(filename), "/dev/bus/usb/%03d/%03d", + bus, address); + if (stat(filename, &stat_buf) != 0) + return NULL; + + snprintf(filename, sizeof(filename), "/sys/dev/char/%d:%d/%s", + major(stat_buf.st_rdev), minor(stat_buf.st_rdev), attribute); + if (!g_file_get_contents(filename, &contents, NULL, NULL)) + return NULL; + + /* Remove the newline at the end */ + contents[strlen(contents) - 1] = '\0'; + + return contents; +} +#endif + +#ifdef WITH_USBIDS +static void spice_usbutil_parse_usbids(void) +{ + gchar *contents, *line, **lines; + usb_product_info *product_info; + int i, j, id, product_count = 0; + + g_static_mutex_lock(&usbids_parse_mutex); + if (usbids_vendor_count) + goto leave; + + if (!g_file_get_contents(USB_IDS, &contents, NULL, NULL)) { + usbids_vendor_count = -1; + goto leave; + } + lines = g_strsplit(contents, "\n", -1); + + for (i = 0; lines[i]; i++) { + if (!isxdigit(lines[i][0]) || !isxdigit(lines[i][1])) + continue; + + for (j = 1; lines[i + j] && + (lines[i + j][0] == '\t' || + lines[i + j][0] == '#' || + lines[i + j][0] == '\0'); j++) { + if (lines[i + j][0] == '\t' && isxdigit(lines[i + j][1])) + product_count++; + } + i += j - 1; + + usbids_vendor_count++; + } + + usbids_vendor_info = g_new(usb_vendor_info, usbids_vendor_count); + product_info = g_new(usb_product_info, product_count); + + usbids_vendor_count = 0; + for (i = 0; lines[i]; i++) { + line = lines[i]; + + if (!isxdigit(line[0]) || !isxdigit(line[1])) + continue; + + id = strtoul(line, &line, 16); + while(isspace(line[0])) + line++; + usbids_vendor_info[usbids_vendor_count].vendor_id = id; + snprintf(usbids_vendor_info[usbids_vendor_count].name, + VENDOR_NAME_LEN, "%s", line); + + product_count = 0; + for (j = 1; lines[i + j] && + (lines[i + j][0] == '\t' || + lines[i + j][0] == '#' || + lines[i + j][0] == '\0'); j++) { + line = lines[i + j]; + + if (line[0] != '\t' || !isxdigit(line[1])) + continue; + + id = strtoul(line + 1, &line, 16); + while(isspace(line[0])) + line++; + product_info[product_count].product_id = id; + snprintf(product_info[product_count].name, + PRODUCT_NAME_LEN, "%s", line); + + product_count++; + } + i += j - 1; + + usbids_vendor_info[usbids_vendor_count].product_count = product_count; + usbids_vendor_info[usbids_vendor_count].product_info = product_info; + product_info += product_count; + usbids_vendor_count++; + } + + g_strfreev(lines); + g_free(contents); + +#if 0 /* Testing only */ + for (i = 0; i < usbids_vendor_count; i++) { + printf("%04x %s\n", usbids_vendor_info[i].vendor_id, + usbids_vendor_info[i].name); + product_info = usbids_vendor_info[i].product_info; + for (j = 0; j < usbids_vendor_info[i].product_count; j++) { + printf("\t%04x %s\n", product_info[j].product_id, + product_info[j].name); + } + } +#endif +leave: + g_static_mutex_unlock(&usbids_parse_mutex); +} +#endif + +G_GNUC_INTERNAL +void spice_usb_util_get_device_strings(int bus, int address, + int vendor_id, int product_id, + gchar **manufacturer, gchar **product) +{ +#ifdef WITH_USBIDS + usb_product_info *product_info; + int i, j; +#endif + + g_return_if_fail(manufacturer != NULL); + g_return_if_fail(product != NULL); + + *manufacturer = NULL; + *product = NULL; + +#if __linux__ + *manufacturer = spice_usbutil_get_sysfs_attribute(bus, address, "manufacturer"); + *product = spice_usbutil_get_sysfs_attribute(bus, address, "product"); +#endif + +#ifdef WITH_USBIDS + if (!*manufacturer || !*product) { + spice_usbutil_parse_usbids(); + + for (i = 0; i < usbids_vendor_count; i++) { + if ((int)usbids_vendor_info[i].vendor_id != vendor_id) + continue; + + if (!*manufacturer && usbids_vendor_info[i].name[0]) + *manufacturer = g_strdup(usbids_vendor_info[i].name); + + product_info = usbids_vendor_info[i].product_info; + for (j = 0; j < usbids_vendor_info[i].product_count; j++) { + if ((int)product_info[j].product_id != product_id) + continue; + + if (!*product && product_info[j].name[0]) + *product = g_strdup(product_info[j].name); + + break; + } + break; + } + } +#endif + if (!*manufacturer) + *manufacturer = g_strdup(_("USB")); + if (!*product) + *product = g_strdup(_("Device")); + + /* Some devices have unwanted whitespace in their strings */ + g_strstrip(*manufacturer); + g_strstrip(*product); + + /* Some devices repeat the manufacturer at the beginning of product */ + if (g_str_has_prefix(*product, *manufacturer) && + strlen(*product) > strlen(*manufacturer)) { + gchar *tmp = g_strdup(*product + strlen(*manufacturer)); + g_free(*product); + *product = tmp; + g_strstrip(*product); + } +} + +#endif diff -Nru spice-gtk-0.9/gtk/usbutil.h spice-gtk-0.12/gtk/usbutil.h --- spice-gtk-0.9/gtk/usbutil.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/gtk/usbutil.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,39 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2012 Red Hat, Inc. + + Red Hat Authors: + Hans de Goede + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifndef __SPICE_USBUTIL_H__ +#define __SPICE_USBUTIL_H__ + +#include + +#ifdef USE_USBREDIR +#include + +G_BEGIN_DECLS + +const char *spice_usbutil_libusb_strerror(enum libusb_error error_code); +void spice_usb_util_get_device_strings(int bus, int address, + int vendor_id, int product_id, + gchar **manufacturer, gchar **product); + +G_END_DECLS + +#endif /* USE_USBREDIR */ +#endif /* __SPICE_USBUTIL_H__ */ diff -Nru spice-gtk-0.9/m4/intltool.m4 spice-gtk-0.12/m4/intltool.m4 --- spice-gtk-0.9/m4/intltool.m4 2011-02-09 13:07:32.000000000 +0000 +++ spice-gtk-0.12/m4/intltool.m4 1970-01-01 00:00:00.000000000 +0000 @@ -1,216 +0,0 @@ -## intltool.m4 - Configure intltool for the target system. -*-Shell-script-*- -## Copyright (C) 2001 Eazel, Inc. -## Author: Maciej Stachowiak -## Kenneth Christiansen -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -## -## As a special exception to the GNU General Public License, if you -## distribute this file as part of a program that contains a -## configuration script generated by Autoconf, you may include it under -## the same distribution terms that you use for the rest of that program. - -dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml]) -# serial 40 IT_PROG_INTLTOOL -AC_DEFUN([IT_PROG_INTLTOOL], [ -AC_PREREQ([2.50])dnl -AC_REQUIRE([AM_NLS])dnl - -case "$am__api_version" in - 1.[01234]) - AC_MSG_ERROR([Automake 1.5 or newer is required to use intltool]) - ;; - *) - ;; -esac - -if test -n "$1"; then - AC_MSG_CHECKING([for intltool >= $1]) - - INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` - INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3` - [INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` - ] - AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found]) - test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || - AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.]) -fi - -AC_PATH_PROG(INTLTOOL_UPDATE, [intltool-update]) -AC_PATH_PROG(INTLTOOL_MERGE, [intltool-merge]) -AC_PATH_PROG(INTLTOOL_EXTRACT, [intltool-extract]) -if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then - AC_MSG_ERROR([The intltool scripts were not found. Please install intltool.]) -fi - - INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' -INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -p $(top_srcdir)/po $< [$]@' - INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' -INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< [$]@' - INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' - -_IT_SUBST(INTLTOOL_DESKTOP_RULE) -_IT_SUBST(INTLTOOL_DIRECTORY_RULE) -_IT_SUBST(INTLTOOL_KEYS_RULE) -_IT_SUBST(INTLTOOL_PROP_RULE) -_IT_SUBST(INTLTOOL_OAF_RULE) -_IT_SUBST(INTLTOOL_PONG_RULE) -_IT_SUBST(INTLTOOL_SERVER_RULE) -_IT_SUBST(INTLTOOL_SHEET_RULE) -_IT_SUBST(INTLTOOL_SOUNDLIST_RULE) -_IT_SUBST(INTLTOOL_UI_RULE) -_IT_SUBST(INTLTOOL_XAM_RULE) -_IT_SUBST(INTLTOOL_KBD_RULE) -_IT_SUBST(INTLTOOL_XML_RULE) -_IT_SUBST(INTLTOOL_XML_NOMERGE_RULE) -_IT_SUBST(INTLTOOL_CAVES_RULE) -_IT_SUBST(INTLTOOL_SCHEMAS_RULE) -_IT_SUBST(INTLTOOL_THEME_RULE) -_IT_SUBST(INTLTOOL_SERVICE_RULE) -_IT_SUBST(INTLTOOL_POLICY_RULE) - -# Check the gettext tools to make sure they are GNU -AC_PATH_PROG(XGETTEXT, xgettext) -AC_PATH_PROG(MSGMERGE, msgmerge) -AC_PATH_PROG(MSGFMT, msgfmt) -AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) -if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then - AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) -fi -xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`" -mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`" -mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`" -if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then - AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) -fi - -AC_PATH_PROG(INTLTOOL_PERL, perl) -if test -z "$INTLTOOL_PERL"; then - AC_MSG_ERROR([perl not found]) -fi -AC_MSG_CHECKING([for perl >= 5.8.1]) -$INTLTOOL_PERL -e "use 5.8.1;" > /dev/null 2>&1 -if test $? -ne 0; then - AC_MSG_ERROR([perl 5.8.1 is required for intltool]) -else - IT_PERL_VERSION="`$INTLTOOL_PERL -e \"printf '%vd', $^V\"`" - AC_MSG_RESULT([$IT_PERL_VERSION]) -fi -if test "x$2" != "xno-xml"; then - AC_MSG_CHECKING([for XML::Parser]) - if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then - AC_MSG_RESULT([ok]) - else - AC_MSG_ERROR([XML::Parser perl module is required for intltool]) - fi -fi - -# Substitute ALL_LINGUAS so we can use it in po/Makefile -AC_SUBST(ALL_LINGUAS) - -# Set DATADIRNAME correctly if it is not set yet -# (copied from glib-gettext.m4) -if test -z "$DATADIRNAME"; then - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[]], - [[extern int _nl_msg_cat_cntr; - return _nl_msg_cat_cntr]])], - [DATADIRNAME=share], - [case $host in - *-*-solaris*) - dnl On Solaris, if bind_textdomain_codeset is in libc, - dnl GNU format message catalog is always supported, - dnl since both are added to the libc all together. - dnl Hence, we'd like to go with DATADIRNAME=share - dnl in this case. - AC_CHECK_FUNC(bind_textdomain_codeset, - [DATADIRNAME=share], [DATADIRNAME=lib]) - ;; - *) - [DATADIRNAME=lib] - ;; - esac]) -fi -AC_SUBST(DATADIRNAME) - -IT_PO_SUBDIR([po]) - -]) - - -# IT_PO_SUBDIR(DIRNAME) -# --------------------- -# All po subdirs have to be declared with this macro; the subdir "po" is -# declared by IT_PROG_INTLTOOL. -# -AC_DEFUN([IT_PO_SUBDIR], -[AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS. -dnl -dnl The following CONFIG_COMMANDS should be executed at the very end -dnl of config.status. -AC_CONFIG_COMMANDS_PRE([ - AC_CONFIG_COMMANDS([$1/stamp-it], [ - if [ ! grep "^# INTLTOOL_MAKEFILE$" "$1/Makefile.in" > /dev/null ]; then - AC_MSG_ERROR([$1/Makefile.in.in was not created by intltoolize.]) - fi - rm -f "$1/stamp-it" "$1/stamp-it.tmp" "$1/POTFILES" "$1/Makefile.tmp" - >"$1/stamp-it.tmp" - [sed '/^#/d - s/^[[].*] *// - /^[ ]*$/d - '"s|^| $ac_top_srcdir/|" \ - "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES" - ] - [sed '/^POTFILES =/,/[^\\]$/ { - /^POTFILES =/!d - r $1/POTFILES - } - ' "$1/Makefile.in" >"$1/Makefile"] - rm -f "$1/Makefile.tmp" - mv "$1/stamp-it.tmp" "$1/stamp-it" - ]) -])dnl -]) - -# _IT_SUBST(VARIABLE) -# ------------------- -# Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST -# -AC_DEFUN([_IT_SUBST], -[ -AC_SUBST([$1]) -m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])]) -] -) - -# deprecated macros -AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL]) -# A hint is needed for aclocal from Automake <= 1.9.4: -# AC_DEFUN([AC_PROG_INTLTOOL], ...) - diff -Nru spice-gtk-0.9/m4/manywarnings.m4 spice-gtk-0.12/m4/manywarnings.m4 --- spice-gtk-0.9/m4/manywarnings.m4 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/m4/manywarnings.m4 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,184 @@ +# manywarnings.m4 serial 3 +dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Simon Josefsson + +# gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR) +# -------------------------------------------------- +# Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR. +# Elements separated by whitespace. In set logic terms, the function +# does OUTVAR = LISTVAR \ REMOVEVAR. +AC_DEFUN([gl_MANYWARN_COMPLEMENT], +[ + gl_warn_set= + set x $2; shift + for gl_warn_item + do + case " $3 " in + *" $gl_warn_item "*) + ;; + *) + gl_warn_set="$gl_warn_set $gl_warn_item" + ;; + esac + done + $1=$gl_warn_set +]) + +# gl_MANYWARN_ALL_GCC(VARIABLE) +# ----------------------------- +# Add all documented GCC warning parameters to variable VARIABLE. +# Note that you need to test them using gl_WARN_ADD if you want to +# make sure your gcc understands it. +AC_DEFUN([gl_MANYWARN_ALL_GCC], +[ + dnl First, check if -Wno-missing-field-initializers is needed. + dnl -Wmissing-field-initializers is implied by -W, but that issues + dnl warnings with GCC version before 4.7, for the common idiom + dnl of initializing types on the stack to zero, using { 0, } + AC_REQUIRE([AC_PROG_CC]) + if test -n "$GCC"; then + + dnl First, check -W -Werror -Wno-missing-field-initializers is supported + dnl with the current $CC $CFLAGS $CPPFLAGS. + AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported]) + AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [ + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], [[]])], + [gl_cv_cc_nomfi_supported=yes], + [gl_cv_cc_nomfi_supported=no]) + CFLAGS="$gl_save_CFLAGS"]) + AC_MSG_RESULT([$gl_cv_cc_nomfi_supported]) + + if test "$gl_cv_cc_nomfi_supported" = yes; then + dnl Now check whether -Wno-missing-field-initializers is needed + dnl for the { 0, } construct. + AC_MSG_CHECKING([whether -Wno-missing-field-initializers is needed]) + AC_CACHE_VAL([gl_cv_cc_nomfi_needed], [ + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -W -Werror" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[void f (void) + { + typedef struct { int a; int b; } s_t; + s_t s1 = { 0, }; + } + ]], + [[]])], + [gl_cv_cc_nomfi_needed=no], + [gl_cv_cc_nomfi_needed=yes]) + CFLAGS="$gl_save_CFLAGS" + ]) + AC_MSG_RESULT([$gl_cv_cc_nomfi_needed]) + fi + fi + + gl_manywarn_set= + for gl_manywarn_item in \ + -Wall \ + -W \ + -Wformat-y2k \ + -Wformat-nonliteral \ + -Wformat-security \ + -Winit-self \ + -Wmissing-include-dirs \ + -Wswitch-default \ + -Wswitch-enum \ + -Wunused \ + -Wunknown-pragmas \ + -Wstrict-aliasing \ + -Wstrict-overflow \ + -Wsystem-headers \ + -Wfloat-equal \ + -Wtraditional \ + -Wtraditional-conversion \ + -Wdeclaration-after-statement \ + -Wundef \ + -Wshadow \ + -Wunsafe-loop-optimizations \ + -Wpointer-arith \ + -Wbad-function-cast \ + -Wc++-compat \ + -Wcast-qual \ + -Wcast-align \ + -Wwrite-strings \ + -Wconversion \ + -Wsign-conversion \ + -Wlogical-op \ + -Waggregate-return \ + -Wstrict-prototypes \ + -Wold-style-definition \ + -Wmissing-prototypes \ + -Wmissing-declarations \ + -Wmissing-noreturn \ + -Wmissing-format-attribute \ + -Wpacked \ + -Wpadded \ + -Wredundant-decls \ + -Wnested-externs \ + -Wunreachable-code \ + -Winline \ + -Winvalid-pch \ + -Wlong-long \ + -Wvla \ + -Wvolatile-register-var \ + -Wdisabled-optimization \ + -Wstack-protector \ + -Woverlength-strings \ + -Wbuiltin-macro-redefined \ + -Wmudflap \ + -Wpacked-bitfield-compat \ + -Wsync-nand \ + ; do + gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" + done + # The following are not documented in the manual but are included in + # output from gcc --help=warnings. + for gl_manywarn_item in \ + -Wattributes \ + -Wcoverage-mismatch \ + -Wmultichar \ + -Wunused-macros \ + ; do + gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" + done + # More warnings from gcc 4.6.2 --help=warnings. + for gl_manywarn_item in \ + -Wabi \ + -Wcpp \ + -Wdeprecated \ + -Wdeprecated-declarations \ + -Wdiv-by-zero \ + -Wdouble-promotion \ + -Wendif-labels \ + -Wextra \ + -Wformat-contains-nul \ + -Wformat-extra-args \ + -Wformat-zero-length \ + -Wformat=2 \ + -Wmultichar \ + -Wnormalized=nfc \ + -Woverflow \ + -Wpointer-to-int-cast \ + -Wpragmas \ + -Wsuggest-attribute=const \ + -Wsuggest-attribute=noreturn \ + -Wsuggest-attribute=pure \ + -Wtrampolines \ + ; do + gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" + done + + # Disable the missing-field-initializers warning if needed + if test "$gl_cv_cc_nomfi_needed" = yes; then + gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" + fi + + $1=$gl_manywarn_set +]) diff -Nru spice-gtk-0.9/m4/nls.m4 spice-gtk-0.12/m4/nls.m4 --- spice-gtk-0.9/m4/nls.m4 2011-09-02 14:56:49.000000000 +0000 +++ spice-gtk-0.12/m4/nls.m4 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -# nls.m4 serial 3 (gettext-0.15) -dnl Copyright (C) 1995-2003, 2005-2006 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. -dnl -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper , 1995-2000. -dnl Bruno Haible , 2000-2003. - -AC_PREREQ(2.50) - -AC_DEFUN([AM_NLS], -[ - AC_MSG_CHECKING([whether NLS is requested]) - dnl Default is enabled NLS - AC_ARG_ENABLE(nls, - [ --disable-nls do not use Native Language Support], - USE_NLS=$enableval, USE_NLS=yes) - AC_MSG_RESULT($USE_NLS) - AC_SUBST(USE_NLS) -]) diff -Nru spice-gtk-0.9/m4/spice-compile-warnings.m4 spice-gtk-0.12/m4/spice-compile-warnings.m4 --- spice-gtk-0.9/m4/spice-compile-warnings.m4 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/m4/spice-compile-warnings.m4 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,148 @@ +dnl +dnl Enable all known GCC compiler warnings, except for those +dnl we can't yet cope with +dnl +AC_DEFUN([SPICE_COMPILE_WARNINGS],[ + dnl ****************************** + dnl More compiler warnings + dnl ****************************** + + AC_ARG_ENABLE([werror], + AS_HELP_STRING([--enable-werror], [Use -Werror (if supported)]), + [set_werror="$enableval"], + [if test -d $srcdir/.git; then + is_git_version=true + set_werror=yes + else + set_werror=no + fi]) + + # List of warnings that are not relevant / wanted + + # Don't care about C++ compiler compat + dontwarn="$dontwarn -Wc++-compat" + dontwarn="$dontwarn -Wabi" + dontwarn="$dontwarn -Wdeprecated" + # Don't care about ancient C standard compat + dontwarn="$dontwarn -Wtraditional" + # Don't care about ancient C standard compat + dontwarn="$dontwarn -Wtraditional-conversion" + # Ignore warnings in /usr/include + dontwarn="$dontwarn -Wsystem-headers" + # Happy for compiler to add struct padding + dontwarn="$dontwarn -Wpadded" + # GCC very confused with -O2 + dontwarn="$dontwarn -Wunreachable-code" + + + dontwarn="$dontwarn -Wconversion" + dontwarn="$dontwarn -Wsign-conversion" + dontwarn="$dontwarn -Wvla" + dontwarn="$dontwarn -Wundef" + dontwarn="$dontwarn -Wcast-qual" + dontwarn="$dontwarn -Wlong-long" + dontwarn="$dontwarn -Wswitch-default" + dontwarn="$dontwarn -Wswitch-enum" + dontwarn="$dontwarn -Wstrict-overflow" + dontwarn="$dontwarn -Wunsafe-loop-optimizations" + dontwarn="$dontwarn -Wformat-nonliteral" + dontwarn="$dontwarn -Wfloat-equal" + dontwarn="$dontwarn -Wdeclaration-after-statement" + dontwarn="$dontwarn -Wcast-qual" + dontwarn="$dontwarn -Wconversion" + dontwarn="$dontwarn -Wsign-conversion" + dontwarn="$dontwarn -Wpacked" + dontwarn="$dontwarn -Wunused-macros" + dontwarn="$dontwarn -Woverlength-strings" + dontwarn="$dontwarn -Wstack-protector" + dontwarn="$dontwarn -Winline" + dontwarn="$dontwarn -Wbad-function-cast" + dontwarn="$dontwarn -Wshadow" + + # We want to enable thse, but need to sort out the + # decl mess with gtk/generated_*.c + dontwarn="$dontwarn -Wmissing-prototypes" + dontwarn="$dontwarn -Wmissing-declarations" + + # Get all possible GCC warnings + gl_MANYWARN_ALL_GCC([maybewarn]) + + # Remove the ones we don't want, blacklisted earlier + gl_MANYWARN_COMPLEMENT([wantwarn], [$maybewarn], [$dontwarn]) + + # Check for $CC support of each warning + for w in $wantwarn; do + gl_WARN_ADD([$w]) + done + + # GNULIB uses '-W' (aka -Wextra) which includes a bunch of stuff. + # Unfortunately, this means you can't simply use '-Wsign-compare' + # with gl_MANYWARN_COMPLEMENT + # So we have -W enabled, and then have to explicitly turn off... + gl_WARN_ADD([-Wno-sign-compare]) + gl_WARN_ADD([-Wno-unused-parameter]) + gl_WARN_ADD([-Wno-missing-field-initializers]) + # We can't enable this due to horrible spice_usb_device_get_description + # signature + gl_WARN_ADD([-Wno-format-nonliteral]) + # We use some deprecated functions to avoid #ifdef hell while maintaining + # compat with older gtk / glib versions + gl_WARN_ADD([-Wno-deprecated-declarations]) + + + + # GNULIB expects this to be part of -Wc++-compat, but we turn + # that one off, so we need to manually enable this again + gl_WARN_ADD([-Wjump-misses-init]) + + # GNULIB turns on -Wformat=2 which implies -Wformat-nonliteral, + # so we need to manually re-exclude it. + gl_WARN_ADD([-Wno-format-nonliteral]) + + # This should be < 1024 really. pixman_utils is the blackspot + # preventing lower usage + gl_WARN_ADD([-Wframe-larger-than=9216]) + + # Use improved glibc headers + AC_DEFINE([_FORTIFY_SOURCE], [2], + [enable compile-time and run-time bounds-checking, and some warnings]) + + # Extra special flags + dnl -fstack-protector stuff passes gl_WARN_ADD with gcc + dnl on Mingw32, but fails when actually used + case $host in + *-*-linux*) + dnl Fedora only uses -fstack-protector, but doesn't seem to + dnl be great overhead in adding -fstack-protector-all instead + dnl gl_WARN_ADD([-fstack-protector]) + gl_WARN_ADD([-fstack-protector-all]) + gl_WARN_ADD([--param=ssp-buffer-size=4]) + ;; + esac + gl_WARN_ADD([-fexceptions]) + gl_WARN_ADD([-fasynchronous-unwind-tables]) + gl_WARN_ADD([-fdiagnostics-show-option]) + gl_WARN_ADD([-funit-at-a-time]) + + # Need -fipa-pure-const in order to make -Wsuggest-attribute=pure + # fire even without -O. + gl_WARN_ADD([-fipa-pure-const]) + + # We should eventually enable this, but right now there are at + # least 75 functions triggering warnings. + gl_WARN_ADD([-Wno-suggest-attribute=pure]) + gl_WARN_ADD([-Wno-suggest-attribute=const]) + + if test "$set_werror" = "yes" + then + gl_WARN_ADD([-Werror]) + fi + + WARN_LDFLAGS=$WARN_CFLAGS + AC_SUBST([WARN_CFLAGS]) + AC_SUBST([WARN_LDFLAGS]) + + gl_WARN_ADD([-Wno-write-strings]) + WARN_PYFLAGS=$WARN_CFLAGS + AC_SUBST([WARN_PYFLAGS]) +]) diff -Nru spice-gtk-0.9/m4/warnings.m4 spice-gtk-0.12/m4/warnings.m4 --- spice-gtk-0.9/m4/warnings.m4 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/m4/warnings.m4 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,37 @@ +# warnings.m4 serial 5 +dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Simon Josefsson + +# gl_AS_VAR_APPEND(VAR, VALUE) +# ---------------------------- +# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it. +m4_ifdef([AS_VAR_APPEND], +[m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])], +[m4_define([gl_AS_VAR_APPEND], +[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])]) + +# gl_WARN_ADD(PARAMETER, [VARIABLE = WARN_CFLAGS]) +# ------------------------------------------------ +# Adds parameter to WARN_CFLAGS if the compiler supports it. For example, +# gl_WARN_ADD([-Wparentheses]). +AC_DEFUN([gl_WARN_ADD], +dnl FIXME: gl_Warn must be used unquoted until we can assume +dnl autoconf 2.64 or newer. +[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl +AC_CACHE_CHECK([whether compiler handles $1], m4_defn([gl_Warn]), [ + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="${CPPFLAGS} $1" + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])], + [AS_VAR_SET(gl_Warn, [yes])], + [AS_VAR_SET(gl_Warn, [no])]) + CPPFLAGS="$gl_save_CPPFLAGS" +]) +AS_VAR_IF(gl_Warn, [yes], + [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])]) +AS_VAR_POPDEF([gl_Warn])dnl +m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl +]) diff -Nru spice-gtk-0.9/Makefile.am spice-gtk-0.12/Makefile.am --- spice-gtk-0.9/Makefile.am 2012-01-16 09:44:21.000000000 +0000 +++ spice-gtk-0.12/Makefile.am 2012-04-11 13:51:02.000000000 +0000 @@ -1,7 +1,8 @@ ACLOCAL_AMFLAGS = -I m4 NULL = -SUBDIRS = common gtk po python_modules doc data +SUBDIRS = spice-common gtk po doc data + if HAVE_INTROSPECTION if WITH_VALA SUBDIRS += vapi @@ -12,37 +13,43 @@ pkgconfig_DATA = \ spice-client-glib-2.0.pc \ spice-client-gtk-$(SPICE_GTK_API_VERSION).pc \ - spice-controller.pc + spice-controller.pc \ + $(NULL) + +INTLTOOL_FILES = \ + intltool-extract.in \ + intltool-merge.in \ + intltool-update.in \ + $(NULL) -INTLTOOL_FILES = intltool-extract.in \ - intltool-merge.in \ - intltool-update.in \ - $(NULL) - -DISTCLEANFILES = $(pkgconfig_DATA) \ - intltool-extract \ - intltool-merge \ - intltool-update \ - gnome-doc-utils.make \ - gtk-doc.make \ - po/.intltool-merge-cache \ - $(NULL) - -EXTRA_DIST = spice.proto \ - spice1.proto \ - spice_codegen.py \ - build-aux/git-version-gen \ - gtk-doc.make \ - .version \ - THANKS \ - $(INTLTOOL_FILES) \ - $(NULL) +DISTCLEANFILES = \ + $(pkgconfig_DATA) \ + intltool-extract \ + intltool-merge \ + intltool-update \ + gnome-doc-utils.make \ + po/.intltool-merge-cache \ + $(NULL) + +EXTRA_DIST = \ + build-aux/git-version-gen \ + gtk-doc.make \ + .version \ + THANKS \ + $(INTLTOOL_FILES) \ + $(NULL) MAINTAINERCLEANFILES = \ ABOUT-NLS \ aclocal.m4 \ config.h.in \ - m4/*.m4 \ + m4/gtk-doc.m4 \ + m4/intltool.m4 \ + m4/libtool.m4 \ + m4/ltoptions.m4 \ + m4/ltsugar.m4 \ + m4/ltversion.m4 \ + m4/lt~obsolete.m4 \ build-aux/compile \ build-aux/config.guess \ build-aux/config.rpath \ @@ -53,6 +60,7 @@ build-aux/missing \ build-aux/mkinstalldirs \ po/Makefile.in.in \ + gtk-doc.make \ $(NULL) # Generate the ChangeLog file (with all entries since the switch to git) @@ -98,4 +106,3 @@ /usr/i686-pc-mingw32/sys-root/mingw/lib/gstreamer-0.10/libgstcoreelements.dll -include $(top_srcdir)/git.mk - diff -Nru spice-gtk-0.9/Makefile.in spice-gtk-0.12/Makefile.in --- spice-gtk-0.9/Makefile.in 2012-01-31 10:23:00.000000000 +0000 +++ spice-gtk-0.12/Makefile.in 2012-04-24 11:21:04.000000000 +0000 @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -42,17 +42,18 @@ $(srcdir)/spice-client-gtk-2.0.pc.in \ $(srcdir)/spice-client-gtk-3.0.pc.in \ $(srcdir)/spice-controller.pc.in $(top_srcdir)/configure \ - ABOUT-NLS AUTHORS COPYING NEWS THANKS TODO build-aux/compile \ - build-aux/config.guess build-aux/config.rpath \ - build-aux/config.sub build-aux/depcomp build-aux/install-sh \ - build-aux/ltmain.sh build-aux/missing + AUTHORS COPYING NEWS THANKS TODO build-aux/compile \ + build-aux/config.guess build-aux/config.sub build-aux/depcomp \ + build-aux/install-sh build-aux/ltmain.sh build-aux/missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/check_python.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/intltool.m4 \ - $(top_srcdir)/m4/ld-version.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/ld-version.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/manywarnings.m4 \ + $(top_srcdir)/m4/spice-compile-warnings.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -62,11 +63,11 @@ CONFIG_CLEAN_FILES = spice-client-glib-2.0.pc spice-client-gtk-2.0.pc \ spice-client-gtk-3.0.pc spice-controller.pc CONFIG_CLEAN_VPATH_FILES = -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = @@ -98,6 +99,12 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(pkgconfigdir)" DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ @@ -107,14 +114,16 @@ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = common gtk po python_modules doc data vapi +DIST_SUBDIRS = spice-common gtk po doc data vapi DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ - { test ! -d "$(distdir)" \ - || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr "$(distdir)"; }; } + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ @@ -143,6 +152,8 @@ DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ACL_HELPER_DIR = @ACL_HELPER_DIR@ @@ -165,6 +176,7 @@ CELT051_LIBDIR = @CELT051_LIBDIR@ CELT051_LIBS = @CELT051_LIBS@ CFLAGS = @CFLAGS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ @@ -215,6 +227,10 @@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ @@ -270,8 +286,6 @@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PROTOCOL_CFLAGS = @PROTOCOL_CFLAGS@ -PROTOCOL_LIBS = @PROTOCOL_LIBS@ PULSE_CFLAGS = @PULSE_CFLAGS@ PULSE_LIBS = @PULSE_LIBS@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ @@ -291,7 +305,6 @@ SMARTCARD_CFLAGS = @SMARTCARD_CFLAGS@ SMARTCARD_LIBS = @SMARTCARD_LIBS@ SPICE_CFLAGS = @SPICE_CFLAGS@ -SPICE_COMMON_SRCDIR = @SPICE_COMMON_SRCDIR@ SPICE_GLIB_CFLAGS = @SPICE_GLIB_CFLAGS@ SPICE_GLIB_REQUIRES = @SPICE_GLIB_REQUIRES@ SPICE_GTK_API_VERSION = @SPICE_GTK_API_VERSION@ @@ -300,14 +313,19 @@ SPICE_GTK_REQUIRES = @SPICE_GTK_REQUIRES@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ +STOW = @STOW@ STRIP = @STRIP@ USBREDIR_CFLAGS = @USBREDIR_CFLAGS@ USBREDIR_LIBS = @USBREDIR_LIBS@ +USB_IDS = @USB_IDS@ USE_NLS = @USE_NLS@ VALAC = @VALAC@ VAPIDIR = @VAPIDIR@ VAPIGEN = @VAPIGEN@ VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_LDFLAGS = @WARN_LDFLAGS@ +WARN_PYFLAGS = @WARN_PYFLAGS@ XGETTEXT = @XGETTEXT@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ @@ -345,6 +363,8 @@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ @@ -363,6 +383,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ @@ -370,42 +391,48 @@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 NULL = -SUBDIRS = common gtk po python_modules doc data $(am__append_1) +SUBDIRS = spice-common gtk po doc data $(am__append_1) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = \ spice-client-glib-2.0.pc \ spice-client-gtk-$(SPICE_GTK_API_VERSION).pc \ - spice-controller.pc + spice-controller.pc \ + $(NULL) + +INTLTOOL_FILES = \ + intltool-extract.in \ + intltool-merge.in \ + intltool-update.in \ + $(NULL) + +DISTCLEANFILES = \ + $(pkgconfig_DATA) \ + intltool-extract \ + intltool-merge \ + intltool-update \ + gnome-doc-utils.make \ + po/.intltool-merge-cache \ + $(NULL) -INTLTOOL_FILES = intltool-extract.in \ - intltool-merge.in \ - intltool-update.in \ - $(NULL) - -DISTCLEANFILES = $(pkgconfig_DATA) \ - intltool-extract \ - intltool-merge \ - intltool-update \ - gnome-doc-utils.make \ - gtk-doc.make \ - po/.intltool-merge-cache \ - $(NULL) - -EXTRA_DIST = spice.proto \ - spice1.proto \ - spice_codegen.py \ - build-aux/git-version-gen \ - gtk-doc.make \ - .version \ - THANKS \ - $(INTLTOOL_FILES) \ - $(NULL) +EXTRA_DIST = \ + build-aux/git-version-gen \ + gtk-doc.make \ + .version \ + THANKS \ + $(INTLTOOL_FILES) \ + $(NULL) MAINTAINERCLEANFILES = \ ABOUT-NLS \ aclocal.m4 \ config.h.in \ - m4/*.m4 \ + m4/gtk-doc.m4 \ + m4/intltool.m4 \ + m4/libtool.m4 \ + m4/ltoptions.m4 \ + m4/ltsugar.m4 \ + m4/ltversion.m4 \ + m4/lt~obsolete.m4 \ build-aux/compile \ build-aux/config.guess \ build-aux/config.rpath \ @@ -416,6 +443,7 @@ build-aux/missing \ build-aux/mkinstalldirs \ po/Makefile.in.in \ + gtk-doc.make \ $(NULL) BUILT_SOURCES = $(top_srcdir)/.version @@ -432,7 +460,7 @@ $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: -am--refresh: +am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ @@ -468,10 +496,8 @@ $(am__aclocal_m4_deps): config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ - else :; fi + @if test ! -f $@; then rm -f stamp-h1; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 @@ -517,9 +543,7 @@ @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -730,7 +754,11 @@ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__remove_distdir) dist-lzma: distdir @@ -738,7 +766,7 @@ $(am__remove_distdir) dist-xz: distdir - tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir @@ -756,7 +784,7 @@ dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then @@ -770,6 +798,8 @@ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ @@ -789,6 +819,7 @@ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ @@ -817,8 +848,16 @@ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: - @$(am__cd) '$(distuninstallcheck_dir)' \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ @@ -854,10 +893,15 @@ installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -949,16 +993,16 @@ .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ - dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-xz \ - dist-zip distcheck distclean distclean-generic distclean-hdr \ - distclean-libtool distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-pkgconfigDATA install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ + dist-gzip dist-hook dist-lzip dist-lzma dist-shar dist-tarZ \ + dist-xz dist-zip distcheck distclean distclean-generic \ + distclean-hdr distclean-libtool distclean-tags distcleancheck \ + distdir distuninstallcheck dvi dvi-am html html-am info \ + info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-pkgconfigDATA \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-pkgconfigDATA diff -Nru spice-gtk-0.9/NEWS spice-gtk-0.12/NEWS --- spice-gtk-0.9/NEWS 2012-01-31 13:31:38.000000000 +0000 +++ spice-gtk-0.12/NEWS 2012-04-24 10:58:30.000000000 +0000 @@ -1,5 +1,40 @@ +v0.12 +===== + +- Fix memory leak when guest is resized +- Fix color-depth setting +- Hide/Show cursor correctly when needed +- Fix blue-tinted video with old Spice servers +- Correct scroll-event not received with recent Gtk+ +- Fix various migrations issues +- Allow to disable CELT encoding at runtime with SPICE_DISABLE_CELT +- Various crash fixes (on pubkey, recording, clipboard) +- Build changes (common submodule) and fixes + +v0.11 +===== + +- Fix semi-seamless migration regression +- Add Spice session UUID and name support +- Add foreign menu support to controller library +- Add a simple controller testing tool spice-controller-dump +- Build fixes + +v0.10 +===== + +- USB redir is now aware of host/guest side filtering +- you can query spice_usb_device_manager_can_redirect_device() +- fix the usbredir channel lifetime to be equal to session lifetime +- set keepalive on channel socket +- fix hangs on windows when using ssl chanels +- add a SpiceDisplay::zoom-level to maintain a scaling ratio +- add controller ENABLE_SMARTCARD option +- remove a few warnings, ui improvements, build fixes + v0.9 ==== + - Add command line options for setting the cache size and the glz window size - Add a USB device selection widget to libspice-client-gtk - Various bug fixes and code improvements diff -Nru spice-gtk-0.9/po/Makefile.in.in spice-gtk-0.12/po/Makefile.in.in --- spice-gtk-0.9/po/Makefile.in.in 2011-02-09 13:07:32.000000000 +0000 +++ spice-gtk-0.12/po/Makefile.in.in 2012-03-07 20:52:28.000000000 +0000 @@ -49,8 +49,8 @@ XGETTEXT = @XGETTEXT@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist -GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot +MSGMERGE = INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist +GENPOT = INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot ALL_LINGUAS = @ALL_LINGUAS@ @@ -73,15 +73,20 @@ .SUFFIXES: .SUFFIXES: .po .pox .gmo .mo .msg .cat +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +INTLTOOL_V_MSGFMT = $(INTLTOOL__v_MSGFMT_$(V)) +INTLTOOL__v_MSGFMT_= $(INTLTOOL__v_MSGFMT_$(AM_DEFAULT_VERBOSITY)) +INTLTOOL__v_MSGFMT_0 = @echo " MSGFMT" $@; + .po.pox: $(MAKE) $(GETTEXT_PACKAGE).pot $(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox .po.mo: - $(MSGFMT) -o $@ $< + $(INTLTOOL_V_MSGFMT)$(MSGFMT) -o $@ $< .po.gmo: - file=`echo $* | sed 's,.*/,,'`.gmo \ + $(INTLTOOL_V_MSGFMT)file=`echo $* | sed 's,.*/,,'`.gmo \ && rm -f $$file && $(GMSGFMT) -o $$file $< .po.cat: diff -Nru spice-gtk-0.9/po/POTFILES.in spice-gtk-0.12/po/POTFILES.in --- spice-gtk-0.9/po/POTFILES.in 2012-01-31 13:27:18.000000000 +0000 +++ spice-gtk-0.12/po/POTFILES.in 2012-04-11 13:51:02.000000000 +0000 @@ -12,3 +12,5 @@ gtk/spicy.c gtk/usb-device-manager.c gtk/usb-device-widget.c +gtk/usbutil.c +gtk/channel-usbredir.c diff -Nru spice-gtk-0.9/python_modules/codegen.py spice-gtk-0.12/python_modules/codegen.py --- spice-gtk-0.9/python_modules/codegen.py 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/python_modules/codegen.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,374 +0,0 @@ -from __future__ import with_statement -from cStringIO import StringIO - -def camel_to_underscores(s, upper = False): - res = "" - for i in range(len(s)): - c = s[i] - if i > 0 and c.isupper(): - res = res + "_" - if upper: - res = res + c.upper() - else: - res = res + c.lower() - return res - -def underscores_to_camel(s): - res = "" - do_upper = True - for i in range(len(s)): - c = s[i] - if c == "_": - do_upper = True - else: - if do_upper: - res = res + c.upper() - else: - res = res + c - do_upper = False - return res - -proto_prefix = "Temp" - -def set_prefix(prefix): - global proto_prefix - global proto_prefix_upper - global proto_prefix_lower - proto_prefix = prefix - proto_prefix_upper = prefix.upper() - proto_prefix_lower = prefix.lower() - -def prefix_underscore_upper(*args): - s = proto_prefix_upper - for arg in args: - s = s + "_" + arg - return s - -def prefix_underscore_lower(*args): - s = proto_prefix_lower - for arg in args: - s = s + "_" + arg - return s - -def prefix_camel(*args): - s = proto_prefix - for arg in args: - s = s + underscores_to_camel(arg) - return s - -def increment_identifier(idf): - v = idf[-1:] - if v.isdigit(): - return idf[:-1] + str(int(v) + 1) - return idf + "2" - -def sum_array(array): - if len(array) == 0: - return 0 - return " + ".join(array) - -class CodeWriter: - def __init__(self): - self.out = StringIO() - self.contents = [self.out] - self.indentation = 0 - self.at_line_start = True - self.indexes = ["i", "j", "k", "ii", "jj", "kk"] - self.current_index = 0 - self.generated = {} - self.vars = [] - self.has_error_check = False - self.options = {} - self.function_helper_writer = None - - def set_option(self, opt, value = True): - self.options[opt] = value - - def has_option(self, opt): - return self.options.has_key(opt) - - def set_is_generated(self, kind, name): - if not self.generated.has_key(kind): - v = {} - self.generated[kind] = v - else: - v = self.generated[kind] - v[name] = 1 - - def is_generated(self, kind, name): - if not self.generated.has_key(kind): - return False - v = self.generated[kind] - return v.has_key(name) - - def getvalue(self): - strs = map(lambda writer: writer.getvalue(), self.contents) - return "".join(strs) - - def get_subwriter(self): - writer = CodeWriter() - self.contents.append(writer) - self.out = StringIO() - self.contents.append(self.out) - writer.indentation = self.indentation - writer.at_line_start = self.at_line_start - writer.generated = self.generated - writer.options = self.options - writer.public_prefix = self.public_prefix - - return writer; - - def write(self, s): - # Ensure its a string - s = str(s) - - if len(s) == 0: - return - - if self.at_line_start: - for i in range(self.indentation): - self.out.write(" ") - self.at_line_start = False - self.out.write(s) - return self - - def newline(self): - self.out.write("\n") - self.at_line_start = True - return self - - def writeln(self, s): - self.write(s) - self.newline() - return self - - def label(self, s): - self.indentation = self.indentation - 1 - self.write(s + ":") - self.indentation = self.indentation + 1 - self.newline() - - def statement(self, s): - self.write(s) - self.write(";") - self.newline() - return self - - def assign(self, var, val): - self.write("%s = %s" % (var, val)) - self.write(";") - self.newline() - return self - - def increment(self, var, val): - self.write("%s += %s" % (var, val)) - self.write(";") - self.newline() - return self - - def comment(self, str): - self.write("/* " + str + " */") - return self - - def todo(self, str): - self.comment("TODO: *** %s ***" % str).newline() - return self - - def error_check(self, check, label = "error"): - self.has_error_check = True - with self.block("if (SPICE_UNLIKELY(%s))" % check): - if self.has_option("print_error"): - self.statement('printf("%%s: Caught error - %s", __PRETTY_FUNCTION__)' % check) - if self.has_option("assert_on_error"): - self.statement("assert(0)") - self.statement("goto %s" % label) - - def indent(self): - self.indentation += 4; - - def unindent(self): - self.indentation -= 4; - if self.indentation < 0: - self.indenttation = 0 - - def begin_block(self, prefix= "", comment = ""): - if len(prefix) > 0: - self.write(prefix) - if self.at_line_start: - self.write("{") - else: - self.write(" {") - if len(comment) > 0: - self.write(" ") - self.comment(comment) - self.newline() - self.indent() - - def end_block(self, semicolon=False, newline=True): - self.unindent() - if self.at_line_start: - self.write("}") - else: - self.write(" }") - if semicolon: - self.write(";") - if newline: - self.newline() - - class Block: - def __init__(self, writer, semicolon, newline): - self.writer = writer - self.semicolon = semicolon - self.newline = newline - - def __enter__(self): - return self.writer.get_subwriter() - - def __exit__(self, exc_type, exc_value, traceback): - self.writer.end_block(self.semicolon, self.newline) - - class PartialBlock: - def __init__(self, writer, scope, semicolon, newline): - self.writer = writer - self.scope = scope - self.semicolon = semicolon - self.newline = newline - - def __enter__(self): - return self.scope - - def __exit__(self, exc_type, exc_value, traceback): - self.writer.end_block(self.semicolon, self.newline) - - class NoBlock: - def __init__(self, scope): - self.scope = scope - - def __enter__(self): - return self.scope - - def __exit__(self, exc_type, exc_value, traceback): - pass - - def block(self, prefix= "", comment = "", semicolon=False, newline=True): - self.begin_block(prefix, comment) - return self.Block(self, semicolon, newline) - - def partial_block(self, scope, semicolon=False, newline=True): - return self.PartialBlock(self, scope, semicolon, newline) - - def no_block(self, scope): - return self.NoBlock(scope) - - def optional_block(self, scope): - if scope != None: - return self.NoBlock(scope) - return self.block() - - def for_loop(self, index, limit): - return self.block("for (%s = 0; %s < %s; %s++)" % (index, index, limit, index)) - - def while_loop(self, expr): - return self.block("while (%s)" % (expr)) - - def if_block(self, check, elseif=False, newline=True): - s = "if (%s)" % (check) - if elseif: - s = " else " + s - self.begin_block(s, "") - return self.Block(self, False, newline) - - def variable_defined(self, name): - for n in self.vars: - if n == name: - return True - return False - - def variable_def(self, ctype, *names): - for n in names: - # Strip away initialization - i = n.find("=") - if i != -1: - n = n[0:i] - self.vars.append(n.strip()) - # only add space for non-pointer types - if ctype[-1] == "*": - ctype = ctype[:-1].rstrip() - self.writeln("%s *%s;"%(ctype, ", *".join(names))) - else: - self.writeln("%s %s;"%(ctype, ", ".join(names))) - return self - - def function_helper(self): - if self.function_helper_writer != None: - writer = self.function_helper_writer.get_subwriter() - self.function_helper_writer.newline() - else: - writer = self.get_subwriter() - return writer - - def function(self, name, return_type, args, static = False): - self.has_error_check = False - self.function_helper_writer = self.get_subwriter() - if static: - self.write("static ") - self.write(return_type) - self.write(" %s(%s)"% (name, args)).newline() - self.begin_block() - self.function_variables_writer = self.get_subwriter() - self.function_variables = {} - return self.function_variables_writer - - def macro(self, name, args, define): - self.write("#define %s(%s) %s" % (name, args, define)).newline() - - def ifdef(self, name): - indentation = self.indentation - self.indentation = 0; - self.write("#ifdef %s" % (name)).newline() - self.indentation = indentation - - def ifdef_else(self, name): - indentation = self.indentation - self.indentation = 0; - self.write("#else /* %s */" % (name)).newline() - self.indentation = indentation - - def endif(self, name): - indentation = self.indentation - self.indentation = 0; - self.write("#endif /* %s */" % (name)).newline() - self.indentation = indentation - - def add_function_variable(self, ctype, name): - if self.function_variables.has_key(name): - assert(self.function_variables[name] == ctype) - else: - self.function_variables[name] = ctype - self.function_variables_writer.variable_def(ctype, name) - - def pop_index(self): - index = self.indexes[self.current_index] - self.current_index = self.current_index + 1 - self.add_function_variable("uint32_t", index) - return index - - def push_index(self): - self.current_index = self.current_index - 1 - - class Index: - def __init__(self, writer, val): - self.writer = writer - self.val = val - - def __enter__(self): - return self.val - - def __exit__(self, exc_type, exc_value, traceback): - self.writer.push_index() - - def index(self, no_block = False): - if no_block: - return self.no_block(None) - val = self.pop_index() - return self.Index(self, val) diff -Nru spice-gtk-0.9/python_modules/demarshal.py spice-gtk-0.12/python_modules/demarshal.py --- spice-gtk-0.9/python_modules/demarshal.py 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/python_modules/demarshal.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,1257 +0,0 @@ -from __future__ import with_statement -import ptypes -import codegen - -# The handling of sizes is somewhat complex, as there are several types of size: -# * nw_size -# This is the network size, i.e. the number of bytes on the network -# -# * mem_size -# The total amount of memory used for the representation of something inside -# spice. This is generally sizeof(C struct), but can be larger if for instance -# the type has a variable size array at the end or has a pointer in it that -# points to another data chunk (which will be allocated after the main -# data chunk). This is essentially how much memory you need to allocate to -# contain the data type. -# -# * extra_size -# This is the size of anything that is not part of the containing structure. -# For instance, a primitive (say uint32_t) member has no extra size, because -# when allocating its part of the sizeof(MessageStructType) struct. However -# a variable array can be places at the end of a structure (@end) and its -# size is then extra_size. Note that this extra_size is included in the -# mem_size of the enclosing struct, and even if you request the mem_size -# of the array itself. However, extra_size is typically not requested -# when the full mem_size is also requested. -# -# extra sizes come in two flavours. contains_extra_size means that the item -# has a normal presence in the parent container, but has some additional -# extra_size it references. For instance via a pointer somewhere in it. -# There is also is_extra_size(). This indicates that the whole elements -# "normal" mem size should be considered extra size for the container, so -# when computing the parent mem_size you should add the mem_size of this -# part as extra_size - -def write_parser_helpers(writer): - if writer.is_generated("helper", "demarshaller"): - return - - writer.set_is_generated("helper", "demarshaller") - - writer = writer.function_helper() - - writer.writeln("#ifdef WORDS_BIGENDIAN") - for size in [8, 16, 32, 64]: - for sign in ["", "u"]: - utype = "uint%d" % (size) - type = "%sint%d" % (sign, size) - swap = "SPICE_BYTESWAP%d" % size - if size == 8: - writer.macro("read_%s" % type, "ptr", "(*((%s_t *)(ptr)))" % type) - writer.macro("write_%s" % type, "ptr, val", "*(%s_t *)(ptr) = val" % (type)) - else: - writer.macro("read_%s" % type, "ptr", "((%s_t)%s(*((%s_t *)(ptr)))" % (type, swap, utype)) - writer.macro("write_%s" % type, "ptr, val", "*(%s_t *)(ptr) = %s((%s_t)val)" % (utype, swap, utype)) - writer.writeln("#else") - for size in [8, 16, 32, 64]: - for sign in ["", "u"]: - type = "%sint%d" % (sign, size) - writer.macro("read_%s" % type, "ptr", "(*((%s_t *)(ptr)))" % type) - writer.macro("write_%s" % type, "ptr, val", "(*((%s_t *)(ptr))) = val" % type) - writer.writeln("#endif") - - for size in [8, 16, 32, 64]: - for sign in ["", "u"]: - writer.newline() - type = "%sint%d" % (sign, size) - ctype = "%s_t" % type - scope = writer.function("SPICE_GNUC_UNUSED consume_%s" % type, ctype, "uint8_t **ptr", True) - scope.variable_def(ctype, "val") - writer.assign("val", "read_%s(*ptr)" % type) - writer.increment("*ptr", size / 8) - writer.statement("return val") - writer.end_block() - - writer.newline() - writer.statement("typedef struct PointerInfo PointerInfo") - writer.statement("typedef void (*message_destructor_t)(uint8_t *message)"); - writer.statement("typedef uint8_t * (*parse_func_t)(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *ptr_info, int minor)") - writer.statement("typedef uint8_t * (*parse_msg_func_t)(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size_out, message_destructor_t *free_message)") - writer.statement("typedef uint8_t * (*spice_parse_channel_func_t)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message)") - - writer.newline() - writer.begin_block("struct PointerInfo") - writer.variable_def("uint64_t", "offset") - writer.variable_def("parse_func_t", "parse") - writer.variable_def("void **", "dest") - writer.variable_def("uint32_t", "nelements") - writer.end_block(semicolon=True) - -def write_read_primitive(writer, start, container, name, scope): - m = container.lookup_member(name) - assert(m.is_primitive()) - writer.assign("pos", start + " + " + container.get_nw_offset(m, "", "__nw_size")) - writer.error_check("pos + %s > message_end" % m.member_type.get_fixed_nw_size()) - - var = "%s__value" % (name.replace(".", "_")) - if not scope.variable_defined(var): - scope.variable_def(m.member_type.c_type(), var) - writer.assign(var, "read_%s(pos)" % (m.member_type.primitive_type())) - return var - -def write_write_primitive(writer, start, container, name, val): - m = container.lookup_member(name) - assert(m.is_primitive()) - writer.assign("pos", start + " + " + container.get_nw_offset(m, "", "__nw_size")) - - var = "%s__value" % (name) - writer.statement("write_%s(pos, %s)" % (m.member_type.primitive_type(), val)) - return var - -def write_read_primitive_item(writer, item, scope): - assert(item.type.is_primitive()) - writer.assign("pos", item.get_position()) - writer.error_check("pos + %s > message_end" % item.type.get_fixed_nw_size()) - var = "%s__value" % (item.subprefix.replace(".", "_")) - scope.variable_def(item.type.c_type(), var) - writer.assign(var, "read_%s(pos)" % (item.type.primitive_type())) - return var - -class ItemInfo: - def __init__(self, type, prefix, position): - self.type = type - self.prefix = prefix - self.subprefix = prefix - self.position = position - self.member = None - - def nw_size(self): - return self.prefix + "__nw_size" - - def mem_size(self): - return self.prefix + "__mem_size" - - def extra_size(self): - return self.prefix + "__extra_size" - - def get_position(self): - return self.position - -class MemberItemInfo(ItemInfo): - def __init__(self, member, container, start): - if not member.is_switch(): - self.type = member.member_type - self.prefix = member.name - self.subprefix = member.name - self.position = "(%s + %s)" % (start, container.get_nw_offset(member, "", "__nw_size")) - self.member = member - -def write_validate_switch_member(writer, container, switch_member, scope, parent_scope, start, - want_nw_size, want_mem_size, want_extra_size): - var = container.lookup_member(switch_member.variable) - var_type = var.member_type - - v = write_read_primitive(writer, start, container, switch_member.variable, parent_scope) - - item = MemberItemInfo(switch_member, container, start) - - first = True - for c in switch_member.cases: - check = c.get_check(v, var_type) - m = c.member - with writer.if_block(check, not first, False) as if_scope: - item.type = c.member.member_type - item.subprefix = item.prefix + "_" + m.name - item.member = c.member - - all_as_extra_size = m.is_extra_size() and want_extra_size - if not want_mem_size and all_as_extra_size and not scope.variable_defined(item.mem_size()): - scope.variable_def("uint32_t", item.mem_size()) - - sub_want_mem_size = want_mem_size or all_as_extra_size - sub_want_extra_size = want_extra_size and not all_as_extra_size - - write_validate_item(writer, container, item, if_scope, scope, start, - want_nw_size, sub_want_mem_size, sub_want_extra_size) - - if all_as_extra_size: - writer.assign(item.extra_size(), item.mem_size()) - - first = False - - with writer.block(" else"): - if want_nw_size: - writer.assign(item.nw_size(), 0) - if want_mem_size: - writer.assign(item.mem_size(), 0) - if want_extra_size: - writer.assign(item.extra_size(), 0) - - writer.newline() - -def write_validate_struct_function(writer, struct): - validate_function = "validate_%s" % struct.c_type() - if writer.is_generated("validator", validate_function): - return validate_function - - writer.set_is_generated("validator", validate_function) - writer = writer.function_helper() - scope = writer.function(validate_function, "static intptr_t", "uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor") - scope.variable_def("uint8_t *", "start = message_start + offset") - scope.variable_def("SPICE_GNUC_UNUSED uint8_t *", "pos"); - scope.variable_def("size_t", "mem_size", "nw_size"); - num_pointers = struct.get_num_pointers() - if num_pointers != 0: - scope.variable_def("SPICE_GNUC_UNUSED intptr_t", "ptr_size"); - - writer.newline() - with writer.if_block("offset == 0"): - writer.statement("return 0") - - writer.newline() - writer.error_check("start >= message_end") - - writer.newline() - write_validate_container(writer, None, struct, "start", scope, True, True, False) - - writer.newline() - writer.comment("Check if struct fits in reported side").newline() - writer.error_check("start + nw_size > message_end") - - writer.statement("return mem_size") - - writer.newline() - writer.label("error") - writer.statement("return -1") - - writer.end_block() - - return validate_function - -def write_validate_pointer_item(writer, container, item, scope, parent_scope, start, - want_nw_size, want_mem_size, want_extra_size): - if want_nw_size: - writer.assign(item.nw_size(), item.type.get_fixed_nw_size()) - - if want_mem_size or want_extra_size: - target_type = item.type.target_type - - v = write_read_primitive_item(writer, item, scope) - if item.type.has_attr("nonnull"): - writer.error_check("%s == 0" % v) - - # pointer target is struct, or array of primitives - # if array, need no function check - - if target_type.is_array(): - writer.error_check("message_start + %s >= message_end" % v) - - - assert target_type.element_type.is_primitive() - - array_item = ItemInfo(target_type, "%s__array" % item.prefix, start) - scope.variable_def("uint32_t", array_item.nw_size()) - # don't create a variable that isn't used, fixes -Werror=unused-but-set-variable - need_mem_size = want_mem_size or ( - want_extra_size and not item.member.has_attr("chunk") - and not target_type.is_cstring_length()) - if need_mem_size: - scope.variable_def("uint32_t", array_item.mem_size()) - if target_type.is_cstring_length(): - writer.assign(array_item.nw_size(), "spice_strnlen((char *)message_start + %s, message_end - (message_start + %s))" % (v, v)) - writer.error_check("*(message_start + %s + %s) != 0" % (v, array_item.nw_size())) - else: - write_validate_array_item(writer, container, array_item, scope, parent_scope, start, - True, want_mem_size=need_mem_size, want_extra_size=False) - writer.error_check("message_start + %s + %s > message_end" % (v, array_item.nw_size())) - - if want_extra_size: - if item.member and item.member.has_attr("chunk"): - writer.assign(item.extra_size(), "sizeof(SpiceChunks) + sizeof(SpiceChunk)") - elif item.member and item.member.has_attr("nocopy"): - writer.comment("@nocopy, so no extra size").newline() - writer.assign(item.extra_size(), 0) - elif target_type.element_type.get_fixed_nw_size == 1: - writer.assign(item.extra_size(), array_item.mem_size()) - # If not bytes or zero, add padding needed for alignment - else: - writer.assign(item.extra_size(), "%s + /* for alignment */ 3" % array_item.mem_size()) - if want_mem_size: - writer.assign(item.mem_size(), "sizeof(void *) + %s" % array_item.mem_size()) - - elif target_type.is_struct(): - validate_function = write_validate_struct_function(writer, target_type) - writer.assign("ptr_size", "%s(message_start, message_end, %s, minor)" % (validate_function, v)) - writer.error_check("ptr_size < 0") - - if want_extra_size: - writer.assign(item.extra_size(), "ptr_size + /* for alignment */ 3") - if want_mem_size: - writer.assign(item.mem_size(), "sizeof(void *) + ptr_size") - else: - raise NotImplementedError("pointer to unsupported type %s" % target_type) - - -def write_validate_array_item(writer, container, item, scope, parent_scope, start, - want_nw_size, want_mem_size, want_extra_size): - array = item.type - is_byte_size = False - element_type = array.element_type - if array.is_bytes_length(): - nelements = "%s__nbytes" %(item.prefix) - real_nelements = "%s__nelements" %(item.prefix) - if not parent_scope.variable_defined(real_nelements): - parent_scope.variable_def("uint32_t", real_nelements) - else: - nelements = "%s__nelements" %(item.prefix) - if not parent_scope.variable_defined(nelements): - parent_scope.variable_def("uint32_t", nelements) - - if array.is_constant_length(): - writer.assign(nelements, array.size) - elif array.is_remaining_length(): - if element_type.is_fixed_nw_size(): - if element_type.get_fixed_nw_size() == 1: - writer.assign(nelements, "message_end - %s" % item.get_position()) - else: - writer.assign(nelements, "(message_end - %s) / (%s)" %(item.get_position(), element_type.get_fixed_nw_size())) - else: - raise NotImplementedError("TODO array[] of dynamic element size not done yet") - elif array.is_identifier_length(): - v = write_read_primitive(writer, start, container, array.size, scope) - writer.assign(nelements, v) - elif array.is_image_size_length(): - bpp = array.size[1] - width = array.size[2] - rows = array.size[3] - width_v = write_read_primitive(writer, start, container, width, scope) - rows_v = write_read_primitive(writer, start, container, rows, scope) - # TODO: Handle multiplication overflow - if bpp == 8: - writer.assign(nelements, "%s * %s" % (width_v, rows_v)) - elif bpp == 1: - writer.assign(nelements, "((%s + 7) / 8 ) * %s" % (width_v, rows_v)) - else: - writer.assign(nelements, "((%s * %s + 7) / 8 ) * %s" % (bpp, width_v, rows_v)) - elif array.is_bytes_length(): - is_byte_size = True - v = write_read_primitive(writer, start, container, array.size[1], scope) - writer.assign(nelements, v) - writer.assign(real_nelements, 0) - elif array.is_cstring_length(): - writer.todo("cstring array size type not handled yet") - else: - writer.todo("array size type not handled yet") - - writer.newline() - - nw_size = item.nw_size() - mem_size = item.mem_size() - extra_size = item.extra_size() - - if is_byte_size and want_nw_size: - writer.assign(nw_size, nelements) - want_nw_size = False - - if element_type.is_fixed_nw_size() and want_nw_size: - element_size = element_type.get_fixed_nw_size() - # TODO: Overflow check the multiplication - if element_size == 1: - writer.assign(nw_size, nelements) - else: - writer.assign(nw_size, "(%s) * %s" % (element_size, nelements)) - want_nw_size = False - - if array.has_attr("as_ptr") and want_mem_size: - writer.assign(mem_size, "sizeof(void *)") - want_mem_size = False - - if array.has_attr("chunk"): - if want_mem_size: - writer.assign(extra_size, "sizeof(SpiceChunks *)") - want_mem_size = False - if want_extra_size: - writer.assign(extra_size, "sizeof(SpiceChunks) + sizeof(SpiceChunk)") - want_extra_size = False - - if element_type.is_fixed_sizeof() and want_mem_size and not is_byte_size: - # TODO: Overflow check the multiplication - if array.has_attr("ptr_array"): - writer.assign(mem_size, "sizeof(void *) + SPICE_ALIGN(%s * %s, 4)" % (element_type.sizeof(), nelements)) - else: - writer.assign(mem_size, "%s * %s" % (element_type.sizeof(), nelements)) - want_mem_size = False - - if not element_type.contains_extra_size() and want_extra_size: - writer.assign(extra_size, 0) - want_extra_size = False - - if not (want_mem_size or want_nw_size or want_extra_size): - return - - start2 = codegen.increment_identifier(start) - scope.variable_def("uint8_t *", "%s = %s" % (start2, item.get_position())) - if is_byte_size: - start2_end = "%s_array_end" % start2 - scope.variable_def("uint8_t *", start2_end) - - element_item = ItemInfo(element_type, "%s__element" % item.prefix, start2) - - element_nw_size = element_item.nw_size() - element_mem_size = element_item.mem_size() - element_extra_size = element_item.extra_size() - scope.variable_def("uint32_t", element_nw_size) - scope.variable_def("uint32_t", element_mem_size) - if want_extra_size: - scope.variable_def("uint32_t", element_extra_size) - - if want_nw_size: - writer.assign(nw_size, 0) - if want_mem_size: - writer.assign(mem_size, 0) - if want_extra_size: - writer.assign(extra_size, 0) - - want_element_nw_size = want_nw_size - if element_type.is_fixed_nw_size(): - start_increment = element_type.get_fixed_nw_size() - else: - want_element_nw_size = True - start_increment = element_nw_size - - if is_byte_size: - writer.assign(start2_end, "%s + %s" % (start2, nelements)) - - with writer.index(no_block = is_byte_size) as index: - with writer.while_loop("%s < %s" % (start2, start2_end) ) if is_byte_size else writer.for_loop(index, nelements) as scope: - if is_byte_size: - writer.increment(real_nelements, 1) - write_validate_item(writer, container, element_item, scope, parent_scope, start2, - want_element_nw_size, want_mem_size, want_extra_size) - - if want_nw_size: - writer.increment(nw_size, element_nw_size) - if want_mem_size: - if array.has_attr("ptr_array"): - writer.increment(mem_size, "sizeof(void *) + SPICE_ALIGN(%s, 4)" % element_mem_size) - else: - writer.increment(mem_size, element_mem_size) - if want_extra_size: - writer.increment(extra_size, element_extra_size) - - writer.increment(start2, start_increment) - if is_byte_size: - writer.error_check("%s != %s" % (start2, start2_end)) - write_write_primitive(writer, start, container, array.size[1], real_nelements) - -def write_validate_struct_item(writer, container, item, scope, parent_scope, start, - want_nw_size, want_mem_size, want_extra_size): - struct = item.type - start2 = codegen.increment_identifier(start) - scope.variable_def("SPICE_GNUC_UNUSED uint8_t *", start2 + " = %s" % (item.get_position())) - - write_validate_container(writer, item.prefix, struct, start2, scope, want_nw_size, want_mem_size, want_extra_size) - -def write_validate_primitive_item(writer, container, item, scope, parent_scope, start, - want_nw_size, want_mem_size, want_extra_size): - if want_nw_size: - nw_size = item.nw_size() - writer.assign(nw_size, item.type.get_fixed_nw_size()) - if want_mem_size: - mem_size = item.mem_size() - writer.assign(mem_size, item.type.sizeof()) - if want_extra_size: - writer.assign(item.extra_size(), 0) - -def write_validate_item(writer, container, item, scope, parent_scope, start, - want_nw_size, want_mem_size, want_extra_size): - if item.member and item.member.has_attr("to_ptr"): - want_nw_size = True - if item.type.is_pointer(): - write_validate_pointer_item(writer, container, item, scope, parent_scope, start, - want_nw_size, want_mem_size, want_extra_size) - elif item.type.is_array(): - write_validate_array_item(writer, container, item, scope, parent_scope, start, - want_nw_size, want_mem_size, want_extra_size) - elif item.type.is_struct(): - write_validate_struct_item(writer, container, item, scope, parent_scope, start, - want_nw_size, want_mem_size, want_extra_size) - elif item.type.is_primitive(): - write_validate_primitive_item(writer, container, item, scope, parent_scope, start, - want_nw_size, want_mem_size, want_extra_size) - else: - writer.todo("Implement validation of %s" % item.type) - - if item.member and item.member.has_attr("to_ptr"): - saved_size = "%s__saved_size" % item.member.name - writer.add_function_variable("uint32_t", saved_size + " = 0") - writer.assign(saved_size, item.nw_size()) - -def write_validate_member(writer, container, member, parent_scope, start, - want_nw_size, want_mem_size, want_extra_size): - if member.has_attr("virtual"): - return - - if member.has_minor_attr(): - prefix = "if (minor >= %s)" % (member.get_minor_attr()) - newline = False - else: - prefix = "" - newline = True - item = MemberItemInfo(member, container, start) - with writer.block(prefix, newline=newline, comment=member.name) as scope: - if member.is_switch(): - write_validate_switch_member(writer, container, member, scope, parent_scope, start, - want_nw_size, want_mem_size, want_extra_size) - else: - write_validate_item(writer, container, item, scope, parent_scope, start, - want_nw_size, want_mem_size, want_extra_size) - - if member.has_minor_attr(): - with writer.block(" else", comment = "minor < %s" % (member.get_minor_attr())): - if member.is_array(): - nelements = "%s__nelements" %(item.prefix) - writer.assign(nelements, 0) - if want_nw_size: - writer.assign(item.nw_size(), 0) - - if want_mem_size: - if member.is_fixed_sizeof(): - writer.assign(item.mem_size(), member.sizeof()) - elif member.is_array(): - writer.assign(item.mem_size(), 0) - else: - raise NotImplementedError("TODO minor check for non-constant items") - - assert not want_extra_size - -def write_validate_container(writer, prefix, container, start, parent_scope, want_nw_size, want_mem_size, want_extra_size): - for m in container.members: - sub_want_nw_size = want_nw_size and not m.is_fixed_nw_size() - sub_want_mem_size = m.is_extra_size() and want_mem_size - sub_want_extra_size = not m.is_extra_size() and m.contains_extra_size() - - defs = ["size_t"] - if sub_want_nw_size: - defs.append (m.name + "__nw_size") - if sub_want_mem_size: - defs.append (m.name + "__mem_size") - if sub_want_extra_size: - defs.append (m.name + "__extra_size") - - if sub_want_nw_size or sub_want_mem_size or sub_want_extra_size: - parent_scope.variable_def(*defs) - write_validate_member(writer, container, m, parent_scope, start, - sub_want_nw_size, sub_want_mem_size, sub_want_extra_size) - writer.newline() - - if want_nw_size: - if prefix: - nw_size = prefix + "__nw_size" - else: - nw_size = "nw_size" - - size = 0 - for m in container.members: - if m.is_fixed_nw_size(): - size = size + m.get_fixed_nw_size() - - nm_sum = str(size) - for m in container.members: - if not m.is_fixed_nw_size(): - nm_sum = nm_sum + " + " + m.name + "__nw_size" - - writer.assign(nw_size, nm_sum) - - if want_mem_size: - if prefix: - mem_size = prefix + "__mem_size" - else: - mem_size = "mem_size" - - mem_sum = container.sizeof() - for m in container.members: - if m.is_extra_size(): - mem_sum = mem_sum + " + " + m.name + "__mem_size" - elif m.contains_extra_size(): - mem_sum = mem_sum + " + " + m.name + "__extra_size" - - writer.assign(mem_size, mem_sum) - - if want_extra_size: - if prefix: - extra_size = prefix + "__extra_size" - else: - extra_size = "extra_size" - - extra_sum = [] - for m in container.members: - if m.is_extra_size(): - extra_sum.append(m.name + "__mem_size") - elif m.contains_extra_size(): - extra_sum.append(m.name + "__extra_size") - writer.assign(extra_size, codegen.sum_array(extra_sum)) - -class DemarshallingDestination: - def __init__(self): - pass - - def child_at_end(self, writer, t): - return RootDemarshallingDestination(self, t.c_type(), t.sizeof()) - - def child_sub(self, member): - return SubDemarshallingDestination(self, member) - - def declare(self, writer): - return writer.optional_block(self.reuse_scope) - - def is_toplevel(self): - return self.parent_dest == None and not self.is_helper - -class RootDemarshallingDestination(DemarshallingDestination): - def __init__(self, parent_dest, c_type, sizeof, pointer = None): - self.is_helper = False - self.reuse_scope = None - self.parent_dest = parent_dest - if parent_dest: - self.base_var = codegen.increment_identifier(parent_dest.base_var) - else: - self.base_var = "out" - self.c_type = c_type - self.sizeof = sizeof - self.pointer = pointer # None == at "end" - - def get_ref(self, member): - return self.base_var + "->" + member - - def declare(self, writer): - if self.reuse_scope: - scope = self.reuse_scope - else: - writer.begin_block() - scope = writer.get_subwriter() - - scope.variable_def(self.c_type + " *", self.base_var) - if not self.reuse_scope: - scope.newline() - - if self.pointer: - writer.assign(self.base_var, "(%s *)%s" % (self.c_type, self.pointer)) - else: - writer.assign(self.base_var, "(%s *)end" % (self.c_type)) - writer.increment("end", self.sizeof) - writer.newline() - - if self.reuse_scope: - return writer.no_block(self.reuse_scope) - else: - return writer.partial_block(scope) - -class SubDemarshallingDestination(DemarshallingDestination): - def __init__(self, parent_dest, member): - self.reuse_scope = None - self.parent_dest = parent_dest - self.base_var = parent_dest.base_var - self.member = member - self.is_helper = False - - def get_ref(self, member): - return self.parent_dest.get_ref(self.member) + "." + member - -# Note: during parsing, byte_size types have been converted to count during validation -def read_array_len(writer, prefix, array, dest, scope, is_ptr): - if is_ptr: - nelements = "%s__array__nelements" % prefix - else: - nelements = "%s__nelements" % prefix - if dest.is_toplevel(): - return nelements # Already there for toplevel, need not recalculate - element_type = array.element_type - scope.variable_def("uint32_t", nelements) - if array.is_constant_length(): - writer.assign(nelements, array.size) - elif array.is_identifier_length(): - writer.assign(nelements, dest.get_ref(array.size)) - elif array.is_remaining_length(): - if element_type.is_fixed_nw_size(): - writer.assign(nelements, "(message_end - in) / (%s)" %(element_type.get_fixed_nw_size())) - else: - raise NotImplementedError("TODO array[] of dynamic element size not done yet") - elif array.is_image_size_length(): - bpp = array.size[1] - width = array.size[2] - rows = array.size[3] - width_v = dest.get_ref(width) - rows_v = dest.get_ref(rows) - # TODO: Handle multiplication overflow - if bpp == 8: - writer.assign(nelements, "%s * %s" % (width_v, rows_v)) - elif bpp == 1: - writer.assign(nelements, "((%s + 7) / 8 ) * %s" % (width_v, rows_v)) - else: - writer.assign(nelements, "((%s * %s + 7) / 8 ) * %s" % (bpp, width_v, rows_v)) - elif array.is_bytes_length(): - writer.assign(nelements, dest.get_ref(array.size[2])) - else: - raise NotImplementedError("TODO array size type not handled yet") - return nelements - -def write_switch_parser(writer, container, switch, dest, scope): - var = container.lookup_member(switch.variable) - var_type = var.member_type - - if switch.has_attr("fixedsize"): - scope.variable_def("uint8_t *", "in_save") - writer.assign("in_save", "in") - - first = True - for c in switch.cases: - check = c.get_check(dest.get_ref(switch.variable), var_type) - m = c.member - with writer.if_block(check, not first, False) as block: - t = m.member_type - if switch.has_end_attr(): - dest2 = dest.child_at_end(writer, m.member_type) - elif switch.has_attr("anon"): - if t.is_struct() and not m.has_attr("to_ptr"): - dest2 = dest.child_sub(m.name) - else: - dest2 = dest - else: - if t.is_struct(): - dest2 = dest.child_sub(switch.name + "." + m.name) - else: - dest2 = dest.child_sub(switch.name) - dest2.reuse_scope = block - - if m.has_attr("to_ptr"): - write_parse_to_pointer(writer, t, False, dest2, m.name, block) - elif t.is_pointer(): - write_parse_pointer(writer, t, False, dest2, m.name, block) - elif t.is_struct(): - write_container_parser(writer, t, dest2) - elif t.is_primitive(): - if m.has_attr("zero"): - writer.statement("consume_%s(&in)" % (t.primitive_type())) - else: - writer.assign(dest2.get_ref(m.name), "consume_%s(&in)" % (t.primitive_type())) - #TODO validate e.g. flags and enums - elif t.is_array(): - nelements = read_array_len(writer, m.name, t, dest, block, False) - write_array_parser(writer, m, nelements, t, dest2, block) - else: - writer.todo("Can't handle type %s" % m.member_type) - - first = False - - writer.newline() - - if switch.has_attr("fixedsize"): - writer.assign("in", "in_save + %s" % switch.get_fixed_nw_size()) - -def write_parse_ptr_function(writer, target_type): - if target_type.is_array(): - parse_function = "parse_array_%s" % target_type.element_type.primitive_type() - else: - parse_function = "parse_struct_%s" % target_type.c_type() - if writer.is_generated("parser", parse_function): - return parse_function - - writer.set_is_generated("parser", parse_function) - - writer = writer.function_helper() - scope = writer.function(parse_function, "static uint8_t *", "uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor") - scope.variable_def("uint8_t *", "in = message_start + this_ptr_info->offset") - scope.variable_def("uint8_t *", "end") - - num_pointers = target_type.get_num_pointers() - if num_pointers != 0: - scope.variable_def("SPICE_GNUC_UNUSED intptr_t", "ptr_size"); - scope.variable_def("uint32_t", "n_ptr=0"); - scope.variable_def("PointerInfo", "ptr_info[%s]" % num_pointers) - - writer.newline() - if target_type.is_array(): - writer.assign("end", "struct_data") - else: - writer.assign("end", "struct_data + %s" % (target_type.sizeof())) - - dest = RootDemarshallingDestination(None, target_type.c_type(), target_type.sizeof(), "struct_data") - dest.is_helper = True - dest.reuse_scope = scope - if target_type.is_array(): - write_array_parser(writer, None, "this_ptr_info->nelements", target_type, dest, scope) - else: - write_container_parser(writer, target_type, dest) - - if num_pointers != 0: - write_ptr_info_check(writer) - - writer.statement("return end") - - if writer.has_error_check: - writer.newline() - writer.label("error") - writer.statement("return NULL") - - writer.end_block() - - return parse_function - -def write_array_parser(writer, member, nelements, array, dest, scope): - is_byte_size = array.is_bytes_length() - - element_type = array.element_type - if member: - array_start = dest.get_ref(member.name) - at_end = member.has_attr("end") - else: - array_start = "end" - at_end = True - - if element_type == ptypes.uint8 or element_type == ptypes.int8: - writer.statement("memcpy(%s, in, %s)" % (array_start, nelements)) - writer.increment("in", nelements) - if at_end: - writer.increment("end", nelements) - else: - with writer.index() as index: - if member: - array_pos = "%s[%s]" % (array_start, index) - else: - array_pos = "*(%s *)end" % (element_type.c_type()) - - if array.has_attr("ptr_array"): - scope.variable_def("void **", "ptr_array") - scope.variable_def("int", "ptr_array_index") - writer.assign("ptr_array_index", 0) - writer.assign("ptr_array", "(void **)%s" % array_start) - writer.increment("end", "sizeof(void *) * %s" % nelements) - array_start = "end" - array_pos = "*(%s *)end" % (element_type.c_type()) - at_end = True - - with writer.for_loop(index, nelements) as array_scope: - if array.has_attr("ptr_array"): - writer.statement("ptr_array[ptr_array_index++] = end") - if element_type.is_primitive(): - writer.statement("%s = consume_%s(&in)" % (array_pos, element_type.primitive_type())) - if at_end: - writer.increment("end", element_type.sizeof()) - else: - if at_end: - dest2 = dest.child_at_end(writer, element_type) - else: - dest2 = RootDemarshallingDestination(dest, element_type.c_type(), element_type.c_type(), array_pos) - dest2.reuse_scope = array_scope - write_container_parser(writer, element_type, dest2) - if array.has_attr("ptr_array"): - writer.comment("Align ptr_array element to 4 bytes").newline() - writer.assign("end", "(uint8_t *)SPICE_ALIGN((size_t)end, 4)") - -def write_parse_pointer_core(writer, target_type, offset, at_end, dest, member_name, scope): - writer.assign("ptr_info[n_ptr].offset", offset) - writer.assign("ptr_info[n_ptr].parse", write_parse_ptr_function(writer, target_type)) - if at_end: - writer.assign("ptr_info[n_ptr].dest", "(void **)end") - writer.increment("end", "sizeof(void *)"); - else: - writer.assign("ptr_info[n_ptr].dest", "(void **)&%s" % dest.get_ref(member_name)) - if target_type.is_array(): - nelements = read_array_len(writer, member_name, target_type, dest, scope, True) - writer.assign("ptr_info[n_ptr].nelements", nelements) - - writer.statement("n_ptr++") - -def write_parse_pointer(writer, t, at_end, dest, member_name, scope): - write_parse_pointer_core(writer, t.target_type, "consume_%s(&in)" % t.primitive_type(), - at_end, dest, member_name, scope) - -def write_parse_to_pointer(writer, t, at_end, dest, member_name, scope): - write_parse_pointer_core(writer, t, "in - start", - at_end, dest, member_name, scope) - writer.increment("in", "%s__saved_size" % member_name) - -def write_member_parser(writer, container, member, dest, scope): - if member.has_attr("virtual"): - writer.assign(dest.get_ref(member.name), member.attributes["virtual"][0]) - return - - if member.is_switch(): - write_switch_parser(writer, container, member, dest, scope) - return - - t = member.member_type - - if member.has_attr("to_ptr"): - write_parse_to_pointer(writer, t, member.has_end_attr(), dest, member.name, scope) - elif t.is_pointer(): - if member.has_attr("chunk"): - assert(t.target_type.is_array()) - nelements = read_array_len(writer, member.name, t.target_type, dest, scope, True) - writer.comment("Reuse data from network message as chunk").newline() - scope.variable_def("SpiceChunks *", "chunks"); - writer.assign("chunks", "(SpiceChunks *)end") - writer.increment("end", "sizeof(SpiceChunks) + sizeof(SpiceChunk)") - writer.assign(dest.get_ref(member.name), "chunks") - writer.assign("chunks->data_size", nelements) - writer.assign("chunks->flags", 0) - writer.assign("chunks->num_chunks", 1) - writer.assign("chunks->chunk[0].len", nelements) - writer.assign("chunks->chunk[0].data", "message_start + consume_%s(&in)" % t.primitive_type()) - elif member.has_attr("nocopy"): - writer.comment("Reuse data from network message").newline() - writer.assign(dest.get_ref(member.name), "(size_t)(message_start + consume_%s(&in))" % t.primitive_type()) - else: - write_parse_pointer(writer, t, member.has_end_attr(), dest, member.name, scope) - elif t.is_primitive(): - if member.has_attr("zero"): - writer.statement("consume_%s(&in)" % t.primitive_type()) - elif member.has_end_attr(): - writer.statement("*(%s *)end = consume_%s(&in)" % (t.c_type(), t.primitive_type())) - writer.increment("end", t.sizeof()) - else: - if member.has_attr("bytes_count"): - dest_var = dest.get_ref(member.attributes["bytes_count"][0]) - else: - dest_var = dest.get_ref(member.name) - writer.assign(dest_var, "consume_%s(&in)" % (t.primitive_type())) - #TODO validate e.g. flags and enums - elif t.is_array(): - nelements = read_array_len(writer, member.name, t, dest, scope, False) - if member.has_attr("chunk") and t.element_type.is_fixed_nw_size() and t.element_type.get_fixed_nw_size() == 1: - writer.comment("use array as chunk").newline() - - scope.variable_def("SpiceChunks *", "chunks"); - writer.assign("chunks", "(SpiceChunks *)end") - writer.increment("end", "sizeof(SpiceChunks) + sizeof(SpiceChunk)") - writer.assign(dest.get_ref(member.name), "chunks") - writer.assign("chunks->data_size", nelements) - writer.assign("chunks->flags", 0) - writer.assign("chunks->num_chunks", 1) - writer.assign("chunks->chunk[0].len", nelements) - writer.assign("chunks->chunk[0].data", "in") - writer.increment("in", "%s" % (nelements)) - elif member.has_attr("as_ptr") and t.element_type.is_fixed_nw_size(): - writer.comment("use array as pointer").newline() - writer.assign(dest.get_ref(member.name), "(%s *)in" % t.element_type.c_type()) - len_var = member.attributes["as_ptr"] - if len(len_var) > 0: - writer.assign(dest.get_ref(len_var[0]), nelements) - el_size = t.element_type.get_fixed_nw_size() - if el_size != 1: - writer.increment("in", "%s * %s" % (nelements, el_size)) - else: - writer.increment("in", "%s" % (nelements)) - else: - write_array_parser(writer, member, nelements, t, dest, scope) - elif t.is_struct(): - if member.has_end_attr(): - dest2 = dest.child_at_end(writer, t) - else: - dest2 = dest.child_sub(member.name) - writer.comment(member.name) - write_container_parser(writer, t, dest2) - else: - raise NotImplementedError("TODO can't handle parsing of %s" % t) - -def write_container_parser(writer, container, dest): - with dest.declare(writer) as scope: - for m in container.members: - if m.has_minor_attr(): - writer.begin_block("if (minor >= %s)" % m.get_minor_attr()) - write_member_parser(writer, container, m, dest, scope) - if m.has_minor_attr(): - # We need to zero out the fixed part of all optional fields - if not m.member_type.is_array(): - writer.end_block(newline=False) - writer.begin_block(" else") - # TODO: This is not right for fields that don't exist in the struct - if m.has_attr("zero"): - pass - elif m.member_type.is_primitive(): - writer.assign(dest.get_ref(m.name), "0") - elif m.is_fixed_sizeof(): - writer.statement("memset ((char *)&%s, 0, %s)" % (dest.get_ref(m.name), m.sizeof())) - else: - raise NotImplementedError("TODO Clear optional dynamic fields") - writer.end_block() - -def write_ptr_info_check(writer): - writer.newline() - with writer.index() as index: - with writer.for_loop(index, "n_ptr") as scope: - offset = "ptr_info[%s].offset" % index - function = "ptr_info[%s].parse" % index - dest = "ptr_info[%s].dest" % index - with writer.if_block("%s == 0" % offset, newline=False): - writer.assign("*%s" % dest, "NULL") - with writer.block(" else"): - writer.comment("Align to 32 bit").newline() - writer.assign("end", "(uint8_t *)SPICE_ALIGN((size_t)end, 4)") - writer.assign("*%s" % dest, "(void *)end") - writer.assign("end", "%s(message_start, message_end, end, &ptr_info[%s], minor)" % (function, index)) - writer.error_check("end == NULL") - writer.newline() - -def write_nofree(writer): - if writer.is_generated("helper", "nofree"): - return - writer = writer.function_helper() - scope = writer.function("nofree", "static void", "uint8_t *data") - writer.end_block() - -def write_msg_parser(writer, message): - msg_name = message.c_name() - function_name = "parse_%s" % msg_name - if writer.is_generated("demarshaller", function_name): - return function_name - writer.set_is_generated("demarshaller", function_name) - - msg_type = message.c_type() - msg_sizeof = message.sizeof() - - want_mem_size = (len(message.members) != 1 or message.members[0].is_fixed_nw_size() - or not message.members[0].is_array()) - - writer.newline() - if message.has_attr("ifdef"): - writer.ifdef(message.attributes["ifdef"][0]) - parent_scope = writer.function(function_name, - "uint8_t *", - "uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message", True) - parent_scope.variable_def("SPICE_GNUC_UNUSED uint8_t *", "pos"); - parent_scope.variable_def("uint8_t *", "start = message_start"); - parent_scope.variable_def("uint8_t *", "data = NULL"); - parent_scope.variable_def("size_t", "nw_size") - if want_mem_size: - parent_scope.variable_def("size_t", "mem_size") - if not message.has_attr("nocopy"): - parent_scope.variable_def("uint8_t *", "in", "end"); - num_pointers = message.get_num_pointers() - if num_pointers != 0: - parent_scope.variable_def("SPICE_GNUC_UNUSED intptr_t", "ptr_size"); - parent_scope.variable_def("uint32_t", "n_ptr=0"); - parent_scope.variable_def("PointerInfo", "ptr_info[%s]" % num_pointers) - writer.newline() - - write_parser_helpers(writer) - - write_validate_container(writer, None, message, "start", parent_scope, True, - want_mem_size=want_mem_size, want_extra_size=False) - - writer.newline() - - writer.comment("Check if message fits in reported side").newline() - with writer.block("if (start + nw_size > message_end)"): - writer.statement("return NULL") - - writer.newline().comment("Validated extents and calculated size").newline() - - if message.has_attr("nocopy"): - write_nofree(writer) - writer.assign("data", "message_start") - writer.assign("*size", "message_end - message_start") - writer.assign("*free_message", "nofree") - else: - writer.assign("data", "(uint8_t *)malloc(mem_size)") - writer.error_check("data == NULL") - writer.assign("end", "data + %s" % (msg_sizeof)) - writer.assign("in", "start").newline() - - # avoid defined and assigned but not used warnings of gcc 4.6.0+ - if message.is_extra_size() or not message.is_fixed_nw_size() or message.get_fixed_nw_size() > 0: - dest = RootDemarshallingDestination(None, msg_type, msg_sizeof, "data") - dest.reuse_scope = parent_scope - write_container_parser(writer, message, dest) - - writer.newline() - writer.statement("assert(in <= message_end)") - - if num_pointers != 0: - write_ptr_info_check(writer) - - writer.statement("assert(end <= data + mem_size)") - - writer.newline() - writer.assign("*size", "end - data") - writer.assign("*free_message", "(message_destructor_t) free") - - writer.statement("return data") - writer.newline() - if writer.has_error_check: - writer.label("error") - with writer.block("if (data != NULL)"): - writer.statement("free(data)") - writer.statement("return NULL") - writer.end_block() - - if message.has_attr("ifdef"): - writer.endif(message.attributes["ifdef"][0]) - - return function_name - -def write_channel_parser(writer, channel, server): - writer.newline() - ids = {} - min_id = 1000000 - if server: - messages = channel.server_messages - else: - messages = channel.client_messages - for m in messages: - ids[m.value] = m - - ranges = [] - ids2 = ids.copy() - while len(ids2) > 0: - end = start = min(ids2.keys()) - while ids2.has_key(end): - del ids2[end] - end = end + 1 - - ranges.append( (start, end) ) - - if server: - function_name = "parse_%s_msg" % channel.name - else: - function_name = "parse_%s_msgc" % channel.name - writer.newline() - if channel.has_attr("ifdef"): - writer.ifdef(channel.attributes["ifdef"][0]) - scope = writer.function(function_name, - "static uint8_t *", - "uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message") - - helpers = writer.function_helper() - - d = 0 - for r in ranges: - d = d + 1 - writer.write("static parse_msg_func_t funcs%d[%d] = " % (d, r[1] - r[0])); - writer.begin_block() - for i in range(r[0], r[1]): - func = write_msg_parser(helpers, ids[i].message_type) - writer.write(func) - if i != r[1] -1: - writer.write(",") - writer.newline() - - writer.end_block(semicolon = True) - - d = 0 - for r in ranges: - d = d + 1 - with writer.if_block("message_type >= %d && message_type < %d" % (r[0], r[1]), d > 1, False): - writer.statement("return funcs%d[message_type-%d](message_start, message_end, minor, size_out, free_message)" % (d, r[0])) - writer.newline() - - writer.statement("return NULL") - writer.end_block() - if channel.has_attr("ifdef"): - writer.endif(channel.attributes["ifdef"][0]) - - return function_name - -def write_get_channel_parser(writer, channel_parsers, max_channel, is_server): - writer.newline() - if is_server: - function_name = "spice_get_server_channel_parser" + writer.public_prefix - else: - function_name = "spice_get_client_channel_parser" + writer.public_prefix - - scope = writer.function(function_name, - "spice_parse_channel_func_t", - "uint32_t channel, unsigned int *max_message_type") - - writer.write("static struct {spice_parse_channel_func_t func; unsigned int max_messages; } channels[%d] = " % (max_channel+1)) - writer.begin_block() - channel = None - for i in range(0, max_channel + 1): - if channel_parsers.has_key(i): - channel = channel_parsers[i][0] - if channel.has_attr("ifdef"): - writer.ifdef(channel.attributes["ifdef"][0]) - writer.write("{ ") - writer.write(channel_parsers[i][1]) - writer.write(", ") - - max_msg = 0 - if is_server: - messages = channel.server_messages - else: - messages = channel.client_messages - for m in messages: - max_msg = max(max_msg, m.value) - writer.write(max_msg) - writer.write("}") - else: - writer.write("{ NULL, 0 }") - - if i != max_channel: - writer.write(",") - writer.newline() - if channel and channel.has_attr("ifdef"): - writer.ifdef_else(channel.attributes["ifdef"][0]) - writer.write("{ NULL, 0 }") - if i != max_channel: - writer.write(",") - writer.newline() - writer.endif(channel.attributes["ifdef"][0]) - writer.end_block(semicolon = True) - - with writer.if_block("channel < %d" % (max_channel + 1)): - with writer.if_block("max_message_type != NULL"): - writer.assign("*max_message_type", "channels[channel].max_messages") - writer.statement("return channels[channel].func") - - writer.statement("return NULL") - writer.end_block() - - -def write_full_protocol_parser(writer, is_server): - writer.newline() - if is_server: - function_name = "spice_parse_msg" - else: - function_name = "spice_parse_reply" - scope = writer.function(function_name + writer.public_prefix, - "uint8_t *", - "uint8_t *message_start, uint8_t *message_end, uint32_t channel, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message") - scope.variable_def("spice_parse_channel_func_t", "func" ) - - if is_server: - writer.assign("func", "spice_get_server_channel_parser%s(channel, NULL)" % writer.public_prefix) - else: - writer.assign("func", "spice_get_client_channel_parser%s(channel, NULL)" % writer.public_prefix) - - with writer.if_block("func != NULL"): - writer.statement("return func(message_start, message_end, message_type, minor, size_out, free_message)") - - writer.statement("return NULL") - writer.end_block() - -def write_protocol_parser(writer, proto, is_server): - max_channel = 0 - parsers = {} - - for channel in proto.channels: - max_channel = max(max_channel, channel.value) - - parsers[channel.value] = (channel.channel_type, write_channel_parser(writer, channel.channel_type, is_server)) - - write_get_channel_parser(writer, parsers, max_channel, is_server) - write_full_protocol_parser(writer, is_server) - -def write_includes(writer): - writer.writeln("#include ") - writer.writeln("#include ") - writer.writeln("#include ") - writer.writeln("#include ") - writer.writeln("#include ") - writer.writeln("#include ") - writer.writeln('#include "mem.h"') - writer.newline() - writer.writeln("#ifdef _MSC_VER") - writer.writeln("#pragma warning(disable:4101)") - writer.writeln("#endif") diff -Nru spice-gtk-0.9/python_modules/Makefile.am spice-gtk-0.12/python_modules/Makefile.am --- spice-gtk-0.9/python_modules/Makefile.am 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/python_modules/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -NULL = - -PYTHON_MODULES = __init__.py codegen.py demarshal.py marshal.py ptypes.py spice_parser.py - -EXTRA_DIST = $(PYTHON_MODULES) - -DISTCLEANFILES = *.pyc - --include $(top_srcdir)/git.mk - diff -Nru spice-gtk-0.9/python_modules/Makefile.in spice-gtk-0.12/python_modules/Makefile.in --- spice-gtk-0.9/python_modules/Makefile.in 2012-01-31 10:22:59.000000000 +0000 +++ spice-gtk-0.12/python_modules/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,478 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = python_modules -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/check_python.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/intltool.m4 \ - $(top_srcdir)/m4/ld-version.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ACL_HELPER_DIR = @ACL_HELPER_DIR@ -ACL_LIBS = @ACL_LIBS@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CAIRO_CFLAGS = @CAIRO_CFLAGS@ -CAIRO_LIBS = @CAIRO_LIBS@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CELT051_CFLAGS = @CELT051_CFLAGS@ -CELT051_LIBDIR = @CELT051_LIBDIR@ -CELT051_LIBS = @CELT051_LIBS@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ -GLIB2_CFLAGS = @GLIB2_CFLAGS@ -GLIB2_LIBS = @GLIB2_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GOBJECT2_CFLAGS = @GOBJECT2_CFLAGS@ -GOBJECT2_LIBS = @GOBJECT2_LIBS@ -GREP = @GREP@ -GST_CFLAGS = @GST_CFLAGS@ -GST_LIBS = @GST_LIBS@ -GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ -GTHREAD_LIBS = @GTHREAD_LIBS@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ -GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ -GTKDOC_MKPDF = @GTKDOC_MKPDF@ -GTKDOC_REBASE = @GTKDOC_REBASE@ -GTK_API_VERSION = @GTK_API_VERSION@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -GTK_REQUIRED = @GTK_REQUIRED@ -HTML_DIR = @HTML_DIR@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ -INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ -INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ -INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ -JPEG_LIBS = @JPEG_LIBS@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBM = @LIBM@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PIE_CFLAGS = @PIE_CFLAGS@ -PIE_LDFLAGS = @PIE_LDFLAGS@ -PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ -PIXMAN_LIBS = @PIXMAN_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PNP_IDS = @PNP_IDS@ -POFILES = @POFILES@ -POLICYDIR = @POLICYDIR@ -POLKIT_CFLAGS = @POLKIT_CFLAGS@ -POLKIT_LIBS = @POLKIT_LIBS@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PROTOCOL_CFLAGS = @PROTOCOL_CFLAGS@ -PROTOCOL_LIBS = @PROTOCOL_LIBS@ -PULSE_CFLAGS = @PULSE_CFLAGS@ -PULSE_LIBS = @PULSE_LIBS@ -PYGTK_CFLAGS = @PYGTK_CFLAGS@ -PYGTK_LIBS = @PYGTK_LIBS@ -PYTHON = @PYTHON@ -PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_PLATFORM = @PYTHON_PLATFORM@ -PYTHON_PREFIX = @PYTHON_PREFIX@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -SASL_CFLAGS = @SASL_CFLAGS@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SMARTCARD_CFLAGS = @SMARTCARD_CFLAGS@ -SMARTCARD_LIBS = @SMARTCARD_LIBS@ -SPICE_CFLAGS = @SPICE_CFLAGS@ -SPICE_COMMON_SRCDIR = @SPICE_COMMON_SRCDIR@ -SPICE_GLIB_CFLAGS = @SPICE_GLIB_CFLAGS@ -SPICE_GLIB_REQUIRES = @SPICE_GLIB_REQUIRES@ -SPICE_GTK_API_VERSION = @SPICE_GTK_API_VERSION@ -SPICE_GTK_CFLAGS = @SPICE_GTK_CFLAGS@ -SPICE_GTK_LOCALEDIR = @SPICE_GTK_LOCALEDIR@ -SPICE_GTK_REQUIRES = @SPICE_GTK_REQUIRES@ -SSL_CFLAGS = @SSL_CFLAGS@ -SSL_LIBS = @SSL_LIBS@ -STRIP = @STRIP@ -USBREDIR_CFLAGS = @USBREDIR_CFLAGS@ -USBREDIR_LIBS = @USBREDIR_LIBS@ -USE_NLS = @USE_NLS@ -VALAC = @VALAC@ -VAPIDIR = @VAPIDIR@ -VAPIGEN = @VAPIGEN@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -XRANDR_CFLAGS = @XRANDR_CFLAGS@ -XRANDR_LIBS = @XRANDR_LIBS@ -Z_LIBS = @Z_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgpyexecdir = @pkgpyexecdir@ -pkgpythondir = @pkgpythondir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pyexecdir = @pyexecdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -NULL = -PYTHON_MODULES = __init__.py codegen.py demarshal.py marshal.py ptypes.py spice_parser.py -EXTRA_DIST = $(PYTHON_MODULES) -DISTCLEANFILES = *.pyc -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign python_modules/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign python_modules/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am - - --include $(top_srcdir)/git.mk - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru spice-gtk-0.9/python_modules/marshal.py spice-gtk-0.12/python_modules/marshal.py --- spice-gtk-0.9/python_modules/marshal.py 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/python_modules/marshal.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,424 +0,0 @@ -from __future__ import with_statement -import ptypes -import codegen - -def write_includes(writer): - writer.header.writeln("#include ") - writer.header.writeln("#include ") - writer.header.newline() - writer.header.writeln("#ifndef _GENERATED_HEADERS_H") - writer.header.writeln("#define _GENERATED_HEADERS_H") - - writer.writeln("#include ") - writer.writeln("#include ") - writer.writeln("#include ") - writer.writeln("#include ") - writer.writeln("#include ") - writer.writeln("#include ") - writer.writeln("#include ") - writer.newline() - writer.writeln("#ifdef _MSC_VER") - writer.writeln("#pragma warning(disable:4101)") - writer.writeln("#pragma warning(disable:4018)") - writer.writeln("#endif") - writer.newline() - -class MarshallingSource: - def __init__(self): - pass - - def child_at_end(self, t): - return RootMarshallingSource(self, t.c_type(), t.sizeof()) - - def child_sub(self, containee): - return SubMarshallingSource(self, containee) - - def declare(self, writer): - return writer.optional_block(self.reuse_scope) - - def is_toplevel(self): - return self.parent_src == None and not self.is_helper - -class RootMarshallingSource(MarshallingSource): - def __init__(self, parent_src, c_type, sizeof, pointer = None): - self.is_helper = False - self.reuse_scope = None - self.parent_src = parent_src - if parent_src: - self.base_var = codegen.increment_identifier(parent_src.base_var) - else: - self.base_var = "src" - self.c_type = c_type - self.sizeof = sizeof - self.pointer = pointer - assert pointer != None - - def get_self_ref(self): - return self.base_var - - def get_ref(self, member): - return self.base_var + "->" + member - - def declare(self, writer): - if self.reuse_scope: - scope = self.reuse_scope - else: - writer.begin_block() - scope = writer.get_subwriter() - - scope.variable_def(self.c_type + " *", self.base_var) - if not self.reuse_scope: - scope.newline() - - writer.assign(self.base_var, "(%s *)%s" % (self.c_type, self.pointer)) - writer.newline() - - if self.reuse_scope: - return writer.no_block(self.reuse_scope) - else: - return writer.partial_block(scope) - -class SubMarshallingSource(MarshallingSource): - def __init__(self, parent_src, containee): - self.reuse_scope = None - self.parent_src = parent_src - self.base_var = parent_src.base_var - self.containee = containee - self.name = containee.name - self.is_helper = False - - def get_self_ref(self): - if self.containee.has_attr("to_ptr"): - return "%s" % self.parent_src.get_ref(self.name) - else: - return "&%s" % self.parent_src.get_ref(self.name) - - def get_ref(self, member): - if self.containee.has_attr("to_ptr"): - return self.parent_src.get_ref(self.name) + "->" + member - else: - return self.parent_src.get_ref(self.name) + "." + member - -def write_marshal_ptr_function(writer, target_type): - if target_type.is_array(): - marshal_function = "spice_marshall_array_%s" % target_type.element_type.primitive_type() - else: - marshal_function = "spice_marshall_%s" % target_type.name - if writer.is_generated("marshaller", marshal_function): - return marshal_function - - writer.set_is_generated("marshaller", marshal_function) - - names = target_type.get_pointer_names(False) - names_args = "" - if len(names) > 0: - n = map(lambda name: ", SpiceMarshaller **%s_out" % name, names) - names_args = "".join(n) - - header = writer.header - writer = writer.function_helper() - writer.header = header - writer.out_prefix = "" - if target_type.is_array(): - scope = writer.function(marshal_function, "SPICE_GNUC_UNUSED static void", "SpiceMarshaller *m, %s_t *ptr, unsigned count" % target_type.element_type.primitive_type() + names_args) - else: - scope = writer.function(marshal_function, "void", "SpiceMarshaller *m, %s *ptr" % target_type.c_type() + names_args) - header.writeln("void " + marshal_function + "(SpiceMarshaller *m, %s *msg" % target_type.c_type() + names_args + ");") - scope.variable_def("SPICE_GNUC_UNUSED SpiceMarshaller *", "m2") - - for n in names: - writer.assign("*%s_out" % n, "NULL") - - writer.newline() - - if target_type.is_struct(): - src = RootMarshallingSource(None, target_type.c_type(), target_type.sizeof(), "ptr") - src.reuse_scope = scope - write_container_marshaller(writer, target_type, src) - elif target_type.is_array() and target_type.element_type.is_primitive(): - with writer.index() as index: - with writer.for_loop(index, "count") as array_scope: - writer.statement("spice_marshaller_add_%s(m, *ptr++)" % (target_type.element_type.primitive_type())) - else: - writer.todo("Unsuppored pointer marshaller type") - - writer.end_block() - - return marshal_function - -def get_array_size(array, container_src): - if array.is_constant_length(): - return array.size - elif array.is_identifier_length(): - return container_src.get_ref(array.size) - elif array.is_remaining_length(): - raise NotImplementedError("remaining size array sizes marshalling not supported") - elif array.is_image_size_length(): - bpp = array.size[1] - width = array.size[2] - rows = array.size[3] - width_v = container_src.get_ref(width) - rows_v = container_src.get_ref(rows) - # TODO: Handle multiplication overflow - if bpp == 8: - return "(%s * %s)" % (width_v, rows_v) - elif bpp == 1: - return "(((%s + 7) / 8 ) * %s)" % (width_v, rows_v) - else: - return "(((%s * %s + 7) / 8 ) * %s)" % (bpp, width_v, rows_v) - elif array.is_bytes_length(): - return container_src.get_ref(array.size[2]) - else: - raise NotImplementedError("TODO array size type not handled yet: %s" % array) - -def write_array_marshaller(writer, member, array, container_src, scope): - element_type = array.element_type - - if array.is_remaining_length(): - writer.comment("Remaining data must be appended manually").newline() - return - - nelements = get_array_size(array, container_src) - is_byte_size = array.is_bytes_length() - - element = "%s__element" % member.name - - if not scope.variable_defined(element): - if array.has_attr("ptr_array"): - stars = " **" - else: - stars = " *" - scope.variable_def(element_type.c_type() + stars, element) - element_array = element - if array.has_attr("ptr_array"): - element = "*" + element - - writer.assign(element_array, container_src.get_ref(member.name)) - - if is_byte_size: - size_start_var = "%s__size_start" % member.name - scope.variable_def("size_t", size_start_var) - writer.assign(size_start_var, "spice_marshaller_get_size(m)") - - with writer.index() as index: - with writer.for_loop(index, nelements) as array_scope: - if element_type.is_primitive(): - writer.statement("spice_marshaller_add_%s(m, *%s)" % (element_type.primitive_type(), element)) - elif element_type.is_struct(): - src2 = RootMarshallingSource(container_src, element_type.c_type(), element_type.sizeof(), element) - src2.reuse_scope = array_scope - write_container_marshaller(writer, element_type, src2) - else: - writer.todo("array element unhandled type").newline() - - writer.statement("%s++" % element_array) - - if is_byte_size: - size_var = member.container.lookup_member(array.size[1]) - size_var_type = size_var.member_type - var = "%s__ref" % array.size[1] - writer.statement("spice_marshaller_set_%s(m, %s, spice_marshaller_get_size(m) - %s)" % (size_var_type.primitive_type(), var, size_start_var)) - -def write_pointer_marshaller(writer, member, src): - t = member.member_type - ptr_func = write_marshal_ptr_function(writer, t.target_type) - submarshaller = "spice_marshaller_get_ptr_submarshaller(m, %d)" % (1 if member.get_fixed_nw_size() == 8 else 0) - if member.has_attr("marshall"): - rest_args = "" - if t.target_type.is_array(): - rest_args = ", %s" % get_array_size(t.target_type, src) - writer.assign("m2", submarshaller) - if t.has_attr("nonnull"): - writer.statement("%s(m2, %s%s)" % (ptr_func, src.get_ref(member.name), rest_args)) - else: - with writer.if_block("%s != NULL" % src.get_ref(member.name)) as block: - writer.statement("%s(m2, %s%s)" % (ptr_func, src.get_ref(member.name), rest_args)) - else: - writer.assign("*%s_out" % (writer.out_prefix + member.name), submarshaller) - -def write_switch_marshaller(writer, container, switch, src, scope): - var = container.lookup_member(switch.variable) - var_type = var.member_type - - saved_out_prefix = writer.out_prefix - first = True - for c in switch.cases: - check = c.get_check(src.get_ref(switch.variable), var_type) - m = c.member - writer.out_prefix = saved_out_prefix - if m.has_attr("outvar"): - writer.out_prefix = "%s_%s" % (m.attributes["outvar"][0], writer.out_prefix) - with writer.if_block(check, not first, False) as block: - t = m.member_type - if switch.has_attr("anon"): - if t.is_struct(): - src2 = src.child_sub(m) - else: - src2 = src - else: - if t.is_struct(): - src2 = src.child_sub(switch).child_sub(m) - else: - src2 = src.child_sub(switch) - src2.reuse_scope = block - - if t.is_struct(): - write_container_marshaller(writer, t, src2) - elif t.is_pointer(): - write_pointer_marshaller(writer, m, src2) - elif t.is_primitive(): - if m.has_attr("zero"): - writer.statement("spice_marshaller_add_%s(m, 0)" % (t.primitive_type())) - else: - writer.statement("spice_marshaller_add_%s(m, %s)" % (t.primitive_type(), src2.get_ref(m.name))) - #TODO validate e.g. flags and enums - elif t.is_array(): - write_array_marshaller(writer, m, t, src2, scope) - else: - writer.todo("Can't handle type %s" % m.member_type) - - if switch.has_attr("fixedsize"): - remaining = switch.get_fixed_nw_size() - t.get_fixed_nw_size() - if remaining != 0: - writer.statement("spice_marshaller_reserve_space(m, %s)" % remaining) - - first = False - if switch.has_attr("fixedsize"): - with writer.block(" else"): - writer.statement("spice_marshaller_reserve_space(m, %s)" % switch.get_fixed_nw_size()) - - writer.newline() - -def write_member_marshaller(writer, container, member, src, scope): - if member.has_attr("outvar"): - writer.out_prefix = "%s_%s" % (member.attributes["outvar"][0], writer.out_prefix) - if member.has_attr("virtual"): - writer.comment("Don't marshall @virtual %s" % member.name).newline() - return - if member.has_attr("nomarshal"): - writer.comment("Don't marshall @nomarshal %s" % member.name).newline() - return - if member.is_switch(): - write_switch_marshaller(writer, container, member, src, scope) - return - - t = member.member_type - - if t.is_pointer(): - write_pointer_marshaller(writer, member, src) - elif t.is_primitive(): - if member.has_attr("zero"): - writer.statement("spice_marshaller_add_%s(m, 0)" % (t.primitive_type())) - if member.has_attr("bytes_count"): - var = "%s__ref" % member.name - scope.variable_def("void *", var) - writer.statement("%s = spice_marshaller_add_%s(m, %s)" % (var, t.primitive_type(), 0)) - - else: - writer.statement("spice_marshaller_add_%s(m, %s)" % (t.primitive_type(), src.get_ref(member.name))) - elif t.is_array(): - write_array_marshaller(writer, member, t, src, scope) - elif t.is_struct(): - src2 = src.child_sub(member) - writer.comment(member.name) - write_container_marshaller(writer, t, src2) - else: - raise NotImplementedError("TODO can't handle parsing of %s" % t) - -def write_container_marshaller(writer, container, src): - saved_out_prefix = writer.out_prefix - with src.declare(writer) as scope: - for m in container.members: - writer.out_prefix = saved_out_prefix - write_member_marshaller(writer, container, m, src, scope) - -def write_message_marshaller(writer, message, is_server, private): - if message.has_attr("ifdef"): - writer.ifdef(message.attributes["ifdef"][0]) - writer.out_prefix = "" - function_name = "spice_marshall_" + message.c_name() - if writer.is_generated("marshaller", function_name): - return function_name - writer.set_is_generated("marshaller", function_name) - - names = message.get_pointer_names(False) - names_args = "" - if len(names) > 0: - n = map(lambda name: ", SpiceMarshaller **%s_out" % name, names) - names_args = "".join(n) - - if not private: - writer.header.writeln("void " + function_name + "(SpiceMarshaller *m, %s *msg" % message.c_type() + names_args + ");") - - scope = writer.function(function_name, - "static void" if private else "void", - "SpiceMarshaller *m, %s *msg" % message.c_type() + names_args) - scope.variable_def("SPICE_GNUC_UNUSED SpiceMarshaller *", "m2") - - for n in names: - writer.assign("*%s_out" % n, "NULL") - - # fix warnings about unused variables by not creating body if no members to parse - if any(x.is_fixed_nw_size() for x in message.members): - src = RootMarshallingSource(None, message.c_type(), message.sizeof(), "msg") - src.reuse_scope = scope - - write_container_marshaller(writer, message, src) - - writer.end_block() - if message.has_attr("ifdef"): - writer.endif(message.attributes["ifdef"][0]) - writer.newline() - return function_name - -def write_protocol_marshaller(writer, proto, is_server, private_marshallers): - functions = {} - for c in proto.channels: - channel = c.channel_type - if channel.has_attr("ifdef"): - writer.ifdef(channel.attributes["ifdef"][0]) - if is_server: - for m in channel.client_messages: - message = m.message_type - f = write_message_marshaller(writer, message, is_server, private_marshallers) - if channel.has_attr("ifdef") and not functions.has_key(f): - functions[f] = channel.attributes["ifdef"][0] - elif message.has_attr("ifdef") and not functions.has_key(f): - functions[f] = message.attributes["ifdef"][0] - else: - functions[f] = True - else: - for m in channel.server_messages: - message = m.message_type - f = write_message_marshaller(writer, message, is_server, private_marshallers) - if channel.has_attr("ifdef") and not functions.has_key(f): - functions[f] = channel.attributes["ifdef"][0] - elif message.has_attr("ifdef") and not functions.has_key(f): - functions[f] = message.attributes["ifdef"][0] - else: - functions[f] = True - if channel.has_attr("ifdef"): - writer.endif(channel.attributes["ifdef"][0]) - - if private_marshallers: - scope = writer.function("spice_message_marshallers_get" + writer.public_prefix, - "SpiceMessageMarshallers *", - "void") - writer.writeln("static SpiceMessageMarshallers marshallers = {NULL};").newline() - for f in sorted(functions.keys()): - member = f[len("spice_marshall_"):] - if not member.startswith("msg"): - member = "msg_" + member - if functions[f] != True: - writer.ifdef(functions[f]) - writer.assign("marshallers.%s" % member, f) - if functions[f] != True: - writer.endif(functions[f]) - - writer.newline() - writer.statement("return &marshallers") - writer.end_block() - writer.newline() - -def write_trailer(writer): - writer.header.writeln("#endif") diff -Nru spice-gtk-0.9/python_modules/ptypes.py spice-gtk-0.12/python_modules/ptypes.py --- spice-gtk-0.9/python_modules/ptypes.py 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/python_modules/ptypes.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,1034 +0,0 @@ -import codegen -import types - -_types_by_name = {} -_types = [] - -default_pointer_size = 4 - -def type_exists(name): - return _types_by_name.has_key(name) - -def lookup_type(name): - return _types_by_name[name] - -def get_named_types(): - return _types - -class FixedSize: - def __init__(self, val = 0, minor = 0): - if isinstance(val, FixedSize): - self.vals = val.vals - else: - self.vals = [0] * (minor + 1) - self.vals[minor] = val - - def __add__(self, other): - if isinstance(other, types.IntType): - other = FixedSize(other) - - new = FixedSize() - l = max(len(self.vals), len(other.vals)) - shared = min(len(self.vals), len(other.vals)) - - new.vals = [0] * l - - for i in range(shared): - new.vals[i] = self.vals[i] + other.vals[i] - - for i in range(shared,len(self.vals)): - new.vals[i] = self.vals[i]; - - for i in range(shared,len(other.vals)): - new.vals[i] = new.vals[i] + other.vals[i]; - - return new - - def __radd__(self, other): - return self.__add__(other) - - def __str__(self): - s = "%d" % (self.vals[0]) - - for i in range(1,len(self.vals)): - if self.vals[i] > 0: - s = s + " + ((minor >= %d)?%d:0)" % (i, self.vals[i]) - return s - -# Some attribute are propagated from member to the type as they really -# are part of the type definition, rather than the member. This applies -# only to attributes that affect pointer or array attributes, as these -# are member local types, unlike e.g. a Struct that may be used by -# other members -propagated_attributes=["ptr_array", "nonnull", "chunk"] - -class Type: - def __init__(self): - self.attributes = {} - self.registred = False - self.name = None - - def has_name(self): - return self.name != None - - def get_type(self, recursive=False): - return self - - def is_primitive(self): - return False - - def is_fixed_sizeof(self): - return True - - def is_extra_size(self): - return False - - def contains_extra_size(self): - return False - - def is_fixed_nw_size(self): - return True - - def is_array(self): - return isinstance(self, ArrayType) - - def contains_member(self, member): - return False - - def is_struct(self): - return isinstance(self, StructType) - - def is_pointer(self): - return isinstance(self, PointerType) - - def get_num_pointers(self): - return 0 - - def get_pointer_names(self, marshalled): - return [] - - def sizeof(self): - return "sizeof(%s)" % (self.c_type()) - - def __repr__(self): - return self.__str__() - - def __str__(self): - if self.name != None: - return self.name - return "anonymous type" - - def resolve(self): - return self - - def register(self): - if self.registred or self.name == None: - return - self.registred = True - if _types_by_name.has_key(self.name): - raise Exception, "Type %s already defined" % self.name - _types.append(self) - _types_by_name[self.name] = self - - def has_attr(self, name): - return self.attributes.has_key(name) - -class TypeRef(Type): - def __init__(self, name): - Type.__init__(self) - self.name = name - - def __str__(self): - return "ref to %s" % (self.name) - - def resolve(self): - if not _types_by_name.has_key(self.name): - raise Exception, "Unknown type %s" % self.name - return _types_by_name[self.name] - - def register(self): - assert True, "Can't register TypeRef!" - - -class IntegerType(Type): - def __init__(self, bits, signed): - Type.__init__(self) - self.bits = bits - self.signed = signed - - if signed: - self.name = "int%d" % bits - else: - self.name = "uint%d" % bits - - def primitive_type(self): - return self.name - - def c_type(self): - return self.name + "_t" - - def get_fixed_nw_size(self): - return self.bits / 8 - - def is_primitive(self): - return True - -class TypeAlias(Type): - def __init__(self, name, the_type, attribute_list): - Type.__init__(self) - self.name = name - self.the_type = the_type - for attr in attribute_list: - self.attributes[attr[0][1:]] = attr[1:] - - def get_type(self, recursive=False): - if recursive: - return self.the_type.get_type(True) - else: - return self.the_type - - def primitive_type(self): - return self.the_type.primitive_type() - - def resolve(self): - self.the_type = self.the_type.resolve() - return self - - def __str__(self): - return "alias %s" % self.name - - def is_primitive(self): - return self.the_type.is_primitive() - - def is_fixed_sizeof(self): - return self.the_type.is_fixed_sizeof() - - def is_fixed_nw_size(self): - return self.the_type.is_fixed_nw_size() - - def get_fixed_nw_size(self): - return self.the_type.get_fixed_nw_size() - - def get_num_pointers(self): - return self.the_type.get_num_pointers() - - def get_pointer_names(self, marshalled): - return self.the_type.get_pointer_names(marshalled) - - def c_type(self): - if self.has_attr("ctype"): - return self.attributes["ctype"][0] - return self.name - -class EnumBaseType(Type): - def is_enum(self): - return isinstance(self, EnumType) - - def primitive_type(self): - return "uint%d" % (self.bits) - - def c_type(self): - return "uint%d_t" % (self.bits) - - def c_name(self): - return codegen.prefix_camel(self.name) - - def c_enumname(self, value): - self.c_enumname_by_name(self.names[value]) - - def c_enumname_by_name(self, name): - if self.has_attr("prefix"): - return self.attributes["prefix"][0] + name - return codegen.prefix_underscore_upper(self.name.upper(), name) - - def is_primitive(self): - return True - - def get_fixed_nw_size(self): - return self.bits / 8 - -class EnumType(EnumBaseType): - def __init__(self, bits, name, enums, attribute_list): - Type.__init__(self) - self.bits = bits - self.name = name - - last = -1 - names = {} - values = {} - for v in enums: - name = v[0] - if len(v) > 1: - value = v[1] - else: - value = last + 1 - last = value - - assert not names.has_key(value) - names[value] = name - values[name] = value - - self.names = names - self.values = values - - for attr in attribute_list: - self.attributes[attr[0][1:]] = attr[1:] - - def __str__(self): - return "enum %s" % self.name - - def c_define(self, writer): - writer.write("enum ") - writer.write(self.c_name()) - writer.begin_block() - values = self.names.keys() - values.sort() - current_default = 0 - for i in values: - writer.write(self.c_enumname(i)) - if i != current_default: - writer.write(" = %d" % (i)) - writer.write(",") - writer.newline() - current_default = i + 1 - writer.newline() - writer.write(codegen.prefix_underscore_upper(self.name.upper(), "ENUM_END")) - writer.newline() - writer.end_block(semicolon=True) - writer.newline() - -class FlagsType(EnumBaseType): - def __init__(self, bits, name, flags, attribute_list): - Type.__init__(self) - self.bits = bits - self.name = name - - last = -1 - names = {} - values = {} - for v in flags: - name = v[0] - if len(v) > 1: - value = v[1] - else: - value = last + 1 - last = value - - assert not names.has_key(value) - names[value] = name - values[name] = value - - self.names = names - self.values = values - - for attr in attribute_list: - self.attributes[attr[0][1:]] = attr[1:] - - def __str__(self): - return "flags %s" % self.name - - def c_define(self, writer): - writer.write("enum ") - writer.write(self.c_name()) - writer.begin_block() - values = self.names.keys() - values.sort() - mask = 0 - for i in values: - writer.write(self.c_enumname(i)) - mask = mask | (1< 0 - - def is_image_size_length(self): - if isinstance(self.size, types.IntType) or isinstance(self.size, types.StringType): - return False - return self.size[0] == "image_size" - - def is_bytes_length(self): - if isinstance(self.size, types.IntType) or isinstance(self.size, types.StringType): - return False - return self.size[0] == "bytes" - - def is_cstring_length(self): - if isinstance(self.size, types.IntType) or isinstance(self.size, types.StringType): - return False - return self.size[0] == "cstring" - - def is_fixed_sizeof(self): - return self.is_constant_length() and self.element_type.is_fixed_sizeof() - - def is_fixed_nw_size(self): - return self.is_constant_length() and self.element_type.is_fixed_nw_size() - - def get_fixed_nw_size(self): - if not self.is_fixed_nw_size(): - raise Exception, "Not a fixed size type" - - return self.element_type.get_fixed_nw_size() * self.size - - def get_num_pointers(self): - element_count = self.element_type.get_num_pointers() - if element_count == 0: - return 0 - if self.is_constant_length(self): - return element_count * self.size - raise Exception, "Pointers in dynamic arrays not supported" - - def get_pointer_names(self, marshalled): - element_count = self.element_type.get_num_pointers() - if element_count == 0: - return [] - raise Exception, "Pointer names in arrays not supported" - - def is_extra_size(self): - return self.has_attr("ptr_array") - - def contains_extra_size(self): - return self.element_type.contains_extra_size() or self.has_attr("chunk") - - def sizeof(self): - return "%s * %s" % (self.element_type.sizeof(), self.size) - - def c_type(self): - return self.element_type.c_type() - -class PointerType(Type): - def __init__(self, target_type): - Type.__init__(self) - self.name = None - self.target_type = target_type - self.pointer_size = default_pointer_size - - def __str__(self): - return "%s*" % (str(self.target_type)) - - def resolve(self): - self.target_type = self.target_type.resolve() - return self - - def set_ptr_size(self, new_size): - self.pointer_size = new_size - - def is_fixed_nw_size(self): - return True - - def is_primitive(self): - return True - - def primitive_type(self): - if self.pointer_size == 4: - return "uint32" - else: - return "uint64" - - def get_fixed_nw_size(self): - return self.pointer_size - - def c_type(self): - if self.pointer_size == 4: - return "uint32_t" - else: - return "uint64_t" - - def contains_extra_size(self): - return True - - def get_num_pointers(self): - return 1 - -class Containee: - def __init__(self): - self.attributes = {} - - def is_switch(self): - return False - - def is_pointer(self): - return not self.is_switch() and self.member_type.is_pointer() - - def is_array(self): - return not self.is_switch() and self.member_type.is_array() - - def is_struct(self): - return not self.is_switch() and self.member_type.is_struct() - - def is_primitive(self): - return not self.is_switch() and self.member_type.is_primitive() - - def has_attr(self, name): - return self.attributes.has_key(name) - - def has_minor_attr(self): - return self.has_attr("minor") - - def has_end_attr(self): - return self.has_attr("end") - - def get_minor_attr(self): - return self.attributes["minor"][0] - -class Member(Containee): - def __init__(self, name, member_type, attribute_list): - Containee.__init__(self) - self.name = name - self.member_type = member_type - for attr in attribute_list: - self.attributes[attr[0][1:]] = attr[1:] - - def resolve(self, container): - self.container = container - self.member_type = self.member_type.resolve() - self.member_type.register() - if self.has_attr("ptr32") and self.member_type.is_pointer(): - self.member_type.set_ptr_size(4) - for i in propagated_attributes: - if self.has_attr(i): - self.member_type.attributes[i] = self.attributes[i] - return self - - def contains_member(self, member): - return self.member_type.contains_member(member) - - def is_primitive(self): - return self.member_type.is_primitive() - - def is_fixed_sizeof(self): - if self.has_end_attr(): - return False - return self.member_type.is_fixed_sizeof() - - def is_extra_size(self): - return self.has_end_attr() or self.has_attr("to_ptr") or self.member_type.is_extra_size() - - def is_fixed_nw_size(self): - if self.has_attr("virtual"): - return True - return self.member_type.is_fixed_nw_size() - - def get_fixed_nw_size(self): - if self.has_attr("virtual"): - return 0 - size = self.member_type.get_fixed_nw_size() - if self.has_minor_attr(): - minor = self.get_minor_attr() - size = FixedSize(size, minor) - return size - - def contains_extra_size(self): - return self.member_type.contains_extra_size() - - def sizeof(self): - return self.member_type.sizeof() - - def __repr__(self): - return "%s (%s)" % (str(self.name), str(self.member_type)) - - def get_num_pointers(self): - if self.has_attr("to_ptr"): - return 1 - return self.member_type.get_num_pointers() - - def get_pointer_names(self, marshalled): - if self.member_type.is_pointer(): - if self.has_attr("marshall") == marshalled: - names = [self.name] - else: - names = [] - else: - names = self.member_type.get_pointer_names(marshalled) - if self.has_attr("outvar"): - prefix = self.attributes["outvar"][0] - names = map(lambda name: prefix + "_" + name, names) - return names - -class SwitchCase: - def __init__(self, values, member): - self.values = values - self.member = member - self.members = [member] - - def get_check(self, var_cname, var_type): - checks = [] - for v in self.values: - if v == None: - return "1" - elif var_type.is_enum(): - checks.append("%s == %s" % (var_cname, var_type.c_enumname_by_name(v[1]))) - else: - checks.append("%s(%s & %s)" % (v[0], var_cname, var_type.c_enumname_by_name(v[1]))) - return " || ".join(checks) - - def resolve(self, container): - self.switch = container - self.member = self.member.resolve(self) - return self - - def get_num_pointers(self): - return self.member.get_num_pointers() - - def get_pointer_names(self, marshalled): - return self.member.get_pointer_names(marshalled) - -class Switch(Containee): - def __init__(self, variable, cases, name, attribute_list): - Containee.__init__(self) - self.variable = variable - self.name = name - self.cases = cases - for attr in attribute_list: - self.attributes[attr[0][1:]] = attr[1:] - - def is_switch(self): - return True - - def lookup_case_member(self, name): - for c in self.cases: - if c.member.name == name: - return c.member - return None - - def has_switch_member(self, member): - for c in self.cases: - if c.member == member: - return True - return False - - def resolve(self, container): - self.container = container - self.cases = map(lambda c : c.resolve(self), self.cases) - return self - - def __repr__(self): - return "switch on %s %s" % (str(self.variable),str(self.name)) - - def is_fixed_sizeof(self): - # Kinda weird, but we're unlikely to have a real struct if there is an @end - if self.has_end_attr(): - return False - return True - - def is_fixed_nw_size(self): - if self.has_attr("fixedsize"): - return True - - size = None - has_default = False - for c in self.cases: - for v in c.values: - if v == None: - has_default = True - if not c.member.is_fixed_nw_size(): - return False - if size == None: - size = c.member.get_fixed_nw_size() - elif size != c.member.get_fixed_nw_size(): - return False - # Fixed size if all elements listed, or has default - if has_default: - return True - key = self.container.lookup_member(self.variable) - return len(self.cases) == len(key.member_type.values) - - def is_extra_size(self): - return self.has_end_attr() - - def contains_extra_size(self): - for c in self.cases: - if c.member.is_extra_size(): - return True - if c.member.contains_extra_size(): - return True - return False - - def get_fixed_nw_size(self): - if not self.is_fixed_nw_size(): - raise Exception, "Not a fixed size type" - size = 0; - for c in self.cases: - size = max(size, c.member.get_fixed_nw_size()) - return size - - def sizeof(self): - return "sizeof(((%s *)NULL)->%s)" % (self.container.c_type(), - self.name) - - def contains_member(self, member): - return False # TODO: Don't support switch deep member lookup yet - - def get_num_pointers(self): - count = 0 - for c in self.cases: - count = max(count, c.get_num_pointers()) - return count - - def get_pointer_names(self, marshalled): - names = [] - for c in self.cases: - names = names + c.get_pointer_names(marshalled) - return names - -class ContainerType(Type): - def is_fixed_sizeof(self): - for m in self.members: - if not m.is_fixed_sizeof(): - return False - return True - - def contains_extra_size(self): - for m in self.members: - if m.is_extra_size(): - return True - if m.contains_extra_size(): - return True - return False - - def is_fixed_nw_size(self): - for i in self.members: - if not i.is_fixed_nw_size(): - return False - return True - - def get_fixed_nw_size(self): - size = 0 - for i in self.members: - size = size + i.get_fixed_nw_size() - return size - - def contains_member(self, member): - for m in self.members: - if m == member or m.contains_member(member): - return True - return False - - def get_fixed_nw_offset(self, member): - size = 0 - for i in self.members: - if i == member: - break - if i.contains_member(member): - size = size + i.member_type.get_fixed_nw_offset(member) - break - if i.is_fixed_nw_size(): - size = size + i.get_fixed_nw_size() - return size - - def resolve(self): - self.members = map(lambda m : m.resolve(self), self.members) - return self - - def get_num_pointers(self): - count = 0 - for m in self.members: - count = count + m.get_num_pointers() - return count - - def get_pointer_names(self, marshalled): - names = [] - for m in self.members: - names = names + m.get_pointer_names(marshalled) - return names - - def get_nw_offset(self, member, prefix = "", postfix = ""): - fixed = self.get_fixed_nw_offset(member) - v = [] - container = self - while container != None: - members = container.members - container = None - for m in members: - if m == member: - break - if m.contains_member(member): - container = m.member_type - break - if m.is_switch() and m.has_switch_member(member): - break - if not m.is_fixed_nw_size(): - v.append(prefix + m.name + postfix) - if len(v) > 0: - return str(fixed) + " + " + (" + ".join(v)) - else: - return str(fixed) - - def lookup_member(self, name): - dot = name.find('.') - rest = None - if dot >= 0: - rest = name[dot+1:] - name = name[:dot] - - member = None - if self.members_by_name.has_key(name): - member = self.members_by_name[name] - else: - for m in self.members: - if m.is_switch(): - member = m.lookup_case_member(name) - if member != None: - break - if member != None: - break - - if member == None: - raise Exception, "No member called %s found" % name - - if rest != None: - return member.member_type.lookup_member(rest) - - return member - -class StructType(ContainerType): - def __init__(self, name, members, attribute_list): - Type.__init__(self) - self.name = name - self.members = members - self.members_by_name = {} - for m in members: - self.members_by_name[m.name] = m - for attr in attribute_list: - self.attributes[attr[0][1:]] = attr[1:] - - def __str__(self): - if self.name == None: - return "anonymous struct" - else: - return "struct %s" % self.name - - def c_type(self): - if self.has_attr("ctype"): - return self.attributes["ctype"][0] - return codegen.prefix_camel(self.name) - -class MessageType(ContainerType): - def __init__(self, name, members, attribute_list): - Type.__init__(self) - self.name = name - self.members = members - self.members_by_name = {} - for m in members: - self.members_by_name[m.name] = m - self.reverse_members = {} # ChannelMembers referencing this message - for attr in attribute_list: - self.attributes[attr[0][1:]] = attr[1:] - - def __str__(self): - if self.name == None: - return "anonymous message" - else: - return "message %s" % self.name - - def c_name(self): - if self.name == None: - cms = self.reverse_members.keys() - if len(cms) != 1: - raise "Unknown typename for message" - cm = cms[0] - channelname = cm.channel.member_name - if channelname == None: - channelname = "" - else: - channelname = channelname + "_" - if cm.is_server: - return "msg_" + channelname + cm.name - else: - return "msgc_" + channelname + cm.name - else: - return codegen.prefix_camel("Msg", self.name) - - def c_type(self): - if self.has_attr("ctype"): - return self.attributes["ctype"][0] - if self.name == None: - cms = self.reverse_members.keys() - if len(cms) != 1: - raise "Unknown typename for message" - cm = cms[0] - channelname = cm.channel.member_name - if channelname == None: - channelname = "" - if cm.is_server: - return codegen.prefix_camel("Msg", channelname, cm.name) - else: - return codegen.prefix_camel("Msgc", channelname, cm.name) - else: - return codegen.prefix_camel("Msg", self.name) - -class ChannelMember(Containee): - def __init__(self, name, message_type, value): - Containee.__init__(self) - self.name = name - self.message_type = message_type - self.value = value - - def resolve(self, channel): - self.channel = channel - self.message_type = self.message_type.resolve() - self.message_type.reverse_members[self] = 1 - - return self - - def __repr__(self): - return "%s (%s)" % (str(self.name), str(self.message_type)) - -class ChannelType(Type): - def __init__(self, name, base, members, attribute_list): - Type.__init__(self) - self.name = name - self.base = base - self.member_name = None - self.members = members - for attr in attribute_list: - self.attributes[attr[0][1:]] = attr[1:] - - def __str__(self): - if self.name == None: - return "anonymous channel" - else: - return "channel %s" % self.name - - def is_fixed_nw_size(self): - return False - - def get_client_message(self, name): - return self.client_messages_byname[name] - - def get_server_message(self, name): - return self.server_messages_byname[name] - - def resolve(self): - if self.base != None: - self.base = self.base.resolve() - - server_messages = self.base.server_messages[:] - server_messages_byname = self.base.server_messages_byname.copy() - client_messages = self.base.client_messages[:] - client_messages_byname = self.base.client_messages_byname.copy() - else: - server_messages = [] - server_messages_byname = {} - client_messages = [] - client_messages_byname = {} - - server_count = 1 - client_count = 1 - - server = True - for m in self.members: - if m == "server": - server = True - elif m == "client": - server = False - elif server: - m.is_server = True - m = m.resolve(self) - if m.value: - server_count = m.value + 1 - else: - m.value = server_count - server_count = server_count + 1 - server_messages.append(m) - server_messages_byname[m.name] = m - else: - m.is_server = False - m = m.resolve(self) - if m.value: - client_count = m.value + 1 - else: - m.value = client_count - client_count = client_count + 1 - client_messages.append(m) - client_messages_byname[m.name] = m - - self.server_messages = server_messages - self.server_messages_byname = server_messages_byname - self.client_messages = client_messages - self.client_messages_byname = client_messages_byname - - return self - -class ProtocolMember: - def __init__(self, name, channel_type, value): - self.name = name - self.channel_type = channel_type - self.value = value - - def resolve(self, protocol): - self.channel_type = self.channel_type.resolve() - assert(self.channel_type.member_name == None) - self.channel_type.member_name = self.name - return self - - def __repr__(self): - return "%s (%s)" % (str(self.name), str(self.channel_type)) - -class ProtocolType(Type): - def __init__(self, name, channels): - Type.__init__(self) - self.name = name - self.channels = channels - - def __str__(self): - if self.name == None: - return "anonymous protocol" - else: - return "protocol %s" % self.name - - def is_fixed_nw_size(self): - return False - - def resolve(self): - count = 1 - for m in self.channels: - m = m.resolve(self) - if m.value: - count = m.value + 1 - else: - m.value = count - count = count + 1 - - return self - -int8 = IntegerType(8, True) -uint8 = IntegerType(8, False) -int16 = IntegerType(16, True) -uint16 = IntegerType(16, False) -int32 = IntegerType(32, True) -uint32 = IntegerType(32, False) -int64 = IntegerType(64, True) -uint64 = IntegerType(64, False) diff -Nru spice-gtk-0.9/python_modules/spice_parser.py spice-gtk-0.12/python_modules/spice_parser.py --- spice-gtk-0.9/python_modules/spice_parser.py 2012-01-27 08:56:56.000000000 +0000 +++ spice-gtk-0.12/python_modules/spice_parser.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ -try: - from pyparsing import Literal, CaselessLiteral, Word, OneOrMore, ZeroOrMore, \ - Forward, delimitedList, Group, Optional, Combine, alphas, nums, restOfLine, cStyleComment, \ - alphanums, ParseException, ParseResults, Keyword, StringEnd, replaceWith -except ImportError: - print "Module pyparsing not found." - exit(1) - -import ptypes -import sys - -cvtInt = lambda toks: int(toks[0]) - -def parseVariableDef(toks): - t = toks[0][0] - pointer = toks[0][1] - name = toks[0][2] - array_size = toks[0][3] - attributes = toks[0][4] - - if array_size != None: - t = ptypes.ArrayType(t, array_size) - - if pointer != None: - t = ptypes.PointerType(t); - - return ptypes.Member(name, t, attributes) - -bnf = None -def SPICE_BNF(): - global bnf - - if not bnf: - - # punctuation - colon = Literal(":").suppress() - lbrace = Literal("{").suppress() - rbrace = Literal("}").suppress() - lbrack = Literal("[").suppress() - rbrack = Literal("]").suppress() - lparen = Literal("(").suppress() - rparen = Literal(")").suppress() - equals = Literal("=").suppress() - comma = Literal(",").suppress() - semi = Literal(";").suppress() - - # primitive types - int8_ = Keyword("int8").setParseAction(replaceWith(ptypes.int8)) - uint8_ = Keyword("uint8").setParseAction(replaceWith(ptypes.uint8)) - int16_ = Keyword("int16").setParseAction(replaceWith(ptypes.int16)) - uint16_ = Keyword("uint16").setParseAction(replaceWith(ptypes.uint16)) - int32_ = Keyword("int32").setParseAction(replaceWith(ptypes.int32)) - uint32_ = Keyword("uint32").setParseAction(replaceWith(ptypes.uint32)) - int64_ = Keyword("int64").setParseAction(replaceWith(ptypes.int64)) - uint64_ = Keyword("uint64").setParseAction(replaceWith(ptypes.uint64)) - - # keywords - channel_ = Keyword("channel") - enum32_ = Keyword("enum32").setParseAction(replaceWith(32)) - enum16_ = Keyword("enum16").setParseAction(replaceWith(16)) - enum8_ = Keyword("enum8").setParseAction(replaceWith(8)) - flags32_ = Keyword("flags32").setParseAction(replaceWith(32)) - flags16_ = Keyword("flags16").setParseAction(replaceWith(16)) - flags8_ = Keyword("flags8").setParseAction(replaceWith(8)) - channel_ = Keyword("channel") - server_ = Keyword("server") - client_ = Keyword("client") - protocol_ = Keyword("protocol") - typedef_ = Keyword("typedef") - struct_ = Keyword("struct") - message_ = Keyword("message") - image_size_ = Keyword("image_size") - bytes_ = Keyword("bytes") - cstring_ = Keyword("cstring") - switch_ = Keyword("switch") - default_ = Keyword("default") - case_ = Keyword("case") - - identifier = Word( alphas, alphanums + "_" ) - enumname = Word( alphanums + "_" ) - - integer = ( Combine( CaselessLiteral("0x") + Word( nums+"abcdefABCDEF" ) ) | - Word( nums+"+-", nums ) ).setName("int").setParseAction(cvtInt) - - typename = identifier.copy().setParseAction(lambda toks : ptypes.TypeRef(str(toks[0]))) - - # This is just normal "types", i.e. not channels or messages - typeSpec = Forward() - - attributeValue = integer ^ identifier - attribute = Group(Combine ("@" + identifier) + Optional(lparen + delimitedList(attributeValue) + rparen)) - attributes = Group(ZeroOrMore(attribute)) - arraySizeSpecImage = Group(image_size_ + lparen + integer + comma + identifier + comma + identifier + rparen) - arraySizeSpecBytes = Group(bytes_ + lparen + identifier + comma + identifier + rparen) - arraySizeSpecCString = Group(cstring_ + lparen + rparen) - arraySizeSpec = lbrack + Optional(identifier ^ integer ^ arraySizeSpecImage ^ arraySizeSpecBytes ^arraySizeSpecCString, default="") + rbrack - variableDef = Group(typeSpec + Optional("*", default=None) + identifier + Optional(arraySizeSpec, default=None) + attributes - semi) \ - .setParseAction(parseVariableDef) - - switchCase = Group(Group(OneOrMore(default_.setParseAction(replaceWith(None)) + colon | Group(case_.suppress() + Optional("!", default="") + identifier) + colon)) + variableDef) \ - .setParseAction(lambda toks: ptypes.SwitchCase(toks[0][0], toks[0][1])) - switchBody = Group(switch_ + lparen + delimitedList(identifier,delim='.', combine=True) + rparen + lbrace + Group(OneOrMore(switchCase)) + rbrace + identifier + attributes - semi) \ - .setParseAction(lambda toks: ptypes.Switch(toks[0][1], toks[0][2], toks[0][3], toks[0][4])) - messageBody = structBody = Group(lbrace + ZeroOrMore(variableDef | switchBody) + rbrace) - structSpec = Group(struct_ + identifier + structBody + attributes).setParseAction(lambda toks: ptypes.StructType(toks[0][1], toks[0][2], toks[0][3])) - - # have to use longest match for type, in case a user-defined type name starts with a keyword type, like "channel_type" - typeSpec << ( structSpec ^ int8_ ^ uint8_ ^ int16_ ^ uint16_ ^ - int32_ ^ uint32_ ^ int64_ ^ uint64_ ^ - typename).setName("type") - - flagsBody = enumBody = Group(lbrace + delimitedList(Group (enumname + Optional(equals + integer))) + Optional(comma) + rbrace) - - messageSpec = Group(message_ + messageBody + attributes).setParseAction(lambda toks: ptypes.MessageType(None, toks[0][1], toks[0][2])) | typename - - channelParent = Optional(colon + typename, default=None) - channelMessage = Group(messageSpec + identifier + Optional(equals + integer, default=None) + semi) \ - .setParseAction(lambda toks: ptypes.ChannelMember(toks[0][1], toks[0][0], toks[0][2])) - channelBody = channelParent + Group(lbrace + ZeroOrMore( server_ + colon | client_ + colon | channelMessage) + rbrace) - - enum_ = (enum32_ | enum16_ | enum8_) - flags_ = (flags32_ | flags16_ | flags8_) - enumDef = Group(enum_ + identifier + enumBody + attributes - semi).setParseAction(lambda toks: ptypes.EnumType(toks[0][0], toks[0][1], toks[0][2], toks[0][3])) - flagsDef = Group(flags_ + identifier + flagsBody + attributes - semi).setParseAction(lambda toks: ptypes.FlagsType(toks[0][0], toks[0][1], toks[0][2], toks[0][3])) - messageDef = Group(message_ + identifier + messageBody + attributes - semi).setParseAction(lambda toks: ptypes.MessageType(toks[0][1], toks[0][2], toks[0][3])) - channelDef = Group(channel_ + identifier + channelBody + attributes - semi).setParseAction(lambda toks: ptypes.ChannelType(toks[0][1], toks[0][2], toks[0][3], toks[0][4])) - structDef = Group(struct_ + identifier + structBody + attributes - semi).setParseAction(lambda toks: ptypes.StructType(toks[0][1], toks[0][2], toks[0][3])) - typedefDef = Group(typedef_ + identifier + typeSpec + attributes - semi).setParseAction(lambda toks: ptypes.TypeAlias(toks[0][1], toks[0][2], toks[0][3])) - - definitions = typedefDef | structDef | enumDef | flagsDef | messageDef | channelDef - - protocolChannel = Group(typename + identifier + Optional(equals + integer, default=None) + semi) \ - .setParseAction(lambda toks: ptypes.ProtocolMember(toks[0][1], toks[0][0], toks[0][2])) - protocolDef = Group(protocol_ + identifier + Group(lbrace + ZeroOrMore(protocolChannel) + rbrace) + semi) \ - .setParseAction(lambda toks: ptypes.ProtocolType(toks[0][1], toks[0][2])) - - bnf = ZeroOrMore (definitions) + protocolDef + StringEnd() - - singleLineComment = "//" + restOfLine - bnf.ignore( singleLineComment ) - bnf.ignore( cStyleComment ) - - return bnf - - -def parse(filename): - try: - bnf = SPICE_BNF() - types = bnf.parseFile(filename) - except ParseException, err: - print >> sys.stderr, err.line - print >> sys.stderr, " "*(err.column-1) + "^" - print >> sys.stderr, err - return None - - for t in types: - t.resolve() - t.register() - protocol = types[-1] - return protocol - diff -Nru spice-gtk-0.9/README spice-gtk-0.12/README --- spice-gtk-0.9/README 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/README 2012-04-21 18:46:09.000000000 +0000 @@ -55,7 +55,7 @@ . If you build from git, you'll also need: -libtool automake pyparsing vala perl-Text-CSV +libtool automake vala perl-Text-CSV current state diff -Nru spice-gtk-0.9/spice1.proto spice-gtk-0.12/spice1.proto --- spice-gtk-0.9/spice1.proto 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/spice1.proto 1970-01-01 00:00:00.000000000 +0000 @@ -1,934 +0,0 @@ -/* built in types: - int8, uint8, 16, 32, 64 -*/ - -typedef fixed28_4 int32 @ctype(SPICE_FIXED28_4); - -struct Point { - int32 x; - int32 y; -}; - -struct Point16 { - int16 x; - int16 y; -}; - -struct PointFix { - fixed28_4 x; - fixed28_4 y; -}; - -struct Rect { - int32 top; - int32 left; - int32 bottom; - int32 right; -}; - -enum32 link_err { - OK, - ERROR, - INVALID_MAGIC, - INVALID_DATA, - VERSION_MISMATCH, - NEED_SECURED, - NEED_UNSECURED, - PERMISSION_DENIED, - BAD_CONNECTION_ID, - CHANNEL_NOT_AVAILABLE -}; - -enum32 warn_code { - WARN_GENERAL -} @prefix(SPICE_); - -enum32 info_code { - INFO_GENERAL -} @prefix(SPICE_); - -flags32 migrate_flags { - NEED_FLUSH, - NEED_DATA_TRANSFER -} @prefix(SPICE_MIGRATE_); - -enum32 notify_severity { - INFO, - WARN, - ERROR, -}; - -enum32 notify_visibility { - LOW, - MEDIUM, - HIGH, -}; - -flags32 mouse_mode { - SERVER, - CLIENT, -}; - -enum16 pubkey_type { - INVALID, - RSA, - RSA2, - DSA, - DSA1, - DSA2, - DSA3, - DSA4, - DH, - EC, -}; - -message Empty { -}; - -message Data { - uint8 data[] @end @ctype(uint8_t); -} @nocopy; - -struct ChannelWait { - uint8 channel_type; - uint8 channel_id; - uint64 message_serial; -} @ctype(SpiceWaitForChannel); - -channel BaseChannel { - server: - message { - migrate_flags flags; - } migrate; - - Data migrate_data; - - message { - uint32 generation; - uint32 window; - } set_ack; - - message { - uint32 id; - uint64 timestamp; - uint8 data[] @ctype(uint8_t) @as_ptr(data_len); - } ping; - - message { - uint8 wait_count; - ChannelWait wait_list[wait_count] @end; - } wait_for_channels; - - message { - uint64 time_stamp; - link_err reason; - } @ctype(SpiceMsgDisconnect) disconnecting; - - message { - uint64 time_stamp; - notify_severity severity; - notify_visibility visibilty; - uint32 what; /* error_code/warn_code/info_code */ - uint32 message_len; - uint8 message[message_len] @end @nomarshal; - uint8 zero @end @ctype(uint8_t) @nomarshal; - } notify; - - client: - message { - uint32 generation; - } ack_sync; - - Empty ack; - - message { - uint32 id; - uint64 timestamp; - } @ctype(SpiceMsgPing) pong; - - Empty migrate_flush_mark; - - Data migrate_data; - - message { - uint64 time_stamp; - link_err reason; - } @ctype(SpiceMsgDisconnect) disconnecting; -}; - -struct ChannelId { - uint8 type; - uint8 id; -}; - -channel MainChannel : BaseChannel { - server: - message { - uint16 port; - uint16 sport; - uint32 host_offset @zero; - uint32 host_size; - pubkey_type pub_key_type @minor(1); - uint32 pub_key_offset @minor(1) @zero; - uint32 pub_key_size @minor(1); - uint8 host_data[host_size] @as_ptr @zero_terminated; - uint8 pub_key_data[pub_key_size] @minor(1) @as_ptr @zero_terminated; - } @ctype(SpiceMsgMainMigrationBegin) migrate_begin = 101; - - Empty migrate_cancel; - - message { - uint32 session_id; - uint32 display_channels_hint; - uint32 supported_mouse_modes; - uint32 current_mouse_mode; - uint32 agent_connected; - uint32 agent_tokens; - uint32 multi_media_time; - uint32 ram_hint; - } init; - - message { - uint32 num_of_channels; - ChannelId channels[num_of_channels] @end; - } @ctype(SpiceMsgChannels) channels_list; - - message { - mouse_mode supported_modes; - mouse_mode current_mode @unique_flag; - } mouse_mode; - - message { - uint32 time; - } @ctype(SpiceMsgMainMultiMediaTime) multi_media_time; - - Empty agent_connected; - - message { - link_err error_code; - } @ctype(SpiceMsgMainAgentDisconnect) agent_disconnected; - - Data agent_data; - - message { - uint32 num_tokens; - } @ctype(SpiceMsgMainAgentTokens) agent_token; - - message { - uint16 port; - uint16 sport; - uint32 host_offset @zero; - uint32 host_size; - uint32 cert_subject_offset @zero; - uint32 cert_subject_size; - uint8 host_data[host_size] @as_ptr @zero_terminated; - uint8 cert_subject_data[cert_subject_size] @as_ptr @zero_terminated; - } @ctype(SpiceMsgMainMigrationSwitchHost) migrate_switch_host; - - client: - message { - uint64 cache_size; - } @ctype(SpiceMsgcClientInfo) client_info = 101; - - Empty migrate_connected; - - Empty migrate_connect_error; - - Empty attach_channels; - - message { - mouse_mode mode; - } mouse_mode_request; - - message { - uint32 num_tokens; - } agent_start; - - Data agent_data; - - message { - uint32 num_tokens; - } @ctype(SpiceMsgcMainAgentTokens) agent_token; -}; - -enum32 clip_type { - NONE, - RECTS -}; - -flags32 path_flags { /* TODO: C enum names changes */ - BEGIN = 0, - END = 1, - CLOSE = 3, - BEZIER = 4, -} @prefix(SPICE_PATH_); - -enum32 video_codec_type { - MJPEG = 1, -}; - -flags32 stream_flags { - TOP_DOWN = 0, -}; - -enum32 brush_type { - NONE, - SOLID, - PATTERN, -}; - -flags8 mask_flags { - INVERS, -}; - -enum8 image_type { - BITMAP, - QUIC, - RESERVED, - LZ_PLT = 100, - LZ_RGB, - GLZ_RGB, - FROM_CACHE, -}; - -flags8 image_flags { - CACHE_ME, -}; - -enum8 bitmap_fmt { - INVALID, - 1BIT_LE, - 1BIT_BE, - 4BIT_LE, - 4BIT_BE, - 8BIT /* 8bit indexed mode */, - 16BIT, /* 0555 mode */ - 24BIT /* 3 byte, brg */, - 32BIT /* 4 byte, xrgb in little endian format */, - RGBA /* 4 byte, argb in little endian format */ -}; - -flags8 bitmap_flags { - PAL_CACHE_ME, - PAL_FROM_CACHE, - TOP_DOWN, -}; - -enum8 image_scale_mode { - INTERPOLATE, - NEAREST, -}; - -flags16 ropd { - INVERS_SRC, - INVERS_BRUSH, - INVERS_DEST, - OP_PUT, - OP_OR, - OP_AND, - OP_XOR, - OP_BLACKNESS, - OP_WHITENESS, - OP_INVERS, - INVERS_RES, -}; - -flags8 line_flags { - STYLED = 3, - START_WITH_GAP = 2, -}; - -enum8 line_cap { - ROUND, - SQUARE, - BUTT, -}; - -enum8 line_join { - ROUND, - BEVEL, - MITER, -}; - -flags16 string_flags { - RASTER_A1, - RASTER_A4, - RASTER_A8, - RASTER_TOP_DOWN, -}; - -enum8 resource_type { - INVALID, - PIXMAP -} @prefix(SPICE_RES_TYPE_); - -struct ClipRects { - uint32 num_rects; - Rect rects[num_rects] @end; -}; - -struct PathSegment { - path_flags flags; - uint32 count; - PointFix points[count] @end; -} @ctype(SpicePathSeg); - -struct Path { - uint32 segments_size @bytes_count(num_segments); - PathSegment segments[bytes(segments_size, num_segments)] @ptr_array; -}; - -struct Clip { - clip_type type; - switch (type) { - case RECTS: - ClipRects *rects @outvar(cliprects); - default: - uint64 data @zero; - } u @anon; -}; - -struct DisplayBase { - uint32 surface_id @virtual(0); - Rect box; - Clip clip; -} @ctype(SpiceMsgDisplayBase); - -struct ResourceID { - uint8 type; - uint64 id; -}; - -struct WaitForChannel { - uint8 channel_type; - uint8 channel_id; - uint64 message_serial; -}; - -struct Palette { - uint64 unique; - uint16 num_ents; - uint32 ents[num_ents] @end; -}; - -struct BitmapData { - bitmap_fmt format; - bitmap_flags flags; - uint32 x; - uint32 y; - uint32 stride; - switch (flags) { - case PAL_FROM_CACHE: - uint64 palette_id; - default: - Palette *palette @outvar(bitmap); - } pal @anon; - uint8 *data[image_size(8, stride, y)] @chunk; /* pointer to array, not array of pointers as in C */ -} @ctype(SpiceBitmap); - -struct BinaryData { - uint32 data_size; - uint8 data[data_size] @nomarshal @chunk; -} @ctype(SpiceQUICData); - -struct LZPLTData { - bitmap_flags flags; - uint32 data_size; - switch (flags) { - case PAL_FROM_CACHE: - uint64 palette_id; - default: - Palette *palette @nonnull @outvar(lzplt); - } pal @anon; - uint8 data[data_size] @nomarshal @chunk; -}; - -struct Image { - struct ImageDescriptor { - uint64 id; - image_type type; - image_flags flags; - uint32 width; - uint32 height; - } descriptor; - - switch (descriptor.type) { - case BITMAP: - BitmapData bitmap; - case QUIC: - BinaryData quic; - case LZ_RGB: - case GLZ_RGB: - BinaryData lz_rgb; - case LZ_PLT: - LZPLTData lz_plt; - } u; -}; - -struct Pattern { - Image *pat @nonnull; - Point pos; -}; - -struct Brush { - brush_type type; - switch (type) { - case SOLID: - uint32 color; - case PATTERN: - Pattern pattern; - } u @fixedsize; -}; - -struct QMask { - mask_flags flags; - Point pos; - Image *bitmap; -}; - -struct LineAttr { - line_flags flags; - line_join join_style @zero; - line_cap end_style @zero; - uint8 style_nseg; - fixed28_4 width @zero; - fixed28_4 miter_limit @zero; - fixed28_4 *style[style_nseg]; -}; - -struct RasterGlyphA1 { - Point render_pos; - Point glyph_origin; - uint16 width; - uint16 height; - uint8 data[image_size(1, width, height)] @end; -} @ctype(SpiceRasterGlyph); - -struct RasterGlyphA4 { - Point render_pos; - Point glyph_origin; - uint16 width; - uint16 height; - uint8 data[image_size(4, width, height)] @end; -} @ctype(SpiceRasterGlyph); - -struct RasterGlyphA8 { - Point render_pos; - Point glyph_origin; - uint16 width; - uint16 height; - uint8 data[image_size(8, width, height)] @end; -} @ctype(SpiceRasterGlyph); - -struct String { - uint16 length; - string_flags flags; /* Special: Only one of a1/a4/a8 set */ - switch (flags) { - case RASTER_A1: - RasterGlyphA1 glyphs[length] @ctype(SpiceRasterGlyph) @ptr_array; - case RASTER_A4: - RasterGlyphA4 glyphs[length] @ctype(SpiceRasterGlyph) @ptr_array; - case RASTER_A8: - RasterGlyphA8 glyphs[length] @ctype(SpiceRasterGlyph) @ptr_array; - } u @anon; -}; - -channel DisplayChannel : BaseChannel { - server: - message { - uint32 x_res; - uint32 y_res; - uint32 bits; - } mode = 101; - - Empty mark; - Empty reset; - - message { - DisplayBase base; - Point src_pos; - } copy_bits; - - message { - uint16 count; - ResourceID resources[count] @end; - } @ctype(SpiceResourceList) inval_list; - - message { - uint8 wait_count; - WaitForChannel wait_list[wait_count] @end; - } @ctype(SpiceMsgWaitForChannels) inval_all_pixmaps; - - message { - uint64 id; - } @ctype(SpiceMsgDisplayInvalOne) inval_palette; - - Empty inval_all_palettes; - - message { - uint32 surface_id @virtual(0); - uint32 id; - stream_flags flags; - video_codec_type codec_type; - uint64 stamp; - uint32 stream_width; - uint32 stream_height; - uint32 src_width; - uint32 src_height; - Rect dest; - Clip clip; - } stream_create = 122; - - message { - uint32 id; - uint32 multi_media_time; - uint32 data_size; - uint32 pad_size @zero; - uint8 data[data_size] @end @nomarshal; - /* Ignore: uint8 padding[pad_size] */ - } stream_data; - - message { - uint32 id; - Clip clip; - } stream_clip; - - message { - uint32 id; - } stream_destroy; - - Empty stream_destroy_all; - - message { - DisplayBase base; - struct Fill { - Brush brush @outvar(brush); - uint16 rop_descriptor; - QMask mask @outvar(mask); - } data; - } draw_fill = 302; - - message { - DisplayBase base; - struct Opaque { - Image *src_bitmap; - Rect src_area; - Brush brush; - ropd rop_descriptor; - image_scale_mode scale_mode; - QMask mask @outvar(mask); - } data; - } draw_opaque; - - message { - DisplayBase base; - struct Copy { - Image *src_bitmap; - Rect src_area; - ropd rop_descriptor; - image_scale_mode scale_mode; - QMask mask @outvar(mask); - } data; - } draw_copy; - - message { - DisplayBase base; - struct Blend { - Image *src_bitmap; - Rect src_area; - ropd rop_descriptor; - image_scale_mode scale_mode; - QMask mask @outvar(mask); - } @ctype(SpiceCopy) data; - } draw_blend; - - message { - DisplayBase base; - struct Blackness { - QMask mask @outvar(mask); - } data; - } draw_blackness; - - message { - DisplayBase base; - struct Whiteness { - QMask mask @outvar(mask); - } data; - } draw_whiteness; - - message { - DisplayBase base; - struct Invers { - QMask mask @outvar(mask); - } data; - } draw_invers; - - message { - DisplayBase base; - struct Rop3 { - Image *src_bitmap; - Rect src_area; - Brush brush; - uint8 rop3; - image_scale_mode scale_mode; - QMask mask @outvar(mask); - } data; - } draw_rop3; - - message { - DisplayBase base; - struct Stroke { - Path *path; - LineAttr attr; - Brush brush; - uint16 fore_mode; - uint16 back_mode; - } data; - } draw_stroke; - - message { - DisplayBase base; - struct Text { - String *str; - Rect back_area; - Brush fore_brush @outvar(fore_brush); - Brush back_brush @outvar(back_brush); - uint16 fore_mode; - uint16 back_mode; - } data; - } draw_text; - - message { - DisplayBase base; - struct Transparent { - Image *src_bitmap; - Rect src_area; - uint32 src_color; - uint32 true_color; - } data; - } draw_transparent; - - message { - DisplayBase base; - struct AlphaBlend { - int8 alpha_flags @virtual(0); - uint8 alpha; - Image *src_bitmap; - Rect src_area; - } data; - } draw_alpha_blend; - - client: - message { - uint8 pixmap_cache_id; - int64 pixmap_cache_size; //in pixels - uint8 glz_dictionary_id; - int32 glz_dictionary_window_size; // in pixels - } init = 101; -}; - -flags32 keyboard_modifier_flags { - SCROLL_LOCK, - NUM_LOCK, - CAPS_LOCK -}; - -enum32 mouse_button { - INVALID, - LEFT, - MIDDLE, - RIGHT, - UP, - DOWN, -}; - -flags32 mouse_button_mask { - LEFT, - MIDDLE, - RIGHT -}; - -channel InputsChannel : BaseChannel { - client: - message { - uint32 code; - } @ctype(SpiceMsgcKeyDown) key_down = 101; - - message { - uint32 code; - } @ctype(SpiceMsgcKeyUp) key_up; - - message { - keyboard_modifier_flags modifiers; - } @ctype(SpiceMsgcKeyModifiers) key_modifiers; - - message { - int32 dx; - int32 dy; - mouse_button_mask buttons_state; - } @ctype(SpiceMsgcMouseMotion) mouse_motion = 111; - - message { - uint32 x; - uint32 y; - mouse_button_mask buttons_state; - uint8 display_id; - } @ctype(SpiceMsgcMousePosition) mouse_position; - - message { - mouse_button button; - mouse_button_mask buttons_state; - } @ctype(SpiceMsgcMousePress) mouse_press; - - message { - mouse_button button; - mouse_button_mask buttons_state; - } @ctype(SpiceMsgcMouseRelease) mouse_release; - - server: - message { - keyboard_modifier_flags keyboard_modifiers; - } init = 101; - - message { - keyboard_modifier_flags modifiers; - } key_modifiers; - - Empty mouse_motion_ack = 111; -}; - -enum16 cursor_type { - ALPHA, - MONO, - COLOR4, - COLOR8, - COLOR16, - COLOR24, - COLOR32, -}; - -flags32 cursor_flags { - NONE, /* Means no cursor */ - CACHE_ME, - FROM_CACHE, -}; - -struct CursorHeader { - uint64 unique; - cursor_type type; - uint16 width; - uint16 height; - uint16 hot_spot_x; - uint16 hot_spot_y; -}; - -struct Cursor { - cursor_flags flags; - CursorHeader header; - uint8 data[] @as_ptr(data_size); -}; - -channel CursorChannel : BaseChannel { - server: - message { - Point16 position; - uint16 trail_length; - uint16 trail_frequency; - uint8 visible; - Cursor cursor; - } init = 101; - - Empty reset; - - message { - Point16 position; - uint8 visible; - Cursor cursor; - } set; - - message { - Point16 position; - } move; - - Empty hide; - - message { - uint16 length; - uint16 frequency; - } trail; - - message { - uint64 id; - } @ctype(SpiceMsgDisplayInvalOne) inval_one; - - Empty inval_all; -}; - -enum32 audio_data_mode { - INVALID, - RAW, - CELT_0_5_1, -}; - -enum32 audio_fmt { - INVALID, - S16, -}; - -channel PlaybackChannel : BaseChannel { - server: - message { - uint32 time; - uint8 data[] @as_ptr(data_size); - } @ctype(SpiceMsgPlaybackPacket) data = 101; - - message { - uint32 time; - audio_data_mode mode; - uint8 data[] @as_ptr(data_size); - } mode; - - message { - uint32 channels; - audio_fmt format; - uint32 frequency; - uint32 time; - } start; - - Empty stop; -}; - -channel RecordChannel : BaseChannel { - server: - message { - uint32 channels; - audio_fmt format; - uint32 frequency; - } start = 101; - - Empty stop; - client: - message { - uint32 time; - uint8 data[] @nomarshal @as_ptr(data_size); - } @ctype(SpiceMsgcRecordPacket) data = 101; - - message { - uint32 time; - audio_data_mode mode; - uint8 data[] @as_ptr(data_size); - } mode; - - message { - uint32 time; - } start_mark; -}; - -protocol Spice { - MainChannel main = 1; - DisplayChannel display; - InputsChannel inputs; - CursorChannel cursor; - PlaybackChannel playback; - RecordChannel record; -}; diff -Nru spice-gtk-0.9/spice-client-glib-2.0.pc.in spice-gtk-0.12/spice-client-glib-2.0.pc.in --- spice-gtk-0.9/spice-client-glib-2.0.pc.in 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/spice-client-glib-2.0.pc.in 2012-04-11 13:51:02.000000000 +0000 @@ -7,6 +7,7 @@ Description: SPICE Client GLib 2.0 library Version: @VERSION@ -Requires: @SPICE_GLIB_REQUIRES@ spice-protocol +Requires: spice-protocol +Requires.private: @SPICE_GLIB_REQUIRES@ Libs: -L${libdir} -lspice-client-glib-2.0 Cflags: -I${includedir}/spice-client-glib-2.0 diff -Nru spice-gtk-0.9/spice_codegen.py spice-gtk-0.12/spice_codegen.py --- spice-gtk-0.9/spice_codegen.py 2011-03-31 13:05:13.000000000 +0000 +++ spice-gtk-0.12/spice_codegen.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,211 +0,0 @@ -#!/usr/bin/env python - -import os -import sys -from optparse import OptionParser -import traceback -from python_modules import spice_parser -from python_modules import ptypes -from python_modules import codegen -from python_modules import demarshal -from python_modules import marshal - -def write_channel_enums(writer, channel, client): - messages = filter(lambda m : m.channel == channel, \ - channel.client_messages if client else channel.server_messages) - if len(messages) == 0: - return - writer.begin_block("enum") - i = 0; - if client: - prefix = [ "MSGC" ] - else: - prefix = [ "MSG" ] - if channel.member_name: - prefix.append(channel.member_name.upper()) - prefix.append(None) # To be replaced with name - for m in messages: - prefix[-1] = m.name.upper() - enum = codegen.prefix_underscore_upper(*prefix) - if m.value == i: - writer.writeln("%s," % enum) - i = i + 1 - else: - writer.writeln("%s = %s," % (enum, m.value)) - i = m.value + 1 - if channel.member_name: - prefix[-1] = prefix[-2] - prefix[-2] = "END" - writer.newline() - writer.writeln("%s" % (codegen.prefix_underscore_upper(*prefix))) - writer.end_block(semicolon=True) - writer.newline() - -def write_enums(writer): - writer.writeln("#ifndef _H_SPICE_ENUMS") - writer.writeln("#define _H_SPICE_ENUMS") - writer.newline() - writer.comment("Generated from %s, don't edit" % writer.options["source"]).newline() - writer.newline() - - # Define enums - for t in ptypes.get_named_types(): - if isinstance(t, ptypes.EnumBaseType): - t.c_define(writer) - - i = 0; - writer.begin_block("enum") - for c in proto.channels: - enum = codegen.prefix_underscore_upper("CHANNEL", c.name.upper()) - if c.value == i: - writer.writeln("%s," % enum) - i = i + 1 - else: - writer.writeln("%s = %s," % (enum, c.value)) - i = c.value + 1 - writer.newline() - writer.writeln("SPICE_END_CHANNEL") - writer.end_block(semicolon=True) - writer.newline() - - for c in ptypes.get_named_types(): - if not isinstance(c, ptypes.ChannelType): - continue - write_channel_enums(writer, c, False) - write_channel_enums(writer, c, True) - - writer.writeln("#endif /* _H_SPICE_ENUMS */") - -parser = OptionParser(usage="usage: %prog [options] ") -parser.add_option("-e", "--generate-enums", - action="store_true", dest="generate_enums", default=False, - help="Generate enums") -parser.add_option("-d", "--generate-demarshallers", - action="store_true", dest="generate_demarshallers", default=False, - help="Generate demarshallers") -parser.add_option("-m", "--generate-marshallers", - action="store_true", dest="generate_marshallers", default=False, - help="Generate message marshallers") -parser.add_option("-P", "--private-marshallers", - action="store_true", dest="private_marshallers", default=False, - help="Generate private message marshallers") -parser.add_option("-M", "--generate-struct-marshaller", - action="append", dest="struct_marshallers", - help="Generate struct marshallers") -parser.add_option("-a", "--assert-on-error", - action="store_true", dest="assert_on_error", default=False, - help="Assert on error") -parser.add_option("-H", "--header", - action="store_true", dest="header", default=False, - help="Generate header") -parser.add_option("-p", "--print-error", - action="store_true", dest="print_error", default=False, - help="Print errors") -parser.add_option("-s", "--server", - action="store_true", dest="server", default=False, - help="Print errors") -parser.add_option("-c", "--client", - action="store_true", dest="client", default=False, - help="Print errors") -parser.add_option("-k", "--keep-identical-file", - action="store_true", dest="keep_identical_file", default=False, - help="Print errors") -parser.add_option("-i", "--include", - action="append", dest="includes", metavar="FILE", - help="Include FILE in generated code") -parser.add_option("--prefix", dest="prefix", - help="set public symbol prefix", default="") -parser.add_option("--ptrsize", dest="ptrsize", - help="set default pointer size", default="4") - -(options, args) = parser.parse_args() - -if len(args) == 0: - parser.error("No protocol file specified") - -if len(args) == 1: - parser.error("No destination file specified") - -ptypes.default_pointer_size = int(options.ptrsize) - -proto_file = args[0] -dest_file = args[1] -proto = spice_parser.parse(proto_file) - -if proto == None: - exit(1) - -codegen.set_prefix(proto.name) -writer = codegen.CodeWriter() -writer.header = codegen.CodeWriter() -writer.set_option("source", os.path.basename(proto_file)) - -writer.public_prefix = options.prefix - -if options.assert_on_error: - writer.set_option("assert_on_error") - -if options.print_error: - writer.set_option("print_error") - -if options.includes: - for i in options.includes: - writer.writeln('#include "%s"' % i) - -if options.generate_enums: - write_enums(writer) - -if options.generate_demarshallers: - if not options.server and not options.client: - print >> sys.stderr, "Must specify client and/or server" - sys.exit(1) - demarshal.write_includes(writer) - - if options.server: - demarshal.write_protocol_parser(writer, proto, False) - if options.client: - demarshal.write_protocol_parser(writer, proto, True) - -if options.generate_marshallers or (options.struct_marshallers and len(options.struct_marshallers) > 0): - marshal.write_includes(writer) - -if options.generate_marshallers: - if not options.server and not options.client: - print >> sys.stderr, "Must specify client and/or server" - sys.exit(1) - if options.server: - marshal.write_protocol_marshaller(writer, proto, False, options.private_marshallers) - if options.client: - marshal.write_protocol_marshaller(writer, proto, True, options.private_marshallers) - -if options.struct_marshallers: - for structname in options.struct_marshallers: - t = ptypes.lookup_type(structname) - marshal.write_marshal_ptr_function(writer, t) - -if options.generate_marshallers or (options.struct_marshallers and len(options.struct_marshallers) > 0): - marshal.write_trailer(writer) - -if options.header: - content = writer.header.getvalue() -else: - content = writer.getvalue() -if options.keep_identical_file: - try: - f = open(dest_file, 'rb') - old_content = f.read() - f.close() - - if content == old_content: - print "No changes to %s" % dest_file - sys.exit(0) - - except IOError: - pass - -f = open(dest_file, 'wb') -f.write(content) -f.close() - -print "Wrote %s" % dest_file -sys.exit(0) diff -Nru spice-gtk-0.9/spice-common/aclocal.m4 spice-gtk-0.12/spice-common/aclocal.m4 --- spice-gtk-0.9/spice-common/aclocal.m4 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/aclocal.m4 2012-04-24 11:20:52.000000000 +0000 @@ -0,0 +1,1297 @@ +# generated automatically by aclocal 1.11.3 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, +# Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, +[m4_warning([this file was generated for autoconf 2.68. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT]) + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .]) + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software +# Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.11' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.11.3], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.11.3])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, +# 2010, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 12 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 5 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 16 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.62])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl +]) + +dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, +# Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, +# 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_MAINTAINER_MODE([DEFAULT-MODE]) +# ---------------------------------- +# Control maintainer-specific portions of Makefiles. +# Default is to disable them, unless `enable' is passed literally. +# For symmetry, `disable' may be passed as well. Anyway, the user +# can override the default with the --enable/--disable switch. +AC_DEFUN([AM_MAINTAINER_MODE], +[m4_case(m4_default([$1], [disable]), + [enable], [m4_define([am_maintainer_other], [disable])], + [disable], [m4_define([am_maintainer_other], [enable])], + [m4_define([am_maintainer_other], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode's default is 'disable' unless 'enable' is passed + AC_ARG_ENABLE([maintainer-mode], +[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST([MAINT])dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_PROG_CC_C_O +# -------------- +# Like AC_PROG_CC_C_O, but changed for automake. +AC_DEFUN([AM_PROG_CC_C_O], +[AC_REQUIRE([AC_PROG_CC_C_O])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +dnl Make sure AC_PROG_CC is never called again, or it will override our +dnl setting of CC. +m4_define([AC_PROG_CC], + [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, +# Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software +# Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2009, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# (`yes' being less verbose, `no' or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], +[ --enable-silent-rules less verbose build output (undo: `make V=1') + --disable-silent-rules verbose build output (undo: `make V=0')]) +case $enable_silent_rules in +yes) AM_DEFAULT_VERBOSITY=0;; +no) AM_DEFAULT_VERBOSITY=1;; +*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few `make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using `$V' instead of `$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/libtool.m4]) +m4_include([m4/ltoptions.m4]) +m4_include([m4/ltsugar.m4]) +m4_include([m4/ltversion.m4]) +m4_include([m4/lt~obsolete.m4]) diff -Nru spice-gtk-0.9/spice-common/build-aux/compile spice-gtk-0.12/spice-common/build-aux/compile --- spice-gtk-0.9/spice-common/build-aux/compile 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/build-aux/compile 2012-04-24 11:20:55.000000000 +0000 @@ -0,0 +1,310 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2012-01-04.17; # UTC + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free +# Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l*) + lib=${1#-l} + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + set x "$@" "$dir/$lib.dll.lib" + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + set x "$@" "$dir/$lib.lib" + break + fi + done + IFS=$save_IFS + + test "$found" != yes && set x "$@" "$lib.lib" + shift + ;; + -L*) + func_file_conv "${1#-L}" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru spice-gtk-0.9/spice-common/build-aux/config.guess spice-gtk-0.12/spice-common/build-aux/config.guess --- spice-gtk-0.9/spice-common/build-aux/config.guess 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/build-aux/config.guess 2012-04-24 11:20:55.000000000 +0000 @@ -0,0 +1,1522 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. + +timestamp='2012-01-01' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -Nru spice-gtk-0.9/spice-common/build-aux/config.sub spice-gtk-0.12/spice-common/build-aux/config.sub --- spice-gtk-0.9/spice-common/build-aux/config.sub 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/build-aux/config.sub 2012-04-24 11:20:55.000000000 +0000 @@ -0,0 +1,1766 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. + +timestamp='2012-01-01' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted GNU ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | be32 | be64 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | epiphany \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 \ + | ns16k | ns32k \ + | open8 \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pyramid \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | we32k \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pyramid-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze) + basic_machine=microblaze-xilinx + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i386-pc + os=-msys + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -Nru spice-gtk-0.9/spice-common/build-aux/depcomp spice-gtk-0.12/spice-common/build-aux/depcomp --- spice-gtk-0.9/spice-common/build-aux/depcomp 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/build-aux/depcomp 2012-04-24 11:20:55.000000000 +0000 @@ -0,0 +1,688 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2011-12-04.11; # UTC + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, +# 2011 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputting dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp +fi + +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> "$depfile" + echo >> "$depfile" + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test "$stat" = 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/ \1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/ / + G + p +}' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru spice-gtk-0.9/spice-common/build-aux/install-sh spice-gtk-0.12/spice-common/build-aux/install-sh --- spice-gtk-0.9/spice-common/build-aux/install-sh 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/build-aux/install-sh 2012-04-24 11:20:55.000000000 +0000 @@ -0,0 +1,527 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2011-01-19.21; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + # Protect names problematic for `test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for `test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for `test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru spice-gtk-0.9/spice-common/build-aux/ltmain.sh spice-gtk-0.12/spice-common/build-aux/ltmain.sh --- spice-gtk-0.9/spice-common/build-aux/ltmain.sh 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/build-aux/ltmain.sh 2012-04-24 11:20:49.000000000 +0000 @@ -0,0 +1,9655 @@ + +# libtool (GNU libtool) 2.4.2 +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [OPTION]... [MODE-ARG]... +# +# Provide generalized library-building support services. +# +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --no-quiet, --no-silent +# print informational messages (default) +# --no-warn don't display warning messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print more informational messages than default +# --no-verbose don't print the extra informational messages +# --version print version information +# -h, --help, --help-all print short, long, or detailed help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. When passed as first option, +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.4.2 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . +# GNU libtool home page: . +# General help using GNU software: . + +PROGRAM=libtool +PACKAGE=libtool +VERSION=2.4.2 +TIMESTAMP="" +package_revision=1.3337 + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# NLS nuisances: We save the old values to restore during execute mode. +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL + +$lt_unset CDPATH + + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + + + +: ${CP="cp -f"} +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} # func_dirname may be replaced by extended shell implementation + + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "${1}" | $SED "$basename"` +} # func_basename may be replaced by extended shell implementation + + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` +} # func_dirname_and_basename may be replaced by extended shell implementation + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname may be replaced by extended shell implementation + + +# These SED scripts presuppose an absolute path with a trailing slash. +pathcar='s,^/\([^/]*\).*$,\1,' +pathcdr='s,^/[^/]*,,' +removedotparts=':dotsl + s@/\./@/@g + t dotsl + s,/\.$,/,' +collapseslashes='s@/\{1,\}@/@g' +finalslash='s,/*$,/,' + +# func_normal_abspath PATH +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +# value returned in "$func_normal_abspath_result" +func_normal_abspath () +{ + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` + while :; do + # Processed it all yet? + if test "$func_normal_abspath_tpath" = / ; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result" ; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + +# func_relative_path SRCDIR DSTDIR +# generates a relative path from SRCDIR to DSTDIR, with a trailing +# slash if non-empty, suitable for immediately appending a filename +# without needing to append a separator. +# value returned in "$func_relative_path_result" +func_relative_path () +{ + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=${func_dirname_result} + if test "x$func_relative_path_tlibdir" = x ; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test "x$func_stripname_result" != x ; then + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} + fi + + # Normalisation. If bindir is libdir, return empty string, + # else relative path ending with a slash; either way, target + # file name can be directly appended. + if test ! -z "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result/" + func_relative_path_result=$func_stripname_result + fi +} + +# The name of this program: +func_dirname_and_basename "$progpath" +progname=$func_basename_result + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=${PATH_SEPARATOR-:} + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' + +# Sed substitution that converts a w32 file name or path +# which contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` + done + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "$my_tmpdir" +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "$1" | $SED \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + +# func_tr_sh +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $opt_debug + + $SED -n '/(C)/!b go + :more + /\./!{ + N + s/\n# / / + b more + } + :go + /^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $opt_debug + + $SED -n '/^# Usage:/,/^# *.*--help/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + echo + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help [NOEXIT] +# Echo long help message to standard output and exit, +# unless 'noexit' is passed as argument. +func_help () +{ + $opt_debug + + $SED -n '/^# Usage:/,/# Report bugs to/ { + :print + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ + p + d + } + /^# .* home page:/b print + /^# General help using/b print + ' < "$progpath" + ret=$? + if test -z "$1"; then + exit $ret + fi +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $opt_debug + + func_error "missing argument for $1." + exit_cmd=exit +} + + +# func_split_short_opt shortopt +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +func_split_short_opt () +{ + my_sed_short_opt='1s/^\(..\).*$/\1/;q' + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' + + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` +} # func_split_short_opt may be replaced by extended shell implementation + + +# func_split_long_opt longopt +# Set func_split_long_opt_name and func_split_long_opt_arg shell +# variables after splitting LONGOPT at the `=' sign. +func_split_long_opt () +{ + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' + my_sed_long_arg='1s/^--[^=]*=//' + + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` +} # func_split_long_opt may be replaced by extended shell implementation + +exit_cmd=: + + + + + +magic="%%%MAGIC variable%%%" +magic_exe="%%%MAGIC EXE variable%%%" + +# Global variables. +nonopt= +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "${1}=\$${1}\${2}" +} # func_append may be replaced by extended shell implementation + +# func_append_quoted var value +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +func_append_quoted () +{ + func_quote_for_eval "${2}" + eval "${1}=\$${1}\\ \$func_quote_for_eval_result" +} # func_append_quoted may be replaced by extended shell implementation + + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "${@}"` +} # func_arith may be replaced by extended shell implementation + + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` +} # func_len may be replaced by extended shell implementation + + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +} # func_lo2o may be replaced by extended shell implementation + + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +} # func_xform may be replaced by extended shell implementation + + +# func_fatal_configuration arg... +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func_error ${1+"$@"} + func_error "See the $PACKAGE documentation for more information." + func_fatal_error "Fatal configuration error." +} + + +# func_config +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + +# func_features +# Display the features supported by this script. +func_features () +{ + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + + exit $? +} + +# func_enable_tag tagname +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname="$1" + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf="/$re_begincf/,/$re_endcf/p" + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# Shorthand for --mode=foo, only valid as the first argument +case $1 in +clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; +compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; +execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; +finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; +install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; +link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; +esac + + + +# Option defaults: +opt_debug=: +opt_dry_run=false +opt_config=false +opt_preserve_dup_deps=false +opt_features=false +opt_finish=false +opt_help=false +opt_help_all=false +opt_silent=: +opt_warning=: +opt_verbose=: +opt_silent=false +opt_verbose=false + + +# Parse options once, thoroughly. This comes as soon as possible in the +# script to make things like `--version' happen as quickly as we can. +{ + # this just eases exit handling + while test $# -gt 0; do + opt="$1" + shift + case $opt in + --debug|-x) opt_debug='set -x' + func_echo "enabling shell trace mode" + $opt_debug + ;; + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + --config) + opt_config=: +func_config + ;; + --dlopen|-dlopen) + optarg="$1" + opt_dlopen="${opt_dlopen+$opt_dlopen +}$optarg" + shift + ;; + --preserve-dup-deps) + opt_preserve_dup_deps=: + ;; + --features) + opt_features=: +func_features + ;; + --finish) + opt_finish=: +set dummy --mode finish ${1+"$@"}; shift + ;; + --help) + opt_help=: + ;; + --help-all) + opt_help_all=: +opt_help=': help-all' + ;; + --mode) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_mode="$optarg" +case $optarg in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; +esac + shift + ;; + --no-silent|--no-quiet) + opt_silent=false +func_append preserve_args " $opt" + ;; + --no-warning|--no-warn) + opt_warning=false +func_append preserve_args " $opt" + ;; + --no-verbose) + opt_verbose=false +func_append preserve_args " $opt" + ;; + --silent|--quiet) + opt_silent=: +func_append preserve_args " $opt" + opt_verbose=false + ;; + --verbose|-v) + opt_verbose=: +func_append preserve_args " $opt" +opt_silent=false + ;; + --tag) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_tag="$optarg" +func_append preserve_args " $opt $optarg" +func_enable_tag "$optarg" + shift + ;; + + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; + + # Separate optargs to long options: + --*=*) + func_split_long_opt "$opt" + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-n*|-v*) + func_split_short_opt "$opt" + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set dummy "$opt" ${1+"$@"}; shift; break ;; + esac + done + + # Validate options: + + # save first non-option argument + if test "$#" -gt 0; then + nonopt="$opt" + shift + fi + + # preserve --debug + test "$opt_debug" = : || func_append preserve_args " --debug" + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$opt_mode' for more information." + } + + + # Bail if the options were screwed + $exit_cmd $EXIT_FAILURE +} + + + + +## ----------- ## +## Main. ## +## ----------- ## + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case "$lt_sysroot:$1" in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result="=$func_stripname_result" + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $opt_debug + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi + + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$lt_sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $opt_debug + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result="" + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result" ; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $opt_debug + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $opt_debug + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $opt_debug + if test -z "$2" && test -n "$1" ; then + func_error "Could not determine host file name corresponding to" + func_error " \`$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result="$1" + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $opt_debug + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " \`$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result="$3" + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $opt_debug + case $4 in + $1 ) func_to_host_path_result="$3$func_to_host_path_result" + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via `$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $opt_debug + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $opt_debug + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result="$1" +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result="$func_convert_core_msys_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via `$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $opt_debug + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd="func_convert_path_${func_stripname_result}" + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $opt_debug + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result="$1" +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_msys_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_mode_compile arg... +func_mode_compile () +{ + $opt_debug + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify \`-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + func_append_quoted lastarg "$arg" + done + IFS="$save_ifs" + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with \`-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj="$func_basename_result" + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from \`$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode \`$opt_mode'" + ;; + esac + + echo + $ECHO "Try \`$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test "$opt_help" = :; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | sed -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + sed '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "\`$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument \`$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test "x$prev" = x-m && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append staticlibs " $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $tool_oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename="" + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname" ; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename="$func_basename_result" + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename" ; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $opt_debug + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $opt_debug + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive which possess that section. Heuristic: eliminate + # all those which have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $opt_debug + if func_cygming_gnu_implib_p "$1" ; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1" ; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result="" + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + if test "$lock_old_archive_extraction" = yes; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test "$lock_old_archive_extraction" = yes; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ which is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options which match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case \" \$* \" in + *\\ --lt-*) + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done ;; + esac + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +/* declarations of non-ANSI functions */ +#if defined(__MINGW32__) +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined(__CYGWIN__) +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined (other platforms) ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined(_MSC_VER) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +# ifndef _INTPTR_T_DEFINED +# define _INTPTR_T_DEFINED +# define intptr_t int +# endif +#elif defined(__MINGW32__) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined(__CYGWIN__) +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined (other platforms) ... */ +#endif + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#if defined(LT_DEBUGWRAPPER) +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + int len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + int orig_value_len = strlen (orig_value); + int add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[len-1] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -n -e ' +s/^\(.\{79\}\)\(..*\)/\1\ +\2/ +h +s/\([\\"]\)/\\\1/g +s/$/\\n/ +s/\([^\n]*\).*/ fputs ("\1", f);/p +g +D' + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $opt_debug + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module="${wl}-single_module" + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir="$arg" + prev= + continue + ;; + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file \`$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "\`-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between \`-L' and \`$1'" + else + func_fatal_error "need path for \`-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-flto*|-fwhopr*|-fuse-linker-plugin) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname="$func_basename_result" + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps ; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + echo + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + else + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir="$ladir" + fi + ;; + esac + func_basename "$lib" + laname="$func_basename_result" + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$lt_sysroot$libdir" + absdir="$lt_sysroot$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + fi + case "$host" in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + echo + if test "$linkmode" = prog; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc*) + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$opt_mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$absdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$opt_mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system can not link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path="$deplib" ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" + path= + fi + fi + ;; + *) + path="-L$absdir/$objdir" + ;; + esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + shift + IFS="$save_ifs" + + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$1" + number_minor="$2" + number_revision="$3" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + # correct linux to gnu/linux during the next big refactor + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|qnx|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + esac + ;; + no) + current="$1" + revision="$2" + age="$3" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current" + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) # correct to gnu/linux during the next big refactor + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + func_append verstring ":${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + + *) + func_fatal_configuration "unknown library version type \`$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + fi + + func_generate_dlsyms "$libname" "$libname" "yes" + func_append libobjs " $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$opt_mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs="$new_libs" + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + # Remove ${wl} instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$opt_mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname="$1" + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd1 in $cmds; do + IFS="$save_ifs" + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test "$try_normal_branch" = yes \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=${output_objdir}/${output_la}.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\${concat_cmds}$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + fi + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" + + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " ${wl}-bind_at_load" + func_append finalize_command " ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append finalize_perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=yes + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=no + ;; + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + fi + + exit $exit_status + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + func_append oldobjs " $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase="$func_basename_result" + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name="$func_basename_result" + func_resolve_sysroot "$deplib" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test "x$bindir" != x ; + then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +{ test "$opt_mode" = link || test "$opt_mode" = relink; } && + func_mode_link ${1+"$@"} + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=yes ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + odir="$objdir" + else + odir="$dir/$objdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$opt_mode" = uninstall && odir="$dir" + + # Remember odir for removal later, being careful to avoid duplicates + if test "$opt_mode" = clean; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case "$opt_mode" in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && + test "$pic_object" != none; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$opt_mode" = clean ; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + func_append rmfiles " $odir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$opt_mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# vi:sw=2 + diff -Nru spice-gtk-0.9/spice-common/build-aux/missing spice-gtk-0.12/spice-common/build-aux/missing --- spice-gtk-0.9/spice-common/build-aux/missing 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/build-aux/missing 2012-04-24 11:20:55.000000000 +0000 @@ -0,0 +1,331 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2012-01-06.13; # UTC + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru spice-gtk-0.9/spice-common/common/backtrace.c spice-gtk-0.12/spice-common/common/backtrace.c --- spice-gtk-0.9/spice-common/common/backtrace.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/backtrace.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,136 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2011 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +/* + * Taken from xserver os/backtrace.c: + * Copyright (C) 2008 Red Hat, Inc. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#ifndef __MINGW32__ +#include +#endif + +#include "spice_common.h" + +#define GSTACK_PATH "/usr/bin/gstack" + +#if HAVE_EXECINFO_H +#include + +static void spice_backtrace_backtrace(void) +{ + void *array[100]; + int size; + + size = backtrace(array, sizeof(array)/sizeof(array[0])); + backtrace_symbols_fd(array, size, STDERR_FILENO); +} +#else +static void spice_backtrace_backtrace(void) +{ +} +#endif + +/* XXX perhaps gstack can be available in windows but pipe/waitpid isn't, + * so until it is ported properly just compile it out, we lose the + * backtrace only. */ +#ifndef __MINGW32__ +static int spice_backtrace_gstack(void) +{ + pid_t kidpid; + int pipefd[2]; + + if (pipe(pipefd) != 0) { + return -1; + } + + kidpid = fork(); + + if (kidpid == -1) { + /* ERROR */ + return -1; + } else if (kidpid == 0) { + /* CHILD */ + char parent[16]; + + seteuid(0); + close(STDIN_FILENO); + close(STDOUT_FILENO); + dup2(pipefd[1],STDOUT_FILENO); + close(STDERR_FILENO); + + snprintf(parent, sizeof(parent), "%d", getppid()); + execle(GSTACK_PATH, "gstack", parent, NULL, NULL); + exit(1); + } else { + /* PARENT */ + char btline[256]; + int kidstat; + int bytesread; + int done = 0; + + close(pipefd[1]); + + while (!done) { + bytesread = read(pipefd[0], btline, sizeof(btline) - 1); + + if (bytesread > 0) { + btline[bytesread] = 0; + fprintf(stderr, "%s", btline); + } + else if ((bytesread == 0) || + ((errno != EINTR) && (errno != EAGAIN))) { + done = 1; + } + } + close(pipefd[0]); + waitpid(kidpid, &kidstat, 0); + if (kidstat != 0) + return -1; + } + return 0; +} +#else +static int spice_backtrace_gstack(void) +{ + /* empty failing implementation */ + return -1; +} +#endif + +void spice_backtrace(void) +{ + int ret = -1; + + if (!access(GSTACK_PATH, X_OK)) { + ret = spice_backtrace_gstack(); + } + if (ret != 0) { + spice_backtrace_backtrace(); + } +} diff -Nru spice-gtk-0.9/spice-common/common/backtrace.h spice-gtk-0.12/spice-common/common/backtrace.h --- spice-gtk-0.9/spice-common/common/backtrace.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/backtrace.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,34 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2011 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef BACKTRACE_H +#define BACKTRACE_H + +#include + +SPICE_BEGIN_DECLS + +#if defined(WIN32) && !defined(__MINGW32__) +#define spice_backtrace() +#else +void spice_backtrace(void); +#endif + +SPICE_END_DECLS + +#endif // BACKTRACE_H diff -Nru spice-gtk-0.9/spice-common/common/bitops.h spice-gtk-0.12/spice-common/common/bitops.h --- spice-gtk-0.9/spice-common/common/bitops.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/bitops.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,87 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef BITOPS_H +#define BITOPS_H + +#include + +SPICE_BEGIN_DECLS + +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +static inline int spice_bit_find_msb(unsigned int val) +{ + int ret; + + asm ("bsrl %1,%0\n\t" + "jnz 1f\n\t" + "movl $-1,%0\n" + "1:" + : "=r"(ret) : "r"(val)); + return ret + 1; +} + +#elif defined(WIN32) && !defined(_WIN64) +static INLINE int spice_bit_find_msb(uint32_t val) +{ + uint32_t r; + __asm { + bsr eax, val + jnz found + mov eax, -1 + +found: + mov r, eax + } + return r + 1; +} + +#else +static INLINE int spice_bit_find_msb(unsigned int val) +{ + signed char index = 31; + + if(val == 0) { + return 0; + } + + do { + if(val & 0x80000000) { + break; + } + val <<= 1; + } while(--index >= 0); + + return index+1; +} + +#endif + +static INLINE int spice_bit_next_pow2(unsigned int val) +{ + if ((val & (val - 1)) == 0) { + return val; + } + return 1 << spice_bit_find_msb(val); +} + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/canvas_base.c spice-gtk-0.12/spice-common/common/canvas_base.c --- spice-gtk-0.9/spice-common/common/canvas_base.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/canvas_base.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,3399 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include + +#include +#include "log.h" +#include "quic.h" +#include "lz.h" +#include "canvas_base.h" +#include "pixman_utils.h" +#include "canvas_utils.h" +#include "rect.h" +#include "lines.h" +#include "rop3.h" +#include "mem.h" +#include "macros.h" +#include "mutex.h" + +#define ROUND(_x) ((int)floor((_x) + 0.5)) + +#define IS_IMAGE_LOSSY(descriptor) \ + (((descriptor)->type == SPICE_IMAGE_TYPE_JPEG) || \ + ((descriptor)->type == SPICE_IMAGE_TYPE_JPEG_ALPHA)) + + static inline int fix_to_int(SPICE_FIXED28_4 fixed) +{ + int val, rem; + + rem = fixed & 0x0f; + val = fixed >> 4; + if (rem > 8) { + val++; + } + return val; +} + + static inline SPICE_FIXED28_4 int_to_fix(int v) +{ + return v << 4; +} + +static inline double fix_to_double(SPICE_FIXED28_4 fixed) +{ + return (double)(fixed & 0x0f) / 0x0f + (fixed >> 4); +} + +static inline uint16_t rgb_32_to_16_555(uint32_t color) +{ + return + (((color) >> 3) & 0x001f) | + (((color) >> 6) & 0x03e0) | + (((color) >> 9) & 0x7c00); +} +static inline uint16_t rgb_32_to_16_565(uint32_t color) +{ + return + (((color) >> 3) & 0x001f) | + (((color) >> 5) & 0x07e0) | + (((color) >> 8) & 0xf800); +} + +static inline uint32_t canvas_16bpp_to_32bpp(uint32_t color) +{ + uint32_t ret; + + ret = ((color & 0x001f) << 3) | ((color & 0x001c) >> 2); + ret |= ((color & 0x03e0) << 6) | ((color & 0x0380) << 1); + ret |= ((color & 0x7c00) << 9) | ((color & 0x7000) << 4); + + return ret; +} +#if defined(WIN32) && defined(GDI_CANVAS) +static HDC create_compatible_dc() +{ + HDC dc = CreateCompatibleDC(NULL); + + spice_return_val_if_fail(dc != NULL, NULL); + + return dc; +} + +#endif + +typedef struct LzData { + LzUsrContext usr; + LzContext *lz; + LzDecodeUsrData decode_data; + jmp_buf jmp_env; + char message_buf[512]; +} LzData; + +typedef struct GlzData { + SpiceGlzDecoder *decoder; + LzDecodeUsrData decode_data; +} GlzData; + +typedef struct QuicData { + QuicUsrContext usr; + QuicContext *quic; + jmp_buf jmp_env; + char message_buf[512]; + SpiceChunks *chunks; + uint32_t current_chunk; +} QuicData; + +typedef struct CanvasBase { + SpiceCanvas parent; + uint32_t color_shift; + uint32_t color_mask; + QuicData quic_data; + + uint32_t format; + int width; + int height; + pixman_region32_t canvas_region; + +#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) + SpiceImageCache *bits_cache; +#endif +#ifdef SW_CANVAS_CACHE + SpicePaletteCache *palette_cache; +#endif +#ifdef WIN32 + HDC dc; +#endif + + SpiceImageSurfaces *surfaces; + + LzData lz_data; + GlzData glz_data; + SpiceJpegDecoder* jpeg; + SpiceZlibDecoder* zlib; + + void *usr_data; + spice_destroy_fn_t usr_data_destroy; +} CanvasBase; + +typedef enum { + ROP_INPUT_SRC, + ROP_INPUT_BRUSH, + ROP_INPUT_DEST +} ROPInput; + +static SpiceROP ropd_descriptor_to_rop(int desc, + ROPInput src_input, + ROPInput dest_input) +{ + int old; + int invert_masks[] = { + SPICE_ROPD_INVERS_SRC, + SPICE_ROPD_INVERS_BRUSH, + SPICE_ROPD_INVERS_DEST + }; + + old = desc; + + desc &= ~(SPICE_ROPD_INVERS_SRC | SPICE_ROPD_INVERS_DEST); + if (old & invert_masks[src_input]) { + desc |= SPICE_ROPD_INVERS_SRC; + } + + if (old & invert_masks[dest_input]) { + desc |= SPICE_ROPD_INVERS_DEST; + } + + if (desc & SPICE_ROPD_OP_PUT) { + if (desc & SPICE_ROPD_INVERS_SRC) { + if (desc & SPICE_ROPD_INVERS_RES) { + return SPICE_ROP_COPY; + } + return SPICE_ROP_COPY_INVERTED; + } else { + if (desc & SPICE_ROPD_INVERS_RES) { + return SPICE_ROP_COPY_INVERTED; + } + return SPICE_ROP_COPY; + } + } else if (desc & SPICE_ROPD_OP_OR) { + + if (desc & SPICE_ROPD_INVERS_RES) { + if (desc & SPICE_ROPD_INVERS_SRC) { + if (desc & SPICE_ROPD_INVERS_DEST) { + /* !(!src or !dest) == src and dest*/ + return SPICE_ROP_AND; + } else { + /* ! (!src or dest) = src and !dest*/ + return SPICE_ROP_AND_REVERSE; + } + } else { + if (desc & SPICE_ROPD_INVERS_DEST) { + /* !(src or !dest) == !src and dest */ + return SPICE_ROP_AND_INVERTED; + } else { + /* !(src or dest) */ + return SPICE_ROP_NOR; + } + } + } else { + if (desc & SPICE_ROPD_INVERS_SRC) { + if (desc & SPICE_ROPD_INVERS_DEST) { + /* !src or !dest == !(src and dest)*/ + return SPICE_ROP_NAND; + } else { + /* !src or dest */ + return SPICE_ROP_OR_INVERTED; + } + } else { + if (desc & SPICE_ROPD_INVERS_DEST) { + /* src or !dest */ + return SPICE_ROP_OR_REVERSE; + } else { + /* src or dest */ + return SPICE_ROP_OR; + } + } + } + + } else if (desc & SPICE_ROPD_OP_AND) { + + if (desc & SPICE_ROPD_INVERS_RES) { + if (desc & SPICE_ROPD_INVERS_SRC) { + if (desc & SPICE_ROPD_INVERS_DEST) { + /* !(!src and !dest) == src or dest*/ + return SPICE_ROP_OR; + } else { + /* ! (!src and dest) = src or !dest*/ + return SPICE_ROP_OR_REVERSE; + } + } else { + if (desc & SPICE_ROPD_INVERS_DEST) { + /* !(src and !dest) == !src or dest */ + return SPICE_ROP_OR_INVERTED; + } else { + /* !(src and dest) */ + return SPICE_ROP_NAND; + } + } + } else { + if (desc & SPICE_ROPD_INVERS_SRC) { + if (desc & SPICE_ROPD_INVERS_DEST) { + /* !src and !dest == !(src or dest)*/ + return SPICE_ROP_NOR; + } else { + /* !src and dest */ + return SPICE_ROP_AND_INVERTED; + } + } else { + if (desc & SPICE_ROPD_INVERS_DEST) { + /* src and !dest */ + return SPICE_ROP_AND_REVERSE; + } else { + /* src and dest */ + return SPICE_ROP_AND; + } + } + } + + } else if (desc & SPICE_ROPD_OP_XOR) { + + if (desc & SPICE_ROPD_INVERS_RES) { + if (desc & SPICE_ROPD_INVERS_SRC) { + if (desc & SPICE_ROPD_INVERS_DEST) { + /* !(!src xor !dest) == !src xor dest */ + return SPICE_ROP_EQUIV; + } else { + /* ! (!src xor dest) = src xor dest*/ + return SPICE_ROP_XOR; + } + } else { + if (desc & SPICE_ROPD_INVERS_DEST) { + /* !(src xor !dest) == src xor dest */ + return SPICE_ROP_XOR; + } else { + /* !(src xor dest) */ + return SPICE_ROP_EQUIV; + } + } + } else { + if (desc & SPICE_ROPD_INVERS_SRC) { + if (desc & SPICE_ROPD_INVERS_DEST) { + /* !src xor !dest == src xor dest */ + return SPICE_ROP_XOR; + } else { + /* !src xor dest */ + return SPICE_ROP_EQUIV; + } + } else { + if (desc & SPICE_ROPD_INVERS_DEST) { + /* src xor !dest */ + return SPICE_ROP_EQUIV; + } else { + /* src xor dest */ + return SPICE_ROP_XOR; + } + } + } + + } else if (desc & SPICE_ROPD_OP_BLACKNESS) { + return SPICE_ROP_CLEAR; + } else if (desc & SPICE_ROPD_OP_WHITENESS) { + return SPICE_ROP_SET; + } else if (desc & SPICE_ROPD_OP_INVERS) { + return SPICE_ROP_INVERT; + } + return SPICE_ROP_COPY; +} + +//#define DEBUG_DUMP_COMPRESS +#ifdef DEBUG_DUMP_COMPRESS +static void dump_surface(pixman_image_t *surface, int cache); +#endif + + +static pixman_format_code_t canvas_get_target_format(CanvasBase *canvas, + int source_has_alpha) +{ + pixman_format_code_t format; + + /* Convert to target surface format */ + format = spice_surface_format_to_pixman (canvas->format); + + if (source_has_alpha) { + /* Even though the destination has no alpha, we make the source + * remember there are alpha bits instead of throwing away this + * information. The results are the same if alpha is not + * interpreted, and if need to interpret alpha, don't use + * conversion to target format. + * This is needed for instance when doing the final + * canvas_get_target_format() in canvas_get_image_internal + * as otherwise we wouldn't know if the bitmap source + * really had alpha. + */ + if (format == PIXMAN_x8r8g8b8) { + format = PIXMAN_a8r8g8b8; + } + } else { /* !source_has_alpha */ + /* If the source doesn't have alpha, but the destination has, + don't convert to alpha, since that would just do an unnecessary + copy to fill the alpha bytes with 0xff which is not expected if + we just use the raw bits, (and handled implicitly by pixman if + we're interpreting data) */ + if (format == PIXMAN_a8r8g8b8) { + format = PIXMAN_x8r8g8b8; + } + } + + return format; +} + +static pixman_image_t *canvas_get_quic(CanvasBase *canvas, SpiceImage *image, + int invers, int want_original) +{ + pixman_image_t *surface = NULL; + QuicData *quic_data = &canvas->quic_data; + QuicImageType type, as_type; + pixman_format_code_t pixman_format; + uint8_t *dest; + int stride; + int width; + int height; + + if (setjmp(quic_data->jmp_env)) { + pixman_image_unref(surface); + spice_warning("%s", quic_data->message_buf); + return NULL; + } + + quic_data->chunks = image->u.quic.data; + quic_data->current_chunk = 0; + + if (quic_decode_begin(quic_data->quic, + (uint32_t *)image->u.quic.data->chunk[0].data, + image->u.quic.data->chunk[0].len >> 2, + &type, &width, &height) == QUIC_ERROR) { + spice_warning("quic decode begin failed"); + return NULL; + } + + switch (type) { + case QUIC_IMAGE_TYPE_RGBA: + as_type = QUIC_IMAGE_TYPE_RGBA; + pixman_format = PIXMAN_a8r8g8b8; + break; + case QUIC_IMAGE_TYPE_RGB32: + case QUIC_IMAGE_TYPE_RGB24: + as_type = QUIC_IMAGE_TYPE_RGB32; + pixman_format = PIXMAN_x8r8g8b8; + break; + case QUIC_IMAGE_TYPE_RGB16: + if (!want_original && + (canvas->format == SPICE_SURFACE_FMT_32_xRGB || + canvas->format == SPICE_SURFACE_FMT_32_ARGB)) { + as_type = QUIC_IMAGE_TYPE_RGB32; + pixman_format = PIXMAN_x8r8g8b8; + } else { + as_type = QUIC_IMAGE_TYPE_RGB16; + pixman_format = PIXMAN_x1r5g5b5; + } + break; + case QUIC_IMAGE_TYPE_INVALID: + case QUIC_IMAGE_TYPE_GRAY: + default: + spice_warn_if_reached(); + return NULL; + } + + spice_return_val_if_fail((uint32_t)width == image->descriptor.width, NULL); + spice_return_val_if_fail((uint32_t)height == image->descriptor.height, NULL); + + surface = surface_create( +#ifdef WIN32 + canvas->dc, +#endif + pixman_format, + width, height, FALSE); + + spice_return_val_if_fail(surface != NULL, NULL); + + dest = (uint8_t *)pixman_image_get_data(surface); + stride = pixman_image_get_stride(surface); + if (quic_decode(quic_data->quic, as_type, + dest, stride) == QUIC_ERROR) { + pixman_image_unref(surface); + spice_warning("quic decode failed"); + return NULL; + } + + if (invers) { + uint8_t *end = dest + height * stride; + for (; dest != end; dest += stride) { + uint32_t *pix; + uint32_t *end_pix; + + pix = (uint32_t *)dest; + end_pix = pix + width; + for (; pix < end_pix; pix++) { + *pix ^= 0xffffffff; + } + } + } + +#ifdef DEBUG_DUMP_COMPRESS + dump_surface(surface, 0); +#endif + return surface; +} + + +//#define DUMP_JPEG +#ifdef DUMP_JPEG +static int jpeg_id = 0; +static void dump_jpeg(uint8_t* data, int data_size) +{ + char file_str[200]; + uint32_t id = ++jpeg_id; + +#ifdef WIN32 + sprintf(file_str, "c:\\tmp\\spice_dump\\%u.jpg", id); +#else + sprintf(file_str, "/tmp/spice_dump/%u.jpg", id); +#endif + + FILE *f = fopen(file_str, "wb"); + if (!f) { + return; + } + + fwrite(data, 1, data_size, f); + fclose(f); +} +#endif + +static pixman_image_t *canvas_get_jpeg(CanvasBase *canvas, SpiceImage *image, int invers) +{ + pixman_image_t *surface = NULL; + int stride; + int width; + int height; + uint8_t *dest; + + spice_return_val_if_fail(image->u.jpeg.data->num_chunks == 1, NULL); + canvas->jpeg->ops->begin_decode(canvas->jpeg, image->u.jpeg.data->chunk[0].data, image->u.jpeg.data->chunk[0].len, + &width, &height); + spice_return_val_if_fail((uint32_t)width == image->descriptor.width, NULL); + spice_return_val_if_fail((uint32_t)height == image->descriptor.height, NULL); + + surface = surface_create( +#ifdef WIN32 + canvas->dc, +#endif + PIXMAN_x8r8g8b8, + width, height, FALSE); + if (surface == NULL) { + spice_warning("create surface failed"); + return NULL; + } + + dest = (uint8_t *)pixman_image_get_data(surface); + stride = pixman_image_get_stride(surface); + + canvas->jpeg->ops->decode(canvas->jpeg, dest, stride, SPICE_BITMAP_FMT_32BIT); + + if (invers) { + uint8_t *end = dest + height * stride; + for (; dest != end; dest += stride) { + uint32_t *pix; + uint32_t *end_pix; + + pix = (uint32_t *)dest; + end_pix = pix + width; + for (; pix < end_pix; pix++) { + *pix ^= 0x00ffffff; + } + } + } +#ifdef DUMP_JPEG + dump_jpeg(image->u.jpeg.data, image->u.jpeg.data_size); +#endif + return surface; +} + +static pixman_image_t *canvas_get_jpeg_alpha(CanvasBase *canvas, + SpiceImage *image, int invers) +{ + pixman_image_t *surface = NULL; + int stride; + int width; + int height; + uint8_t *dest; + int alpha_top_down = FALSE; + LzData *lz_data = &canvas->lz_data; + LzImageType lz_alpha_type; + uint8_t *comp_alpha_buf = NULL; + uint8_t *decomp_alpha_buf = NULL; + int alpha_size; + int lz_alpha_width, lz_alpha_height, n_comp_pixels, lz_alpha_top_down; + + spice_return_val_if_fail(image->u.jpeg_alpha.data->num_chunks == 1, NULL); + canvas->jpeg->ops->begin_decode(canvas->jpeg, + image->u.jpeg_alpha.data->chunk[0].data, + image->u.jpeg_alpha.jpeg_size, + &width, &height); + spice_return_val_if_fail((uint32_t)width == image->descriptor.width, NULL); + spice_return_val_if_fail((uint32_t)height == image->descriptor.height, NULL); + + if (image->u.jpeg_alpha.flags & SPICE_JPEG_ALPHA_FLAGS_TOP_DOWN) { + alpha_top_down = TRUE; + } + +#ifdef WIN32 + lz_data->decode_data.dc = canvas->dc; +#endif + surface = alloc_lz_image_surface(&lz_data->decode_data, PIXMAN_a8r8g8b8, + width, height, width*height, alpha_top_down); + + if (surface == NULL) { + spice_warning("create surface failed"); + return NULL; + } + + dest = (uint8_t *)pixman_image_get_data(surface); + stride = pixman_image_get_stride(surface); + + canvas->jpeg->ops->decode(canvas->jpeg, dest, stride, SPICE_BITMAP_FMT_32BIT); + + comp_alpha_buf = image->u.jpeg_alpha.data->chunk[0].data + image->u.jpeg_alpha.jpeg_size; + alpha_size = image->u.jpeg_alpha.data_size - image->u.jpeg_alpha.jpeg_size; + + lz_decode_begin(lz_data->lz, comp_alpha_buf, alpha_size, &lz_alpha_type, + &lz_alpha_width, &lz_alpha_height, &n_comp_pixels, + &lz_alpha_top_down, NULL); + spice_return_val_if_fail(lz_alpha_type == LZ_IMAGE_TYPE_XXXA, NULL); + spice_return_val_if_fail(!!lz_alpha_top_down == !!alpha_top_down, NULL); + spice_return_val_if_fail(lz_alpha_width == width, NULL); + spice_return_val_if_fail(lz_alpha_height == height, NULL); + spice_return_val_if_fail(n_comp_pixels == width * height, NULL); + + if (!alpha_top_down) { + decomp_alpha_buf = dest + stride * (height - 1); + } else { + decomp_alpha_buf = dest; + } + lz_decode(lz_data->lz, LZ_IMAGE_TYPE_XXXA, decomp_alpha_buf); + + if (invers) { + uint8_t *end = dest + height * stride; + for (; dest != end; dest += stride) { + uint32_t *pix; + uint32_t *end_pix; + + pix = (uint32_t *)dest; + end_pix = pix + width; + for (; pix < end_pix; pix++) { + *pix ^= 0x00ffffff; + } + } + } +#ifdef DUMP_JPEG + dump_jpeg(image->u.jpeg_alpha.data, image->u.jpeg_alpha.jpeg_size); +#endif + return surface; +} + +static pixman_image_t *canvas_bitmap_to_surface(CanvasBase *canvas, SpiceBitmap* bitmap, + SpicePalette *palette, int want_original) +{ + uint8_t* src; + pixman_image_t *image; + pixman_format_code_t format; + + spice_chunks_linearize(bitmap->data); + + src = bitmap->data->chunk[0].data; + + if (want_original) { + format = spice_bitmap_format_to_pixman(bitmap->format, canvas->format); + } else { + format = canvas_get_target_format(canvas, + bitmap->format == SPICE_BITMAP_FMT_RGBA); + } + + image = surface_create( +#ifdef WIN32 + canvas->dc, +#endif + format, + bitmap->x, bitmap->y, FALSE); + if (image == NULL) { + spice_warning("create surface failed"); + return NULL; + } + + spice_bitmap_convert_to_pixman(format, image, + bitmap->format, + bitmap->flags, + bitmap->x, bitmap->y, + src, bitmap->stride, + canvas->format, palette); + return image; +} + + +#ifdef SW_CANVAS_CACHE + +static inline SpicePalette *canvas_get_palette(CanvasBase *canvas, SpicePalette *base_palette, uint64_t palette_id, uint8_t flags) +{ + SpicePalette *palette; + + if (flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE) { + palette = canvas->palette_cache->ops->get(canvas->palette_cache, palette_id); + } else { + palette = base_palette; + if (palette != NULL && flags & SPICE_BITMAP_FLAGS_PAL_CACHE_ME) { + canvas->palette_cache->ops->put(canvas->palette_cache, palette); + } + } + return palette; +} + +static inline SpicePalette *canvas_get_localized_palette(CanvasBase *canvas, SpicePalette *base_palette, uint64_t palette_id, uint8_t flags, int *free_palette) +{ + SpicePalette *palette = canvas_get_palette(canvas, base_palette, palette_id, flags); + SpicePalette *copy; + uint32_t *now, *end; + size_t size; + + if (canvas->format == SPICE_SURFACE_FMT_32_xRGB || + canvas->format == SPICE_SURFACE_FMT_32_ARGB) { + return palette; + } + + size = sizeof(SpicePalette) + palette->num_ents * 4; + copy = (SpicePalette *)spice_malloc(size); + memcpy(copy, palette, size); + + switch (canvas->format) { + case SPICE_SURFACE_FMT_32_xRGB: + case SPICE_SURFACE_FMT_32_ARGB: + /* Won't happen */ + break; + case SPICE_SURFACE_FMT_16_555: + now = copy->ents; + end = now + copy->num_ents; + for (; now < end; now++) { + *now = canvas_16bpp_to_32bpp(*now); + } + break; + case SPICE_SURFACE_FMT_16_565: + default: + spice_warn_if_reached(); + return NULL; + } + *free_palette = TRUE; + return copy; +} + +static pixman_image_t *canvas_get_lz(CanvasBase *canvas, SpiceImage *image, int invers, + int want_original) +{ + LzData *lz_data = &canvas->lz_data; + uint8_t *comp_buf = NULL; + int comp_size; + uint8_t *decomp_buf = NULL; + uint8_t *src; + pixman_format_code_t pixman_format; + LzImageType type, as_type; + SpicePalette *palette; + int n_comp_pixels; + int width; + int height; + int top_down; + int stride; + int free_palette; + + if (setjmp(lz_data->jmp_env)) { + free(decomp_buf); + spice_warning("%s", lz_data->message_buf); + return NULL; + } + + free_palette = FALSE; + if (image->descriptor.type == SPICE_IMAGE_TYPE_LZ_RGB) { + spice_return_val_if_fail(image->u.lz_rgb.data->num_chunks == 1, NULL); /* TODO: Handle chunks */ + comp_buf = image->u.lz_rgb.data->chunk[0].data; + comp_size = image->u.lz_rgb.data->chunk[0].len; + palette = NULL; + } else if (image->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) { + spice_return_val_if_fail(image->u.lz_plt.data->num_chunks == 1, NULL); /* TODO: Handle chunks */ + comp_buf = image->u.lz_plt.data->chunk[0].data; + comp_size = image->u.lz_plt.data->chunk[0].len; + palette = canvas_get_localized_palette(canvas, image->u.lz_plt.palette, image->u.lz_plt.palette_id, image->u.lz_plt.flags, &free_palette); + } else { + spice_warn_if_reached(); + return NULL; + } + + lz_decode_begin(lz_data->lz, comp_buf, comp_size, &type, + &width, &height, &n_comp_pixels, &top_down, palette); + + switch (type) { + case LZ_IMAGE_TYPE_RGBA: + as_type = LZ_IMAGE_TYPE_RGBA; + pixman_format = PIXMAN_a8r8g8b8; + break; + case LZ_IMAGE_TYPE_RGB32: + case LZ_IMAGE_TYPE_RGB24: + case LZ_IMAGE_TYPE_PLT1_LE: + case LZ_IMAGE_TYPE_PLT1_BE: + case LZ_IMAGE_TYPE_PLT4_LE: + case LZ_IMAGE_TYPE_PLT4_BE: + case LZ_IMAGE_TYPE_PLT8: + as_type = LZ_IMAGE_TYPE_RGB32; + pixman_format = PIXMAN_x8r8g8b8; + break; + case LZ_IMAGE_TYPE_RGB16: + if (!want_original && + (canvas->format == SPICE_SURFACE_FMT_32_xRGB || + canvas->format == SPICE_SURFACE_FMT_32_ARGB)) { + as_type = LZ_IMAGE_TYPE_RGB32; + pixman_format = PIXMAN_x8r8g8b8; + } else { + as_type = LZ_IMAGE_TYPE_RGB16; + pixman_format = PIXMAN_x1r5g5b5; + } + break; + default: + spice_warn_if_reached(); + return NULL; + } + + spice_return_val_if_fail((unsigned)width == image->descriptor.width, NULL); + spice_return_val_if_fail((unsigned)height == image->descriptor.height, NULL); + + spice_return_val_if_fail((image->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) || (n_comp_pixels == width * height), NULL); +#ifdef WIN32 + lz_data->decode_data.dc = canvas->dc; +#endif + + + alloc_lz_image_surface(&lz_data->decode_data, pixman_format, + width, height, n_comp_pixels, top_down); + + src = (uint8_t *)pixman_image_get_data(lz_data->decode_data.out_surface); + + stride = (n_comp_pixels / height) * 4; + if (!top_down) { + stride = -stride; + decomp_buf = src + stride * (height - 1); + } else { + decomp_buf = src; + } + + lz_decode(lz_data->lz, as_type, decomp_buf); + + if (invers) { + uint8_t *line = src; + uint8_t *end = src + height * stride; + for (; line != end; line += stride) { + uint32_t *pix; + uint32_t *end_pix; + + pix = (uint32_t *)line; + end_pix = pix + width; + for (; pix < end_pix; pix++) { + *pix ^= 0xffffffff; + } + } + } + + if (free_palette) { + free(palette); + } + + return lz_data->decode_data.out_surface; +} + +static pixman_image_t *canvas_get_glz_rgb_common(CanvasBase *canvas, uint8_t *data, + int want_original) +{ + spice_return_val_if_fail(canvas->glz_data.decoder != NULL, NULL); + + canvas->glz_data.decoder->ops->decode(canvas->glz_data.decoder, + data, NULL, + &canvas->glz_data.decode_data); + + /* global_decode calls alloc_lz_image, which sets canvas->glz_data.surface */ + return (canvas->glz_data.decode_data.out_surface); +} + +// don't handle plts since bitmaps with plt can be decoded globally to RGB32 (because +// same byte sequence can be transformed to different RGB pixels by different plts) +static pixman_image_t *canvas_get_glz(CanvasBase *canvas, SpiceImage *image, + int want_original) +{ + spice_return_val_if_fail(image->descriptor.type == SPICE_IMAGE_TYPE_GLZ_RGB, NULL); +#ifdef WIN32 + canvas->glz_data.decode_data.dc = canvas->dc; +#endif + + spice_return_val_if_fail(image->u.lz_rgb.data->num_chunks == 1, NULL); /* TODO: Handle chunks */ + return canvas_get_glz_rgb_common(canvas, image->u.lz_rgb.data->chunk[0].data, want_original); +} + +static pixman_image_t *canvas_get_zlib_glz_rgb(CanvasBase *canvas, SpiceImage *image, + int want_original) +{ + uint8_t *glz_data; + pixman_image_t *surface; + + spice_return_val_if_fail(canvas->zlib != NULL, NULL); + + spice_return_val_if_fail(image->u.zlib_glz.data->num_chunks == 1, NULL); /* TODO: Handle chunks */ + glz_data = (uint8_t*)spice_malloc(image->u.zlib_glz.glz_data_size); + canvas->zlib->ops->decode(canvas->zlib, image->u.zlib_glz.data->chunk[0].data, + image->u.zlib_glz.data->chunk[0].len, + glz_data, image->u.zlib_glz.glz_data_size); + surface = canvas_get_glz_rgb_common(canvas, glz_data, want_original); + free(glz_data); + return surface; +} + +//#define DEBUG_DUMP_BITMAP + +#ifdef DEBUG_DUMP_BITMAP +static void dump_bitmap(SpiceBitmap *bitmap, SpicePalette *palette) +{ + uint8_t* data = (uint8_t *)SPICE_GET_ADDRESS(bitmap->data); + static uint32_t file_id = 0; + uint32_t i, j; + char file_str[200]; + uint32_t id = ++file_id; + +#ifdef WIN32 + sprintf(file_str, "c:\\tmp\\spice_dump\\%u.%ubpp", id, bitmap->format); +#else + sprintf(file_str, "/tmp/spice_dump/%u.%ubpp", id, bitmap->format); +#endif + FILE *f = fopen(file_str, "wb"); + if (!f) { + return; + } + + fprintf(f, "%d\n", bitmap->format); // 1_LE,1_BE,.... + fprintf(f, "%d %d\n", bitmap->x, bitmap->y); // width and height + fprintf(f, "%d\n", palette->num_ents); // #plt entries + for (i = 0; i < palette->num_ents; i++) { + fwrite(&(palette->ents[i]), 4, 1, f); + } + fprintf(f, "\n"); + + for (i = 0; i < bitmap->y; i++, data += bitmap->stride) { + uint8_t *now = data; + for (j = 0; j < bitmap->x; j++) { + fwrite(now, 1, 1, f); + now++; + } + } +} + +#endif + +static pixman_image_t *canvas_get_bits(CanvasBase *canvas, SpiceBitmap *bitmap, + int want_original) +{ + pixman_image_t* surface; + SpicePalette *palette; + + palette = canvas_get_palette(canvas, bitmap->palette, bitmap->palette_id, bitmap->flags); +#ifdef DEBUG_DUMP_BITMAP + if (palette) { + dump_bitmap(bitmap, palette); + } +#endif + + surface = canvas_bitmap_to_surface(canvas, bitmap, palette, want_original); + + if (palette && (bitmap->flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { + canvas->palette_cache->ops->release(canvas->palette_cache, palette); + } + + return surface; +} + +#else + + +static pixman_image_t *canvas_get_bits(CanvasBase *canvas, SpiceBitmap *bitmap, + int want_original) +{ + SpicePalette *palette; + + if (!bitmap->palette) { + return canvas_bitmap_to_surface(canvas, bitmap, NULL, want_original); + } + palette = (SpicePalette *)SPICE_GET_ADDRESS(bitmap->palette); + return canvas_bitmap_to_surface(canvas, bitmap, palette, want_original); +} + +#endif + + + +// caution: defining DEBUG_DUMP_SURFACE will dump both cached & non-cached +// images to disk. it will reduce performance dramatically & eat +// disk space rapidly. use it only for debugging. +//#define DEBUG_DUMP_SURFACE + +#if defined(DEBUG_DUMP_SURFACE) || defined(DEBUG_DUMP_COMPRESS) + +static void dump_surface(pixman_image_t *surface, int cache) +{ + static uint32_t file_id = 0; + int i, j; + char file_str[200]; + int depth = pixman_image_get_depth(surface); + + if (depth != 24 && depth != 32) { + return; + } + + uint8_t *data = (uint8_t *)pixman_image_get_data(surface); + int width = pixman_image_get_width(surface); + int height = pixman_image_get_height(surface); + int stride = pixman_image_surface_get_stride(surface); + + uint32_t id = ++file_id; +#ifdef WIN32 + sprintf(file_str, "c:\\tmp\\spice_dump\\%d\\%u.ppm", cache, id); +#else + sprintf(file_str, "/tmp/spice_dump/%u.ppm", id); +#endif + FILE *f = fopen(file_str, "wb"); + if (!f) { + return; + } + fprintf(f, "P6\n"); + fprintf(f, "%d %d\n", width, height); + fprintf(f, "#spicec dump\n"); + fprintf(f, "255\n"); + for (i = 0; i < height; i++, data += stride) { + uint8_t *now = data; + for (j = 0; j < width; j++) { + fwrite(&now[2], 1, 1, f); + fwrite(&now[1], 1, 1, f); + fwrite(&now[0], 1, 1, f); + now += 4; + } + } + fclose(f); +} + +#endif + +static SpiceCanvas *canvas_get_surface_internal(CanvasBase *canvas, SpiceImage *image) +{ + if (image->descriptor.type == SPICE_IMAGE_TYPE_SURFACE) { + SpiceSurface *surface = &image->u.surface; + return canvas->surfaces->ops->get(canvas->surfaces, surface->surface_id); + } + return NULL; +} + +static SpiceCanvas *canvas_get_surface_mask_internal(CanvasBase *canvas, SpiceImage *image) +{ + if (image->descriptor.type == SPICE_IMAGE_TYPE_SURFACE) { + SpiceSurface *surface = &image->u.surface; + return canvas->surfaces->ops->get(canvas->surfaces, surface->surface_id); + } + return NULL; +} + +#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) + +//#define DEBUG_LZ + +/* If real get is FALSE, then only do whatever is needed but don't return an image. For instance, + * if we need to read it to cache it we do. + * + * This generally converts the image to the right type for the canvas. + * However, if want_original is set the real source format is returned, and + * you have to be able to handle any image format. This is useful to avoid + * e.g. losing alpha when blending a argb32 image on a rgb16 surface. + */ +static pixman_image_t *canvas_get_image_internal(CanvasBase *canvas, SpiceImage *image, + int want_original, int real_get) +{ + SpiceImageDescriptor *descriptor = &image->descriptor; + pixman_image_t *surface, *converted; + pixman_format_code_t wanted_format, surface_format; + int saved_want_original; + + /* When touching, only really allocate if we need to cache, or + * if we're loading a GLZ stream (since those need inter-thread communication + * to happen which breaks if we don't. */ + if (!real_get && + !(descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME) && +#ifdef SW_CANVAS_CACHE + !(descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME) && +#endif + (descriptor->type != SPICE_IMAGE_TYPE_GLZ_RGB) && + (descriptor->type != SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB)) { + return NULL; + } + + saved_want_original = want_original; + if (descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME +#ifdef SW_CANVAS_CACHE + || descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME +#endif + ) { + want_original = TRUE; + } + + switch (descriptor->type) { + case SPICE_IMAGE_TYPE_QUIC: { + surface = canvas_get_quic(canvas, image, 0, want_original); + break; + } +#if defined(SW_CANVAS_CACHE) + case SPICE_IMAGE_TYPE_LZ_PLT: { + surface = canvas_get_lz(canvas, image, 0, want_original); + break; + } + case SPICE_IMAGE_TYPE_LZ_RGB: { + surface = canvas_get_lz(canvas, image, 0, want_original); + break; + } +#endif + case SPICE_IMAGE_TYPE_JPEG: { + surface = canvas_get_jpeg(canvas, image, 0); + break; + } + case SPICE_IMAGE_TYPE_JPEG_ALPHA: { + surface = canvas_get_jpeg_alpha(canvas, image, 0); + break; + } +#if defined(SW_CANVAS_CACHE) + case SPICE_IMAGE_TYPE_GLZ_RGB: { + surface = canvas_get_glz(canvas, image, want_original); + break; + } + case SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB: { + surface = canvas_get_zlib_glz_rgb(canvas, image, want_original); + break; + } +#endif + case SPICE_IMAGE_TYPE_FROM_CACHE: + surface = canvas->bits_cache->ops->get(canvas->bits_cache, descriptor->id); + break; +#ifdef SW_CANVAS_CACHE + case SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS: + surface = canvas->bits_cache->ops->get_lossless(canvas->bits_cache, descriptor->id); + break; +#endif + case SPICE_IMAGE_TYPE_BITMAP: { + surface = canvas_get_bits(canvas, &image->u.bitmap, want_original); + break; + } + default: + spice_warn_if_reached(); + return NULL; + } + + spice_return_val_if_fail(surface != NULL, NULL); + spice_return_val_if_fail(spice_pixman_image_get_format(surface, &surface_format), NULL); + + if (descriptor->flags & SPICE_IMAGE_FLAGS_HIGH_BITS_SET && + descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE && +#ifdef SW_CANVAS_CACHE + descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS && +#endif + surface_format == PIXMAN_x8r8g8b8) { + spice_pixman_fill_rect_rop(surface, + 0, 0, + pixman_image_get_width(surface), + pixman_image_get_height(surface), + 0xff000000U, SPICE_ROP_OR); + } + + if (descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME && +#ifdef SW_CANVAS_CACHE + descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS && +#endif + descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE ) { +#ifdef SW_CANVAS_CACHE + if (!IS_IMAGE_LOSSY(descriptor)) { + canvas->bits_cache->ops->put(canvas->bits_cache, descriptor->id, surface); + } else { + canvas->bits_cache->ops->put_lossy(canvas->bits_cache, descriptor->id, surface); + } +#else + canvas->bits_cache->ops->put(canvas->bits_cache, descriptor->id, surface); +#endif +#ifdef DEBUG_DUMP_SURFACE + dump_surface(surface, 1); +#endif +#ifdef SW_CANVAS_CACHE + } else if (descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME) { + if (IS_IMAGE_LOSSY(descriptor)) { + spice_warning("invalid cache replace request: the image is lossy"); + return NULL; + } + canvas->bits_cache->ops->replace_lossy(canvas->bits_cache, descriptor->id, surface); +#ifdef DEBUG_DUMP_SURFACE + dump_surface(surface, 1); +#endif +#endif +#ifdef DEBUG_DUMP_SURFACE + } else if (descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE +#ifdef SW_CANVAS_CACHE + && descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS +#endif + ) { + + dump_surface(surface, 0); +#endif + } + + if (!real_get) { + pixman_image_unref(surface); + return NULL; + } + + if (!saved_want_original) { + /* Conversion to canvas format was requested, but maybe it didn't + happen above (due to save/load to cache for instance, or + maybe the reader didn't support conversion). + If so we convert here. */ + + wanted_format = canvas_get_target_format(canvas, + surface_format == PIXMAN_a8r8g8b8); + + if (surface_format != wanted_format) { + converted = surface_create( +#ifdef WIN32 + canvas->dc, +#endif + wanted_format, + pixman_image_get_width(surface), + pixman_image_get_height(surface), + TRUE); + pixman_image_composite32 (PIXMAN_OP_SRC, + surface, NULL, converted, + 0, 0, + 0, 0, + 0, 0, + pixman_image_get_width(surface), + pixman_image_get_height(surface)); + pixman_image_unref (surface); + surface = converted; + } + } + + return surface; +} + +#else + +static pixman_image_t *canvas_get_image_internal(CanvasBase *canvas, SpiceImage *image, + int want_original, int real_get) +{ + SpiceImageDescriptor *descriptor = &image->descriptor; + pixman_format_code_t format; + + /* When touching, never load image. */ + if (!real_get) { + return NULL; + } + + switch (descriptor->type) { + case SPICE_IMAGE_TYPE_QUIC: { + return canvas_get_quic(canvas, image, 0); + } + case SPICE_IMAGE_TYPE_BITMAP: { + return canvas_get_bits(canvas, &image->u.bitmap, want_original, &format); + } + default: + spice_warn_if_reached(); + return NULL; + } + + return NULL; +} + +#endif + +static SpiceCanvas *canvas_get_surface_mask(CanvasBase *canvas, SpiceImage *image) +{ + return canvas_get_surface_mask_internal(canvas, image); +} + +static SpiceCanvas *canvas_get_surface(CanvasBase *canvas, SpiceImage *image) +{ + return canvas_get_surface_internal(canvas, image); +} + +static pixman_image_t *canvas_get_image(CanvasBase *canvas, SpiceImage *image, + int want_original) +{ + return canvas_get_image_internal(canvas, image, want_original, TRUE); +} + +static void canvas_touch_image(CanvasBase *canvas, SpiceImage *image) +{ + canvas_get_image_internal(canvas, image, TRUE, FALSE); +} + +static pixman_image_t* canvas_get_image_from_self(SpiceCanvas *canvas, + int x, int y, + int32_t width, int32_t height) +{ + CanvasBase *canvas_base = (CanvasBase *)canvas; + pixman_image_t *surface; + uint8_t *dest; + int dest_stride; + SpiceRect area; + + surface = pixman_image_create_bits(spice_surface_format_to_pixman (canvas_base->format), + width, height, NULL, 0); + spice_return_val_if_fail(surface != NULL, NULL); + + dest = (uint8_t *)pixman_image_get_data(surface); + dest_stride = pixman_image_get_stride(surface); + + area.left = x; + area.top = y; + area.right = x + width; + area.bottom = y + height; + + canvas->ops->read_bits(canvas, dest, dest_stride, &area); + + return surface; +} + +static inline uint8_t revers_bits(uint8_t byte) +{ + uint8_t ret = 0; + int i; + + for (i = 0; i < 4; i++) { + int shift = 7 - i * 2; + ret |= (byte & (1 << i)) << shift; + ret |= (byte & (0x80 >> i)) >> shift; + } + return ret; +} + +static pixman_image_t *canvas_get_bitmap_mask(CanvasBase *canvas, SpiceBitmap* bitmap, int invers) +{ + pixman_image_t *surface; + uint8_t *src_line; + uint8_t *end_line; + uint8_t *dest_line; + int src_stride; + int line_size; + int dest_stride; + + surface = surface_create( +#ifdef WIN32 + canvas->dc, +#endif + PIXMAN_a1, bitmap->x, bitmap->y, TRUE); + spice_return_val_if_fail(surface != NULL, NULL); + + spice_chunks_linearize(bitmap->data); + src_line = bitmap->data->chunk[0].data; + src_stride = bitmap->stride; + end_line = src_line + (bitmap->y * src_stride); + line_size = SPICE_ALIGN(bitmap->x, 8) >> 3; + + dest_stride = pixman_image_get_stride(surface); + dest_line = (uint8_t *)pixman_image_get_data(surface); +#if defined(GL_CANVAS) + if ((bitmap->flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) { +#else + if (!(bitmap->flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) { +#endif + spice_return_val_if_fail(bitmap->y > 0, NULL); + dest_line += dest_stride * ((int)bitmap->y - 1); + dest_stride = -dest_stride; + } + + if (invers) { + switch (bitmap->format) { +#if defined(GL_CANVAS) || defined(GDI_CANVAS) + case SPICE_BITMAP_FMT_1BIT_BE: +#else + case SPICE_BITMAP_FMT_1BIT_LE: +#endif + for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) { + uint8_t *dest = dest_line; + uint8_t *now = src_line; + uint8_t *end = now + line_size; + while (now < end) { + *(dest++) = ~*(now++); + } + } + break; +#if defined(GL_CANVAS) || defined(GDI_CANVAS) + case SPICE_BITMAP_FMT_1BIT_LE: +#else + case SPICE_BITMAP_FMT_1BIT_BE: +#endif + for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) { + uint8_t *dest = dest_line; + uint8_t *now = src_line; + uint8_t *end = now + line_size; + + while (now < end) { + *(dest++) = ~revers_bits(*(now++)); + } + } + break; + default: + pixman_image_unref(surface); + surface = NULL; + spice_warn_if_reached(); + return NULL; + } + } else { + switch (bitmap->format) { +#if defined(GL_CANVAS) || defined(GDI_CANVAS) + case SPICE_BITMAP_FMT_1BIT_BE: +#else + case SPICE_BITMAP_FMT_1BIT_LE: +#endif + for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) { + memcpy(dest_line, src_line, line_size); + } + break; +#if defined(GL_CANVAS) || defined(GDI_CANVAS) + case SPICE_BITMAP_FMT_1BIT_LE: +#else + case SPICE_BITMAP_FMT_1BIT_BE: +#endif + for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) { + uint8_t *dest = dest_line; + uint8_t *now = src_line; + uint8_t *end = now + line_size; + + while (now < end) { + *(dest++) = revers_bits(*(now++)); + } + } + break; + default: + pixman_image_unref(surface); + surface = NULL; + spice_warn_if_reached(); + return NULL; + } + } + return surface; +} + +static inline pixman_image_t *canvas_A1_invers(pixman_image_t *src_surf) +{ + int width = pixman_image_get_width(src_surf); + int height = pixman_image_get_height(src_surf); + pixman_image_t * invers; + uint8_t *src_line, *end_line, *dest_line; + int src_stride, line_size, dest_stride; + + spice_return_val_if_fail(pixman_image_get_depth(src_surf) == 1, NULL); + + invers = pixman_image_create_bits(PIXMAN_a1, width, height, NULL, 0); + spice_return_val_if_fail(invers != NULL, NULL); + + src_line = (uint8_t *)pixman_image_get_data(src_surf); + src_stride = pixman_image_get_stride(src_surf); + end_line = src_line + (height * src_stride); + line_size = SPICE_ALIGN(width, 8) >> 3; + dest_line = (uint8_t *)pixman_image_get_data(invers); + dest_stride = pixman_image_get_stride(invers); + + for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) { + uint8_t *dest = dest_line; + uint8_t *now = src_line; + uint8_t *end = now + line_size; + while (now < end) { + *(dest++) = ~*(now++); + } + } + return invers; +} + +static pixman_image_t *canvas_get_mask(CanvasBase *canvas, SpiceQMask *mask, int *needs_invert_out) +{ + SpiceImage *image; + pixman_image_t *surface; + int need_invers; + int is_invers; + int cache_me; + + if (needs_invert_out) { + *needs_invert_out = 0; + } + + image = mask->bitmap; + need_invers = mask->flags & SPICE_MASK_FLAGS_INVERS; + +#ifdef SW_CANVAS_CACHE + cache_me = image->descriptor.flags & SPICE_IMAGE_FLAGS_CACHE_ME; +#else + cache_me = 0; +#endif + + switch (image->descriptor.type) { + case SPICE_IMAGE_TYPE_BITMAP: { + is_invers = need_invers && !cache_me; + surface = canvas_get_bitmap_mask(canvas, &image->u.bitmap, is_invers); + break; + } +#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) + case SPICE_IMAGE_TYPE_FROM_CACHE: + surface = canvas->bits_cache->ops->get(canvas->bits_cache, image->descriptor.id); + is_invers = 0; + break; +#endif +#ifdef SW_CANVAS_CACHE + case SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS: + surface = canvas->bits_cache->ops->get_lossless(canvas->bits_cache, image->descriptor.id); + is_invers = 0; + break; +#endif + default: + spice_warn_if_reached(); + return NULL; + } + +#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) + if (cache_me) { + canvas->bits_cache->ops->put(canvas->bits_cache, image->descriptor.id, surface); + } + + if (need_invers && !is_invers) { // surface is in cache + if (needs_invert_out != NULL) { + *needs_invert_out = TRUE; + } else { + pixman_image_t *inv_surf; + inv_surf = canvas_A1_invers(surface); + pixman_image_unref(surface); + surface = inv_surf; + } + } +#endif + return surface; +} + +static inline void canvas_raster_glyph_box(const SpiceRasterGlyph *glyph, SpiceRect *r) +{ + spice_return_if_fail(r != NULL); + + r->top = glyph->render_pos.y + glyph->glyph_origin.y; + r->bottom = r->top + glyph->height; + r->left = glyph->render_pos.x + glyph->glyph_origin.x; + r->right = r->left + glyph->width; +} + +#ifdef GL_CANVAS +static inline void __canvas_put_bits(uint8_t *dest, int offset, uint8_t val, int n) +{ + uint8_t mask; + int now; + + dest = dest + (offset >> 3); + offset &= 0x07; + now = MIN(8 - offset, n); + + mask = ~((1 << (8 - now)) - 1); + mask >>= offset; + *dest = ((val >> offset) & mask) | *dest; + + if ((n = n - now)) { + mask = ~((1 << (8 - n)) - 1); + dest++; + *dest = ((val << now) & mask) | *dest; + } +} + +#else +static inline void __canvas_put_bits(uint8_t *dest, int offset, uint8_t val, int n) +{ + uint8_t mask; + int now; + + dest = dest + (offset >> 3); + offset &= 0x07; + + now = MIN(8 - offset, n); + + mask = (1 << now) - 1; + mask <<= offset; + val = revers_bits(val); + *dest = ((val << offset) & mask) | *dest; + + if ((n = n - now)) { + mask = (1 << n) - 1; + dest++; + *dest = ((val >> now) & mask) | *dest; + } +} + +#endif + +static inline void canvas_put_bits(uint8_t *dest, int dest_offset, uint8_t *src, int n) +{ + while (n) { + int now = MIN(n, 8); + + n -= now; + __canvas_put_bits(dest, dest_offset, *src, now); + dest_offset += now; + src++; + } +} + +static void canvas_put_glyph_bits(SpiceRasterGlyph *glyph, int bpp, uint8_t *dest, int dest_stride, + SpiceRect *bounds) +{ + SpiceRect glyph_box; + uint8_t *src; + int lines; + int width; + + //todo: support SPICE_STRING_FLAGS_RASTER_TOP_DOWN + canvas_raster_glyph_box(glyph, &glyph_box); + spice_return_if_fail(glyph_box.top >= bounds->top && glyph_box.bottom <= bounds->bottom); + spice_return_if_fail(glyph_box.left >= bounds->left && glyph_box.right <= bounds->right); + rect_offset(&glyph_box, -bounds->left, -bounds->top); + + dest += glyph_box.top * dest_stride; + src = glyph->data; + lines = glyph_box.bottom - glyph_box.top; + width = glyph_box.right - glyph_box.left; + switch (bpp) { + case 1: { + int src_stride = SPICE_ALIGN(width, 8) >> 3; + int i; + + src += src_stride * (lines); + for (i = 0; i < lines; i++) { + src -= src_stride; + canvas_put_bits(dest, glyph_box.left, src, width); + dest += dest_stride; + } + break; + } + case 4: { + uint8_t *end; + int src_stride = SPICE_ALIGN(width * 4, 8) >> 3; + + src += src_stride * lines; + dest += glyph_box.left; + end = dest + dest_stride * lines; + for (; dest != end; dest += dest_stride) { + int i = 0; + uint8_t *now; + + src -= src_stride; + now = src; + while (i < (width & ~1)) { + dest[i] = MAX(dest[i], *now & 0xf0); + dest[i + 1] = MAX(dest[i + 1], *now << 4); + i += 2; + now++; + } + if (i < width) { + dest[i] = MAX(dest[i], *now & 0xf0); + now++; + } + } + break; + } + case 8: { + uint8_t *end; + src += width * lines; + dest += glyph_box.left; + end = dest + dest_stride * lines; + for (; dest != end; dest += dest_stride, src -= width) { + int i; + + for (i = 0; i < width; i++) { + dest[i] = MAX(dest[i], src[i]); + } + } + break; + } + default: + spice_warn_if_reached(); + return; + } +} + +static pixman_image_t *canvas_get_str_mask(CanvasBase *canvas, SpiceString *str, int bpp, SpicePoint *pos) +{ + SpiceRasterGlyph *glyph; + SpiceRect bounds; + pixman_image_t *str_mask; + uint8_t *dest; + int dest_stride; + int i; + + spice_return_val_if_fail(str->length > 0, NULL); + + glyph = str->glyphs[0]; + canvas_raster_glyph_box(glyph, &bounds); + + for (i = 1; i < str->length; i++) { + SpiceRect glyph_box; + + canvas_raster_glyph_box(str->glyphs[i], &glyph_box); + rect_union(&bounds, &glyph_box); + } + + str_mask = pixman_image_create_bits((bpp == 1) ? PIXMAN_a1 : PIXMAN_a8, + bounds.right - bounds.left, + bounds.bottom - bounds.top, NULL, 0); + spice_return_val_if_fail(str_mask != NULL, NULL); + + dest = (uint8_t *)pixman_image_get_data(str_mask); + dest_stride = pixman_image_get_stride(str_mask); + for (i = 0; i < str->length; i++) { + glyph = str->glyphs[i]; +#if defined(GL_CANVAS) + canvas_put_glyph_bits(glyph, bpp, dest + (bounds.bottom - bounds.top - 1) * dest_stride, + -dest_stride, &bounds); +#else + canvas_put_glyph_bits(glyph, bpp, dest, dest_stride, &bounds); +#endif + } + + pos->x = bounds.left; + pos->y = bounds.top; + return str_mask; +} + +static pixman_image_t *canvas_scale_surface(pixman_image_t *src, const SpiceRect *src_area, int width, + int height, int scale_mode) +{ + pixman_image_t *surface; + pixman_transform_t transform; + pixman_format_code_t format; + double sx, sy; + + spice_return_val_if_fail(spice_pixman_image_get_format (src, &format), NULL); + + surface = pixman_image_create_bits(format, width, height, NULL, 0); + spice_return_val_if_fail(surface != NULL, NULL); + + sx = (double)(src_area->right - src_area->left) / width; + sy = (double)(src_area->bottom - src_area->top) / height; + + pixman_transform_init_scale(&transform, pixman_double_to_fixed(sx), pixman_double_to_fixed(sy)); + + pixman_image_set_transform (src, &transform); + pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE); + spice_return_val_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE || scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST, NULL); + pixman_image_set_filter(src, + (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ?PIXMAN_FILTER_NEAREST : PIXMAN_FILTER_GOOD, + NULL, 0); + + pixman_image_composite32(PIXMAN_OP_SRC, + src, NULL, surface, + ROUND(src_area->left / sx), ROUND (src_area->top / sy), + 0, 0, /* mask */ + 0, 0, /* dst */ + width, height); + + pixman_transform_init_identity(&transform); + pixman_image_set_transform(src, &transform); + + return surface; +} + +SPICE_ATTR_NORETURN +SPICE_ATTR_PRINTF(2, 3) static void quic_usr_error(QuicUsrContext *usr, const char *fmt, ...) +{ + QuicData *usr_data = (QuicData *)usr; + va_list ap; + + va_start(ap, fmt); + vsnprintf(usr_data->message_buf, sizeof(usr_data->message_buf), fmt, ap); + va_end(ap); + + longjmp(usr_data->jmp_env, 1); +} + +SPICE_ATTR_PRINTF(2, 3) static void quic_usr_warn(QuicUsrContext *usr, const char *fmt, ...) +{ + QuicData *usr_data = (QuicData *)usr; + va_list ap; + + va_start(ap, fmt); + vsnprintf(usr_data->message_buf, sizeof(usr_data->message_buf), fmt, ap); + va_end(ap); +} + +static void *quic_usr_malloc(QuicUsrContext *usr, int size) +{ + return spice_malloc(size); +} + +static void quic_usr_free(QuicUsrContext *usr, void *ptr) +{ + free(ptr); +} + +SPICE_ATTR_PRINTF(2, 3) static void lz_usr_warn(LzUsrContext *usr, const char *fmt, ...) +{ + LzData *usr_data = (LzData *)usr; + va_list ap; + + va_start(ap, fmt); + vsnprintf(usr_data->message_buf, sizeof(usr_data->message_buf), fmt, ap); + va_end(ap); +} + +SPICE_ATTR_NORETURN +SPICE_ATTR_PRINTF(2, 3) static void lz_usr_error(LzUsrContext *usr, const char *fmt, ...) +{ + LzData *usr_data = (LzData *)usr; + va_list ap; + + va_start(ap, fmt); + vsnprintf(usr_data->message_buf, sizeof(usr_data->message_buf), fmt, ap); + va_end(ap); + + longjmp(usr_data->jmp_env, 1); +} + +static void *lz_usr_malloc(LzUsrContext *usr, int size) +{ + return spice_malloc(size); +} + +static void lz_usr_free(LzUsrContext *usr, void *ptr) +{ + free(ptr); +} + +static int lz_usr_more_space(LzUsrContext *usr, uint8_t **io_ptr) +{ + return 0; +} + +static int lz_usr_more_lines(LzUsrContext *usr, uint8_t **lines) +{ + return 0; +} + +static int quic_usr_more_space(QuicUsrContext *usr, uint32_t **io_ptr, int rows_completed) +{ + QuicData *quic_data = (QuicData *)usr; + + if (quic_data->current_chunk == quic_data->chunks->num_chunks -1) { + return 0; + } + quic_data->current_chunk++; + + *io_ptr = (uint32_t *)quic_data->chunks->chunk[quic_data->current_chunk].data; + return quic_data->chunks->chunk[quic_data->current_chunk].len >> 2; +} + + +static int quic_usr_more_lines(QuicUsrContext *usr, uint8_t **lines) +{ + return 0; +} + +static void canvas_base_destroy(CanvasBase *canvas) +{ + quic_destroy(canvas->quic_data.quic); + lz_destroy(canvas->lz_data.lz); +#ifdef GDI_CANVAS + DeleteDC(canvas->dc); +#endif + + if (canvas->usr_data && canvas->usr_data_destroy) { + canvas->usr_data_destroy (canvas->usr_data); + canvas->usr_data = NULL; + } +} + +/* This is kind of lame, but it protects against multiple + instances of these functions. We really should stop including + canvas_base.c and build it separately instead */ +#ifdef CANVAS_SINGLE_INSTANCE + +void spice_canvas_set_usr_data(SpiceCanvas *spice_canvas, + void *data, + spice_destroy_fn_t destroy_fn) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + if (canvas->usr_data && canvas->usr_data_destroy) { + canvas->usr_data_destroy (canvas->usr_data); + } + canvas->usr_data = data; + canvas->usr_data_destroy = destroy_fn; +} + +void *spice_canvas_get_usr_data(SpiceCanvas *spice_canvas) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + return canvas->usr_data; +} +#endif + + +static void canvas_clip_pixman(CanvasBase *canvas, + pixman_region32_t *dest_region, + SpiceClip *clip) +{ + pixman_region32_intersect(dest_region, dest_region, &canvas->canvas_region); + + switch (clip->type) { + case SPICE_CLIP_TYPE_NONE: + break; + case SPICE_CLIP_TYPE_RECTS: { + uint32_t n = clip->rects->num_rects; + SpiceRect *now = clip->rects->rects; + + pixman_region32_t clip; + + if (spice_pixman_region32_init_rects(&clip, now, n)) { + pixman_region32_intersect(dest_region, dest_region, &clip); + pixman_region32_fini(&clip); + } + + break; + } + default: + spice_warn_if_reached(); + return; + } +} + +static void canvas_mask_pixman(CanvasBase *canvas, + pixman_region32_t *dest_region, + SpiceQMask *mask, int x, int y) +{ + SpiceCanvas *surface_canvas; + pixman_image_t *image, *subimage; + int needs_invert; + pixman_region32_t mask_region; + uint32_t *mask_data; + int mask_x, mask_y; + int mask_width, mask_height, mask_stride; + pixman_box32_t extents; + + if (!mask->bitmap) { + return; + } + + surface_canvas = canvas_get_surface_mask(canvas, mask->bitmap); + if (surface_canvas) { + needs_invert = mask->flags & SPICE_MASK_FLAGS_INVERS; + image = surface_canvas->ops->get_image(surface_canvas); + } else { + needs_invert = FALSE; + image = canvas_get_mask(canvas, + mask, + &needs_invert); + } + + mask_data = pixman_image_get_data(image); + mask_width = pixman_image_get_width(image); + mask_height = pixman_image_get_height(image); + mask_stride = pixman_image_get_stride(image); + + mask_x = mask->pos.x; + mask_y = mask->pos.y; + + /* We need to subset the area of the mask that we turn into a region, + because a cached mask may be much larger than what is used for + the clip operation. */ + extents = *pixman_region32_extents(dest_region); + + /* convert from destination pixels to mask pixels */ + extents.x1 -= x - mask_x; + extents.y1 -= y - mask_y; + extents.x2 -= x - mask_x; + extents.y2 -= y - mask_y; + + /* clip to mask size */ + if (extents.x1 < 0) { + extents.x1 = 0; + } + if (extents.x2 >= mask_width) { + extents.x2 = mask_width; + } + if (extents.x2 < extents.x1) { + extents.x2 = extents.x1; + } + if (extents.y1 < 0) { + extents.y1 = 0; + } + if (extents.y2 >= mask_height) { + extents.y2 = mask_height; + } + if (extents.y2 < extents.y1) { + extents.y2 = extents.y1; + } + + /* round down X to even 32 pixels (i.e. uint32_t) */ + extents.x1 = extents.x1 & ~(0x1f); + + mask_data = (uint32_t *)((uint8_t *)mask_data + mask_stride * extents.y1 + extents.x1 / 32); + mask_x -= extents.x1; + mask_y -= extents.y1; + mask_width = extents.x2 - extents.x1; + mask_height = extents.y2 - extents.y1; + + subimage = pixman_image_create_bits(PIXMAN_a1, mask_width, mask_height, + mask_data, mask_stride); + pixman_region32_init_from_image(&mask_region, + subimage); + pixman_image_unref(subimage); + + if (needs_invert) { + pixman_box32_t rect; + + rect.x1 = rect.y1 = 0; + rect.x2 = mask_width; + rect.y2 = mask_height; + + pixman_region32_inverse(&mask_region, &mask_region, &rect); + } + + pixman_region32_translate(&mask_region, + -mask_x + x, -mask_y + y); + + pixman_region32_intersect(dest_region, dest_region, &mask_region); + pixman_region32_fini(&mask_region); + + pixman_image_unref(image); +} + +static void draw_brush(SpiceCanvas *canvas, + pixman_region32_t *region, + SpiceBrush *brush, + SpiceROP rop) +{ + CanvasBase *canvas_base = (CanvasBase *)canvas; + uint32_t color; + SpicePattern *pattern; + pixman_image_t *tile; + int offset_x, offset_y; + pixman_box32_t *rects; + int n_rects; + + rects = pixman_region32_rectangles(region, &n_rects); + + switch (brush->type) { + case SPICE_BRUSH_TYPE_SOLID: + color = brush->u.color; + if (rop == SPICE_ROP_COPY) { + canvas->ops->fill_solid_rects(canvas, rects, n_rects, color); + } else { + canvas->ops->fill_solid_rects_rop(canvas, rects, n_rects, color, rop); + } + break; + case SPICE_BRUSH_TYPE_PATTERN: { + SpiceCanvas *surface_canvas; + + pattern = &brush->u.pattern; + offset_x = pattern->pos.x; + offset_y = pattern->pos.y; + + surface_canvas = canvas_get_surface(canvas_base, pattern->pat); + if (surface_canvas) { + if (rop == SPICE_ROP_COPY) { + canvas->ops->fill_tiled_rects_from_surface(canvas, rects, n_rects, surface_canvas, + offset_x, offset_y); + } else { + canvas->ops->fill_tiled_rects_rop_from_surface(canvas, rects, n_rects, + surface_canvas, offset_x, offset_y, + rop); + } + } else { + tile = canvas_get_image(canvas_base, pattern->pat, FALSE); + spice_return_if_fail(tile != NULL); + + if (rop == SPICE_ROP_COPY) { + canvas->ops->fill_tiled_rects(canvas, rects, n_rects, tile, offset_x, offset_y); + } else { + canvas->ops->fill_tiled_rects_rop(canvas, rects, n_rects, + tile, offset_x, offset_y, rop); + } + pixman_image_unref(tile); + } + break; + } + case SPICE_BRUSH_TYPE_NONE: + /* Still need to do *something* here, because rop could be e.g invert dest */ + canvas->ops->fill_solid_rects_rop(canvas, rects, n_rects, 0, rop); + break; + default: + spice_warn_if_reached(); + return; + } +} + +/* If we're exiting early we may still have to load an image in case + it has to be cached or something */ +static void touch_brush(CanvasBase *canvas, SpiceBrush *brush) +{ + SpicePattern *pattern; + + if (brush->type == SPICE_BRUSH_TYPE_PATTERN) { + pattern = &brush->u.pattern; + canvas_touch_image(canvas, pattern->pat); + } +} + +static void canvas_draw_fill(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + pixman_region32_t dest_region; + SpiceROP rop; + + pixman_region32_init_rect(&dest_region, + bbox->left, bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top); + + + canvas_clip_pixman(canvas, &dest_region, clip); + canvas_mask_pixman(canvas, &dest_region, &fill->mask, + bbox->left, bbox->top); + + rop = ropd_descriptor_to_rop(fill->rop_descriptor, + ROP_INPUT_BRUSH, + ROP_INPUT_DEST); + + if (rop == SPICE_ROP_NOOP || !pixman_region32_not_empty(&dest_region)) { + touch_brush(canvas, &fill->brush); + pixman_region32_fini(&dest_region); + return; + } + + draw_brush(spice_canvas, &dest_region, &fill->brush, rop); + + pixman_region32_fini(&dest_region); +} + +static void canvas_draw_copy(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + pixman_region32_t dest_region; + SpiceCanvas *surface_canvas; + pixman_image_t *src_image; + SpiceROP rop; + + pixman_region32_init_rect(&dest_region, + bbox->left, bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top); + + canvas_clip_pixman(canvas, &dest_region, clip); + canvas_mask_pixman(canvas, &dest_region, ©->mask, + bbox->left, bbox->top); + + rop = ropd_descriptor_to_rop(copy->rop_descriptor, + ROP_INPUT_SRC, + ROP_INPUT_DEST); + + if (rop == SPICE_ROP_NOOP || !pixman_region32_not_empty(&dest_region)) { + canvas_touch_image(canvas, copy->src_bitmap); + pixman_region32_fini(&dest_region); + return; + } + + surface_canvas = canvas_get_surface(canvas, copy->src_bitmap); + if (surface_canvas) { + if (rect_is_same_size(bbox, ©->src_area)) { + if (rop == SPICE_ROP_COPY) { + spice_canvas->ops->blit_image_from_surface(spice_canvas, &dest_region, + surface_canvas, + bbox->left - copy->src_area.left, + bbox->top - copy->src_area.top); + } else { + spice_canvas->ops->blit_image_rop_from_surface(spice_canvas, &dest_region, + surface_canvas, + bbox->left - copy->src_area.left, + bbox->top - copy->src_area.top, + rop); + } + } else { + if (rop == SPICE_ROP_COPY) { + spice_canvas->ops->scale_image_from_surface(spice_canvas, &dest_region, + surface_canvas, + copy->src_area.left, + copy->src_area.top, + copy->src_area.right - copy->src_area.left, + copy->src_area.bottom - copy->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + copy->scale_mode); + } else { + spice_canvas->ops->scale_image_rop_from_surface(spice_canvas, &dest_region, + surface_canvas, + copy->src_area.left, + copy->src_area.top, + copy->src_area.right - copy->src_area.left, + copy->src_area.bottom - copy->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + copy->scale_mode, + rop); + } + } + } else { + src_image = canvas_get_image(canvas, copy->src_bitmap, FALSE); + spice_return_if_fail(src_image != NULL); + + if (rect_is_same_size(bbox, ©->src_area)) { + if (rop == SPICE_ROP_COPY) { + spice_canvas->ops->blit_image(spice_canvas, &dest_region, + src_image, + bbox->left - copy->src_area.left, + bbox->top - copy->src_area.top); + } else { + spice_canvas->ops->blit_image_rop(spice_canvas, &dest_region, + src_image, + bbox->left - copy->src_area.left, + bbox->top - copy->src_area.top, + rop); + } + } else { + if (rop == SPICE_ROP_COPY) { + spice_canvas->ops->scale_image(spice_canvas, &dest_region, + src_image, + copy->src_area.left, + copy->src_area.top, + copy->src_area.right - copy->src_area.left, + copy->src_area.bottom - copy->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + copy->scale_mode); + } else { + spice_canvas->ops->scale_image_rop(spice_canvas, &dest_region, + src_image, + copy->src_area.left, + copy->src_area.top, + copy->src_area.right - copy->src_area.left, + copy->src_area.bottom - copy->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + copy->scale_mode, + rop); + } + } + pixman_image_unref(src_image); + } + pixman_region32_fini(&dest_region); +} + +static void canvas_draw_transparent(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + SpiceCanvas *surface_canvas; + pixman_image_t *src_image; + pixman_region32_t dest_region; + uint32_t transparent_color; + + pixman_region32_init_rect(&dest_region, + bbox->left, bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top); + + canvas_clip_pixman(canvas, &dest_region, clip); + + if (pixman_region32_n_rects (&dest_region) == 0) { + canvas_touch_image(canvas, transparent->src_bitmap); + pixman_region32_fini(&dest_region); + return; + } + + switch (canvas->format) { + case SPICE_SURFACE_FMT_32_xRGB: + case SPICE_SURFACE_FMT_32_ARGB: + transparent_color = transparent->true_color; + break; + case SPICE_SURFACE_FMT_16_555: + transparent_color = rgb_32_to_16_555(transparent->true_color); + break; + case SPICE_SURFACE_FMT_16_565: + transparent_color = rgb_32_to_16_565(transparent->true_color); + break; + default: + transparent_color = 0; + } + + surface_canvas = canvas_get_surface(canvas, transparent->src_bitmap); + if (surface_canvas) { + if (rect_is_same_size(bbox, &transparent->src_area)) { + spice_canvas->ops->colorkey_image_from_surface(spice_canvas, &dest_region, + surface_canvas, + bbox->left - transparent->src_area.left, + bbox->top - transparent->src_area.top, + transparent_color); + } else { + spice_canvas->ops->colorkey_scale_image_from_surface(spice_canvas, &dest_region, + surface_canvas, + transparent->src_area.left, + transparent->src_area.top, + transparent->src_area.right - transparent->src_area.left, + transparent->src_area.bottom - transparent->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + transparent_color); + } + } else { + src_image = canvas_get_image(canvas, transparent->src_bitmap, FALSE); + spice_return_if_fail(src_image != NULL); + + if (rect_is_same_size(bbox, &transparent->src_area)) { + spice_canvas->ops->colorkey_image(spice_canvas, &dest_region, + src_image, + bbox->left - transparent->src_area.left, + bbox->top - transparent->src_area.top, + transparent_color); + } else { + spice_canvas->ops->colorkey_scale_image(spice_canvas, &dest_region, + src_image, + transparent->src_area.left, + transparent->src_area.top, + transparent->src_area.right - transparent->src_area.left, + transparent->src_area.bottom - transparent->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + transparent_color); + } + pixman_image_unref(src_image); + } + pixman_region32_fini(&dest_region); +} + +static void canvas_draw_alpha_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlend* alpha_blend) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + pixman_region32_t dest_region; + SpiceCanvas *surface_canvas; + pixman_image_t *src_image; + + pixman_region32_init_rect(&dest_region, + bbox->left, bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top); + + canvas_clip_pixman(canvas, &dest_region, clip); + + if (alpha_blend->alpha == 0 || + !pixman_region32_not_empty(&dest_region)) { + canvas_touch_image(canvas, alpha_blend->src_bitmap); + pixman_region32_fini(&dest_region); + return; + } + + surface_canvas = canvas_get_surface(canvas, alpha_blend->src_bitmap); + if (surface_canvas) { + if (rect_is_same_size(bbox, &alpha_blend->src_area)) { + spice_canvas->ops->blend_image_from_surface(spice_canvas, &dest_region, + alpha_blend->alpha_flags & SPICE_ALPHA_FLAGS_DEST_HAS_ALPHA, + surface_canvas, + alpha_blend->alpha_flags & SPICE_ALPHA_FLAGS_SRC_SURFACE_HAS_ALPHA, + alpha_blend->src_area.left, + alpha_blend->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + alpha_blend->alpha); + } else { + spice_canvas->ops->blend_scale_image_from_surface(spice_canvas, &dest_region, + alpha_blend->alpha_flags & SPICE_ALPHA_FLAGS_DEST_HAS_ALPHA, + surface_canvas, + alpha_blend->alpha_flags & SPICE_ALPHA_FLAGS_SRC_SURFACE_HAS_ALPHA, + alpha_blend->src_area.left, + alpha_blend->src_area.top, + alpha_blend->src_area.right - alpha_blend->src_area.left, + alpha_blend->src_area.bottom - alpha_blend->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + SPICE_IMAGE_SCALE_MODE_NEAREST, + alpha_blend->alpha); + } + } else { + src_image = canvas_get_image(canvas, alpha_blend->src_bitmap, TRUE); + spice_return_if_fail(src_image != NULL); + + if (rect_is_same_size(bbox, &alpha_blend->src_area)) { + spice_canvas->ops->blend_image(spice_canvas, &dest_region, + alpha_blend->alpha_flags & SPICE_ALPHA_FLAGS_DEST_HAS_ALPHA, + src_image, + alpha_blend->src_area.left, + alpha_blend->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + alpha_blend->alpha); + } else { + spice_canvas->ops->blend_scale_image(spice_canvas, &dest_region, + alpha_blend->alpha_flags & SPICE_ALPHA_FLAGS_DEST_HAS_ALPHA, + src_image, + alpha_blend->src_area.left, + alpha_blend->src_area.top, + alpha_blend->src_area.right - alpha_blend->src_area.left, + alpha_blend->src_area.bottom - alpha_blend->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + SPICE_IMAGE_SCALE_MODE_NEAREST, + alpha_blend->alpha); + } + + pixman_image_unref(src_image); + } + + pixman_region32_fini(&dest_region); +} + +static void canvas_draw_opaque(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + pixman_image_t *src_image; + pixman_region32_t dest_region; + SpiceCanvas *surface_canvas; + SpiceROP rop; + + pixman_region32_init_rect(&dest_region, + bbox->left, bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top); + + canvas_clip_pixman(canvas, &dest_region, clip); + canvas_mask_pixman(canvas, &dest_region, &opaque->mask, + bbox->left, bbox->top); + + rop = ropd_descriptor_to_rop(opaque->rop_descriptor, + ROP_INPUT_BRUSH, + ROP_INPUT_SRC); + + if (rop == SPICE_ROP_NOOP || !pixman_region32_not_empty(&dest_region)) { + canvas_touch_image(canvas, opaque->src_bitmap); + touch_brush(canvas, &opaque->brush); + pixman_region32_fini(&dest_region); + return; + } + + surface_canvas = canvas_get_surface(canvas, opaque->src_bitmap); + if (surface_canvas) { + if (rect_is_same_size(bbox, &opaque->src_area)) { + spice_canvas->ops->blit_image_from_surface(spice_canvas, &dest_region, + surface_canvas, + bbox->left - opaque->src_area.left, + bbox->top - opaque->src_area.top); + } else { + spice_canvas->ops->scale_image_from_surface(spice_canvas, &dest_region, + surface_canvas, + opaque->src_area.left, + opaque->src_area.top, + opaque->src_area.right - opaque->src_area.left, + opaque->src_area.bottom - opaque->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + opaque->scale_mode); + } + } else { + src_image = canvas_get_image(canvas, opaque->src_bitmap, FALSE); + spice_return_if_fail(src_image != NULL); + + if (rect_is_same_size(bbox, &opaque->src_area)) { + spice_canvas->ops->blit_image(spice_canvas, &dest_region, + src_image, + bbox->left - opaque->src_area.left, + bbox->top - opaque->src_area.top); + } else { + spice_canvas->ops->scale_image(spice_canvas, &dest_region, + src_image, + opaque->src_area.left, + opaque->src_area.top, + opaque->src_area.right - opaque->src_area.left, + opaque->src_area.bottom - opaque->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + opaque->scale_mode); + } + pixman_image_unref(src_image); + } + + draw_brush(spice_canvas, &dest_region, &opaque->brush, rop); + + pixman_region32_fini(&dest_region); +} + +static void canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + SpiceCanvas *surface_canvas; + pixman_image_t *src_image; + pixman_region32_t dest_region; + SpiceROP rop; + + pixman_region32_init_rect(&dest_region, + bbox->left, bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top); + + canvas_clip_pixman(canvas, &dest_region, clip); + canvas_mask_pixman(canvas, &dest_region, &blend->mask, + bbox->left, bbox->top); + + rop = ropd_descriptor_to_rop(blend->rop_descriptor, + ROP_INPUT_SRC, + ROP_INPUT_DEST); + + if (rop == SPICE_ROP_NOOP || !pixman_region32_not_empty(&dest_region)) { + canvas_touch_image(canvas, blend->src_bitmap); + pixman_region32_fini(&dest_region); + return; + } + + surface_canvas = canvas_get_surface(canvas, blend->src_bitmap); + if (surface_canvas) { + if (rect_is_same_size(bbox, &blend->src_area)) { + if (rop == SPICE_ROP_COPY) + spice_canvas->ops->blit_image_from_surface(spice_canvas, &dest_region, + surface_canvas, + bbox->left - blend->src_area.left, + bbox->top - blend->src_area.top); + else + spice_canvas->ops->blit_image_rop_from_surface(spice_canvas, &dest_region, + surface_canvas, + bbox->left - blend->src_area.left, + bbox->top - blend->src_area.top, + rop); + } else { + if (rop == SPICE_ROP_COPY) { + spice_canvas->ops->scale_image_from_surface(spice_canvas, &dest_region, + surface_canvas, + blend->src_area.left, + blend->src_area.top, + blend->src_area.right - blend->src_area.left, + blend->src_area.bottom - blend->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + blend->scale_mode); + } else { + spice_canvas->ops->scale_image_rop_from_surface(spice_canvas, &dest_region, + surface_canvas, + blend->src_area.left, + blend->src_area.top, + blend->src_area.right - blend->src_area.left, + blend->src_area.bottom - blend->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + blend->scale_mode, rop); + } + } + } else { + src_image = canvas_get_image(canvas, blend->src_bitmap, FALSE); + spice_return_if_fail(src_image != NULL); + + if (rect_is_same_size(bbox, &blend->src_area)) { + if (rop == SPICE_ROP_COPY) + spice_canvas->ops->blit_image(spice_canvas, &dest_region, + src_image, + bbox->left - blend->src_area.left, + bbox->top - blend->src_area.top); + else + spice_canvas->ops->blit_image_rop(spice_canvas, &dest_region, + src_image, + bbox->left - blend->src_area.left, + bbox->top - blend->src_area.top, + rop); + } else { + if (rop == SPICE_ROP_COPY) { + spice_canvas->ops->scale_image(spice_canvas, &dest_region, + src_image, + blend->src_area.left, + blend->src_area.top, + blend->src_area.right - blend->src_area.left, + blend->src_area.bottom - blend->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + blend->scale_mode); + } else { + spice_canvas->ops->scale_image_rop(spice_canvas, &dest_region, + src_image, + blend->src_area.left, + blend->src_area.top, + blend->src_area.right - blend->src_area.left, + blend->src_area.bottom - blend->src_area.top, + bbox->left, + bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top, + blend->scale_mode, rop); + } + } + pixman_image_unref(src_image); + } + pixman_region32_fini(&dest_region); +} + +static void canvas_draw_blackness(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + pixman_region32_t dest_region; + pixman_box32_t *rects; + int n_rects; + + pixman_region32_init_rect(&dest_region, + bbox->left, bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top); + + + canvas_clip_pixman(canvas, &dest_region, clip); + canvas_mask_pixman(canvas, &dest_region, &blackness->mask, + bbox->left, bbox->top); + + if (!pixman_region32_not_empty(&dest_region)) { + pixman_region32_fini (&dest_region); + return; + } + + rects = pixman_region32_rectangles(&dest_region, &n_rects); + + spice_canvas->ops->fill_solid_rects(spice_canvas, rects, n_rects, 0x000000); + + pixman_region32_fini(&dest_region); +} + +static void canvas_draw_whiteness(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + pixman_region32_t dest_region; + pixman_box32_t *rects; + int n_rects; + + pixman_region32_init_rect(&dest_region, + bbox->left, bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top); + + + canvas_clip_pixman(canvas, &dest_region, clip); + canvas_mask_pixman(canvas, &dest_region, &whiteness->mask, + bbox->left, bbox->top); + + if (!pixman_region32_not_empty(&dest_region)) { + pixman_region32_fini(&dest_region); + return; + } + + rects = pixman_region32_rectangles(&dest_region, &n_rects); + spice_canvas->ops->fill_solid_rects(spice_canvas, rects, n_rects, 0xffffffff); + + pixman_region32_fini(&dest_region); +} + +static void canvas_draw_invers(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + pixman_region32_t dest_region; + pixman_box32_t *rects; + int n_rects; + + pixman_region32_init_rect(&dest_region, + bbox->left, bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top); + + + canvas_clip_pixman(canvas, &dest_region, clip); + canvas_mask_pixman(canvas, &dest_region, &invers->mask, + bbox->left, bbox->top); + + if (!pixman_region32_not_empty(&dest_region)) { + pixman_region32_fini(&dest_region); + return; + } + + rects = pixman_region32_rectangles(&dest_region, &n_rects); + spice_canvas->ops->fill_solid_rects_rop(spice_canvas, rects, n_rects, 0x00000000, + SPICE_ROP_INVERT); + + pixman_region32_fini(&dest_region); +} + +typedef struct { + lineGC base; + SpiceCanvas *canvas; + pixman_region32_t dest_region; + SpiceROP fore_rop; + SpiceROP back_rop; + int solid; + uint32_t color; + int use_surface_canvas; + union { + SpiceCanvas *surface_canvas; + pixman_image_t *tile; + }; + int tile_offset_x; + int tile_offset_y; +} StrokeGC; + +static void stroke_fill_spans(lineGC * pGC, + int num_spans, + SpicePoint *points, + int *widths, + int sorted, + int foreground) +{ + SpiceCanvas *canvas; + StrokeGC *strokeGC; + int i; + SpiceROP rop; + + strokeGC = (StrokeGC *)pGC; + canvas = strokeGC->canvas; + + num_spans = spice_canvas_clip_spans(&strokeGC->dest_region, + points, widths, num_spans, + points, widths, sorted); + + if (foreground) { + rop = strokeGC->fore_rop; + } else { + rop = strokeGC->back_rop; + } + + if (strokeGC->solid) { + if (rop == SPICE_ROP_COPY) { + canvas->ops->fill_solid_spans(canvas, points, widths, num_spans, + strokeGC->color); + } else { + for (i = 0; i < num_spans; i++) { + pixman_box32_t r; + r.x1 = points[i].x; + r.y1 = points[i].y; + r.x2 = points[i].x + widths[i]; + r.y2 = r.y1 + 1; + canvas->ops->fill_solid_rects_rop(canvas, &r, 1, + strokeGC->color, rop); + } + } + } else { + if (rop == SPICE_ROP_COPY) { + for (i = 0; i < num_spans; i++) { + pixman_box32_t r; + r.x1 = points[i].x; + r.y1 = points[i].y; + r.x2 = points[i].x + widths[i]; + r.y2 = r.y1 + 1; + canvas->ops->fill_tiled_rects(canvas, &r, 1, + strokeGC->tile, + strokeGC->tile_offset_x, + strokeGC->tile_offset_y); + } + } else { + for (i = 0; i < num_spans; i++) { + pixman_box32_t r; + r.x1 = points[i].x; + r.y1 = points[i].y; + r.x2 = points[i].x + widths[i]; + r.y2 = r.y1 + 1; + canvas->ops->fill_tiled_rects_rop(canvas, &r, 1, + strokeGC->tile, + strokeGC->tile_offset_x, + strokeGC->tile_offset_y, rop); + } + } + } +} + +static void stroke_fill_rects(lineGC * pGC, + int num_rects, + pixman_rectangle32_t *rects, + int foreground) +{ + SpiceCanvas *canvas; + pixman_region32_t area; + pixman_box32_t *boxes; + StrokeGC *strokeGC; + SpiceROP rop; + int i; + pixman_box32_t *area_rects; + int n_area_rects; + + strokeGC = (StrokeGC *)pGC; + canvas = strokeGC->canvas; + + if (foreground) { + rop = strokeGC->fore_rop; + } else { + rop = strokeGC->back_rop; + } + + /* TODO: We can optimize this for more common cases where + dest is one rect */ + + boxes = spice_new(pixman_box32_t, num_rects); + for (i = 0; i < num_rects; i++) { + boxes[i].x1 = rects[i].x; + boxes[i].y1 = rects[i].y; + boxes[i].x2 = rects[i].x + rects[i].width; + boxes[i].y2 = rects[i].y + rects[i].height; + } + pixman_region32_init_rects(&area, boxes, num_rects); + pixman_region32_intersect(&area, &area, &strokeGC->dest_region); + free(boxes); + + area_rects = pixman_region32_rectangles(&area, &n_area_rects); + + if (strokeGC->solid) { + if (rop == SPICE_ROP_COPY) { + canvas->ops->fill_solid_rects(canvas, area_rects, n_area_rects, + strokeGC->color); + } else { + canvas->ops->fill_solid_rects_rop(canvas, area_rects, n_area_rects, + strokeGC->color, rop); + } + } else { + if (rop == SPICE_ROP_COPY) { + if (strokeGC->use_surface_canvas) { + canvas->ops->fill_tiled_rects_from_surface(canvas, area_rects, n_area_rects, + strokeGC->surface_canvas, + strokeGC->tile_offset_x, + strokeGC->tile_offset_y); + } else { + canvas->ops->fill_tiled_rects(canvas, area_rects, n_area_rects, + strokeGC->tile, + strokeGC->tile_offset_x, + strokeGC->tile_offset_y); + } + } else { + if (strokeGC->use_surface_canvas) { + canvas->ops->fill_tiled_rects_rop_from_surface(canvas, area_rects, n_area_rects, + strokeGC->surface_canvas, + strokeGC->tile_offset_x, + strokeGC->tile_offset_y, + rop); + } else { + canvas->ops->fill_tiled_rects_rop(canvas, area_rects, n_area_rects, + strokeGC->tile, + strokeGC->tile_offset_x, + strokeGC->tile_offset_y, + rop); + } + } + } + + pixman_region32_fini(&area); +} + +typedef struct { + SpicePoint *points; + int num_points; + int size; +} StrokeLines; + +static void stroke_lines_init(StrokeLines *lines) +{ + lines->points = spice_new(SpicePoint, 10); + lines->size = 10; + lines->num_points = 0; +} + +static void stroke_lines_free(StrokeLines *lines) +{ + free(lines->points); +} + +static void stroke_lines_append(StrokeLines *lines, + int x, int y) +{ + if (lines->num_points == lines->size) { + lines->size *= 2; + lines->points = spice_renew(SpicePoint, lines->points, lines->size); + } + lines->points[lines->num_points].x = x; + lines->points[lines->num_points].y = y; + lines->num_points++; +} + +static void stroke_lines_append_fix(StrokeLines *lines, + SpicePointFix *point) +{ + stroke_lines_append(lines, + fix_to_int(point->x), + fix_to_int(point->y)); +} + +static inline int64_t dot(SPICE_FIXED28_4 x1, + SPICE_FIXED28_4 y1, + SPICE_FIXED28_4 x2, + SPICE_FIXED28_4 y2) +{ + return (((int64_t)x1) *((int64_t)x2) + + ((int64_t)y1) *((int64_t)y2)) >> 4; +} + +static inline int64_t dot2(SPICE_FIXED28_4 x, + SPICE_FIXED28_4 y) +{ + return (((int64_t)x) *((int64_t)x) + + ((int64_t)y) *((int64_t)y)) >> 4; +} + +static void subdivide_bezier(StrokeLines *lines, + SpicePointFix point0, + SpicePointFix point1, + SpicePointFix point2, + SpicePointFix point3) +{ + int64_t A2, B2, C2, AB, CB, h1, h2; + + A2 = dot2(point1.x - point0.x, + point1.y - point0.y); + B2 = dot2(point3.x - point0.x, + point3.y - point0.y); + C2 = dot2(point2.x - point3.x, + point2.y - point3.y); + + AB = dot(point1.x - point0.x, + point1.y - point0.y, + point3.x - point0.x, + point3.y - point0.y); + + CB = dot(point2.x - point3.x, + point2.y - point3.y, + point0.x - point3.x, + point0.y - point3.y); + + h1 = (A2*B2 - AB*AB) >> 3; + h2 = (C2*B2 - CB*CB) >> 3; + + if (h1 < B2 && h2 < B2) { + /* deviation squared less than half a pixel, use straight line */ + stroke_lines_append_fix(lines, &point3); + } else { + SpicePointFix point01, point23, point12, point012, point123, point0123; + + point01.x = (point0.x + point1.x) / 2; + point01.y = (point0.y + point1.y) / 2; + point12.x = (point1.x + point2.x) / 2; + point12.y = (point1.y + point2.y) / 2; + point23.x = (point2.x + point3.x) / 2; + point23.y = (point2.y + point3.y) / 2; + point012.x = (point01.x + point12.x) / 2; + point012.y = (point01.y + point12.y) / 2; + point123.x = (point12.x + point23.x) / 2; + point123.y = (point12.y + point23.y) / 2; + point0123.x = (point012.x + point123.x) / 2; + point0123.y = (point012.y + point123.y) / 2; + + subdivide_bezier(lines, point0, point01, point012, point0123); + subdivide_bezier(lines, point0123, point123, point23, point3); + } +} + +static void stroke_lines_append_bezier(StrokeLines *lines, + SpicePointFix *point1, + SpicePointFix *point2, + SpicePointFix *point3) +{ + SpicePointFix point0; + + point0.x = int_to_fix(lines->points[lines->num_points-1].x); + point0.y = int_to_fix(lines->points[lines->num_points-1].y); + + subdivide_bezier(lines, point0, *point1, *point2, *point3); +} + +static void stroke_lines_draw(StrokeLines *lines, + lineGC *gc, + int dashed) +{ + if (lines->num_points != 0) { + if (dashed) { + spice_canvas_zero_dash_line(gc, CoordModeOrigin, + lines->num_points, lines->points); + } else { + spice_canvas_zero_line(gc, CoordModeOrigin, + lines->num_points, lines->points); + } + lines->num_points = 0; + } +} + + +static void canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox, + SpiceClip *clip, SpiceStroke *stroke) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + SpiceCanvas *surface_canvas = NULL; + StrokeGC gc = { { 0 } }; + lineGCOps ops = { + stroke_fill_spans, + stroke_fill_rects + }; + StrokeLines lines; + unsigned int i; + int dashed; + + pixman_region32_init_rect(&gc.dest_region, + bbox->left, bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top); + + canvas_clip_pixman(canvas, &gc.dest_region, clip); + + if (!pixman_region32_not_empty(&gc.dest_region)) { + touch_brush(canvas, &stroke->brush); + pixman_region32_fini(&gc.dest_region); + return; + } + + gc.canvas = spice_canvas; + gc.fore_rop = ropd_descriptor_to_rop(stroke->fore_mode, + ROP_INPUT_BRUSH, + ROP_INPUT_DEST); + gc.back_rop = ropd_descriptor_to_rop(stroke->back_mode, + ROP_INPUT_BRUSH, + ROP_INPUT_DEST); + + gc.base.width = canvas->width; + gc.base.height = canvas->height; + gc.base.alu = gc.fore_rop; + gc.base.lineWidth = 0; + + /* dash */ + gc.base.dashOffset = 0; + gc.base.dash = NULL; + gc.base.numInDashList = 0; + gc.base.lineStyle = LineSolid; + /* win32 cosmetic lines are endpoint-exclusive, so use CapNotLast */ + gc.base.capStyle = CapNotLast; + gc.base.joinStyle = JoinMiter; + gc.base.ops = &ops; + + dashed = 0; + if (stroke->attr.flags & SPICE_LINE_FLAGS_STYLED) { + SPICE_FIXED28_4 *style = stroke->attr.style; + int nseg; + + dashed = 1; + + nseg = stroke->attr.style_nseg; + + /* To truly handle back_mode we should use LineDoubleDash here + and treat !foreground as back_rop using the same brush. + However, using the same brush for that seems wrong. + The old cairo backend was stroking the non-dashed line with + rop_mode before enabling dashes for the foreground which is + not right either. The gl an gdi backend don't use back_mode + at all */ + gc.base.lineStyle = LineOnOffDash; + gc.base.dash = (unsigned char *)spice_malloc(nseg); + gc.base.numInDashList = nseg; + + if (stroke->attr.flags & SPICE_LINE_FLAGS_START_WITH_GAP) { + gc.base.dash[stroke->attr.style_nseg - 1] = fix_to_int(style[0]); + for (i = 0; i < (unsigned int)(stroke->attr.style_nseg - 1); i++) { + gc.base.dash[i] = fix_to_int(style[i+1]); + } + gc.base.dashOffset = gc.base.dash[0]; + } else { + for (i = 0; i < stroke->attr.style_nseg; i++) { + gc.base.dash[i] = fix_to_int(style[i]); + } + } + } + + switch (stroke->brush.type) { + case SPICE_BRUSH_TYPE_NONE: + gc.solid = TRUE; + gc.color = 0; + break; + case SPICE_BRUSH_TYPE_SOLID: + gc.solid = TRUE; + gc.color = stroke->brush.u.color; + break; + case SPICE_BRUSH_TYPE_PATTERN: + gc.solid = FALSE; + surface_canvas = canvas_get_surface(canvas, + stroke->brush.u.pattern.pat); + if (surface_canvas) { + gc.use_surface_canvas = TRUE; + gc.surface_canvas = surface_canvas; + } else { + gc.use_surface_canvas = FALSE; + gc.tile = canvas_get_image(canvas, + stroke->brush.u.pattern.pat, + FALSE); + } + gc.tile_offset_x = stroke->brush.u.pattern.pos.x; + gc.tile_offset_y = stroke->brush.u.pattern.pos.y; + break; + default: + spice_warn_if_reached(); + return; + } + + stroke_lines_init(&lines); + + for (i = 0; i < stroke->path->num_segments; i++) { + SpicePathSeg *seg = stroke->path->segments[i]; + SpicePointFix* point, *end_point; + + point = seg->points; + end_point = point + seg->count; + + if (seg->flags & SPICE_PATH_BEGIN) { + stroke_lines_draw(&lines, (lineGC *)&gc, dashed); + stroke_lines_append_fix(&lines, point); + point++; + } + + if (seg->flags & SPICE_PATH_BEZIER) { + spice_return_if_fail((point - end_point) % 3 == 0); + for (; point + 2 < end_point; point += 3) { + stroke_lines_append_bezier(&lines, + &point[0], + &point[1], + &point[2]); + } + } else + { + for (; point < end_point; point++) { + stroke_lines_append_fix(&lines, point); + } + } + if (seg->flags & SPICE_PATH_END) { + if (seg->flags & SPICE_PATH_CLOSE) { + stroke_lines_append(&lines, + lines.points[0].x, lines.points[0].y); + } + stroke_lines_draw(&lines, (lineGC *)&gc, dashed); + } + } + + stroke_lines_draw(&lines, (lineGC *)&gc, dashed); + + free(gc.base.dash); + stroke_lines_free(&lines); + + if (!gc.solid && gc.tile && !surface_canvas) { + pixman_image_unref(gc.tile); + } + + pixman_region32_fini(&gc.dest_region); +} + + +//need surfaces handling here !!! +static void canvas_draw_rop3(SpiceCanvas *spice_canvas, SpiceRect *bbox, + SpiceClip *clip, SpiceRop3 *rop3) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + SpiceCanvas *surface_canvas; + pixman_region32_t dest_region; + pixman_image_t *d; + pixman_image_t *s; + SpicePoint src_pos; + int width; + int heigth; + + pixman_region32_init_rect(&dest_region, + bbox->left, bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top); + + canvas_clip_pixman(canvas, &dest_region, clip); + canvas_mask_pixman(canvas, &dest_region, &rop3->mask, + bbox->left, bbox->top); + + width = bbox->right - bbox->left; + heigth = bbox->bottom - bbox->top; + + d = canvas_get_image_from_self(spice_canvas, bbox->left, bbox->top, width, heigth); + surface_canvas = canvas_get_surface(canvas, rop3->src_bitmap); + if (surface_canvas) { + s = surface_canvas->ops->get_image(surface_canvas); + } else { + s = canvas_get_image(canvas, rop3->src_bitmap, FALSE); + } + + if (!rect_is_same_size(bbox, &rop3->src_area)) { + pixman_image_t *scaled_s = canvas_scale_surface(s, &rop3->src_area, width, heigth, + rop3->scale_mode); + pixman_image_unref(s); + s = scaled_s; + src_pos.x = 0; + src_pos.y = 0; + } else { + src_pos.x = rop3->src_area.left; + src_pos.y = rop3->src_area.top; + } + if (pixman_image_get_width(s) - src_pos.x < width || + pixman_image_get_height(s) - src_pos.y < heigth) { + spice_critical("bad src bitmap size"); + return; + } + if (rop3->brush.type == SPICE_BRUSH_TYPE_PATTERN) { + SpiceCanvas *_surface_canvas; + pixman_image_t *p; + + _surface_canvas = canvas_get_surface(canvas, rop3->brush.u.pattern.pat); + if (_surface_canvas) { + p = _surface_canvas->ops->get_image(_surface_canvas); + } else { + p = canvas_get_image(canvas, rop3->brush.u.pattern.pat, FALSE); + } + SpicePoint pat_pos; + + pat_pos.x = (bbox->left - rop3->brush.u.pattern.pos.x) % pixman_image_get_width(p); + pat_pos.y = (bbox->top - rop3->brush.u.pattern.pos.y) % pixman_image_get_height(p); + do_rop3_with_pattern(rop3->rop3, d, s, &src_pos, p, &pat_pos); + pixman_image_unref(p); + } else { + do_rop3_with_color(rop3->rop3, d, s, &src_pos, rop3->brush.u.color); + } + pixman_image_unref(s); + + spice_canvas->ops->blit_image(spice_canvas, &dest_region, d, + bbox->left, + bbox->top); + + pixman_image_unref(d); + + pixman_region32_fini(&dest_region); +} + +static void canvas_copy_bits(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + pixman_region32_t dest_region; + int dx, dy; + + pixman_region32_init_rect(&dest_region, + bbox->left, bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top); + + canvas_clip_pixman(canvas, &dest_region, clip); + + dx = bbox->left - src_pos->x; + dy = bbox->top - src_pos->y; + + if (dx != 0 || dy != 0) { + pixman_region32_t src_region; + + /* Clip so we don't read outside canvas */ + pixman_region32_init_rect(&src_region, + dx, dy, + canvas->width, + canvas->height); + pixman_region32_intersect(&dest_region, &dest_region, &src_region); + pixman_region32_fini(&src_region); + + spice_canvas->ops->copy_region(spice_canvas, &dest_region, dx, dy); + } + + pixman_region32_fini(&dest_region); +} + + + +static void canvas_base_group_start(SpiceCanvas *spice_canvas, QRegion *region) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + pixman_region32_fini(&canvas->canvas_region); + + /* Make sure we always clip to canvas size */ + pixman_region32_init_rect(&canvas->canvas_region, + 0, 0, + canvas->width, + canvas->height); + + pixman_region32_intersect(&canvas->canvas_region, &canvas->canvas_region, region); +} + +static void canvas_base_group_end(SpiceCanvas *spice_canvas) +{ + CanvasBase *canvas = (CanvasBase *)spice_canvas; + pixman_region32_fini(&canvas->canvas_region); + pixman_region32_init_rect(&canvas->canvas_region, + 0, 0, + canvas->width, + canvas->height); +} + + +static void unimplemented_op(SpiceCanvas *canvas) +{ + spice_critical("unimplemented canvas operation"); +} + +inline static void canvas_base_init_ops(SpiceCanvasOps *ops) +{ + void **ops_cast; + unsigned i; + + ops_cast = (void **)ops; + for (i = 0; i < sizeof(SpiceCanvasOps) / sizeof(void *); i++) { + ops_cast[i] = (void *) unimplemented_op; + } + + ops->draw_fill = canvas_draw_fill; + ops->draw_copy = canvas_draw_copy; + ops->draw_opaque = canvas_draw_opaque; + ops->copy_bits = canvas_copy_bits; + ops->draw_blend = canvas_draw_blend; + ops->draw_blackness = canvas_draw_blackness; + ops->draw_whiteness = canvas_draw_whiteness; + ops->draw_invers = canvas_draw_invers; + ops->draw_transparent = canvas_draw_transparent; + ops->draw_alpha_blend = canvas_draw_alpha_blend; + ops->draw_stroke = canvas_draw_stroke; + ops->draw_rop3 = canvas_draw_rop3; + ops->group_start = canvas_base_group_start; + ops->group_end = canvas_base_group_end; +} + +static int canvas_base_init(CanvasBase *canvas, SpiceCanvasOps *ops, + int width, int height, uint32_t format +#ifdef SW_CANVAS_CACHE + , SpiceImageCache *bits_cache + , SpicePaletteCache *palette_cache +#elif defined(SW_CANVAS_IMAGE_CACHE) + , SpiceImageCache *bits_cache +#endif + , SpiceImageSurfaces *surfaces + , SpiceGlzDecoder *glz_decoder + , SpiceJpegDecoder *jpeg_decoder + , SpiceZlibDecoder *zlib_decoder + ) +{ + canvas->parent.ops = ops; + canvas->quic_data.usr.error = quic_usr_error; + canvas->quic_data.usr.warn = quic_usr_warn; + canvas->quic_data.usr.info = quic_usr_warn; + canvas->quic_data.usr.malloc = quic_usr_malloc; + canvas->quic_data.usr.free = quic_usr_free; + canvas->quic_data.usr.more_space = quic_usr_more_space; + canvas->quic_data.usr.more_lines = quic_usr_more_lines; + if (!(canvas->quic_data.quic = quic_create(&canvas->quic_data.usr))) { + return 0; + } + + canvas->lz_data.usr.error = lz_usr_error; + canvas->lz_data.usr.warn = lz_usr_warn; + canvas->lz_data.usr.info = lz_usr_warn; + canvas->lz_data.usr.malloc = lz_usr_malloc; + canvas->lz_data.usr.free = lz_usr_free; + canvas->lz_data.usr.more_space = lz_usr_more_space; + canvas->lz_data.usr.more_lines = lz_usr_more_lines; + if (!(canvas->lz_data.lz = lz_create(&canvas->lz_data.usr))) { + return 0; + } + + canvas->surfaces = surfaces; + canvas->glz_data.decoder = glz_decoder; + canvas->jpeg = jpeg_decoder; + canvas->zlib = zlib_decoder; + + canvas->format = format; + + /* TODO: This is all wrong now */ + if (SPICE_SURFACE_FMT_DEPTH(format) == 16) { + canvas->color_shift = 5; + canvas->color_mask = 0x1f; + } else { + canvas->color_shift = 8; + canvas->color_mask = 0xff; + } + + canvas->width = width; + canvas->height = height; + pixman_region32_init_rect(&canvas->canvas_region, + 0, 0, + canvas->width, + canvas->height); + +#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) + canvas->bits_cache = bits_cache; +#endif +#ifdef SW_CANVAS_CACHE + canvas->palette_cache = palette_cache; +#endif + +#ifdef WIN32 + canvas->dc = NULL; +#endif + +#ifdef GDI_CANVAS + canvas->dc = create_compatible_dc(); + if (!canvas->dc) { + lz_destroy(canvas->lz_data.lz); + return 0; + } +#endif + return 1; +} diff -Nru spice-gtk-0.9/spice-common/common/canvas_base.h spice-gtk-0.12/spice-common/common/canvas_base.h --- spice-gtk-0.9/spice-common/common/canvas_base.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/canvas_base.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,321 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H_CANVAS_BASE +#define _H_CANVAS_BASE + +#include + +#include "pixman_utils.h" +#include "lz.h" +#include "region.h" +#include "draw.h" +#ifdef WIN32 +#include +#endif + +SPICE_BEGIN_DECLS + +typedef void (*spice_destroy_fn_t)(void *data); + +typedef struct _SpiceImageCache SpiceImageCache; +typedef struct _SpiceImageSurfaces SpiceImageSurfaces; +typedef struct _SpicePaletteCache SpicePaletteCache; +typedef struct _SpiceGlzDecoder SpiceGlzDecoder; +typedef struct _SpiceJpegDecoder SpiceJpegDecoder; +typedef struct _SpiceZlibDecoder SpiceZlibDecoder; +typedef struct _SpiceCanvas SpiceCanvas; + +typedef struct { + void (*put)(SpiceImageCache *cache, + uint64_t id, + pixman_image_t *surface); + pixman_image_t *(*get)(SpiceImageCache *cache, + uint64_t id); +#ifdef SW_CANVAS_CACHE + void (*put_lossy)(SpiceImageCache *cache, + uint64_t id, + pixman_image_t *surface); + void (*replace_lossy)(SpiceImageCache *cache, + uint64_t id, + pixman_image_t *surface); + pixman_image_t *(*get_lossless)(SpiceImageCache *cache, + uint64_t id); +#endif +} SpiceImageCacheOps; + +struct _SpiceImageCache { + SpiceImageCacheOps *ops; +}; + +typedef struct { + SpiceCanvas *(*get)(SpiceImageSurfaces *surfaces, + uint32_t surface_id); +} SpiceImageSurfacesOps; + +struct _SpiceImageSurfaces { + SpiceImageSurfacesOps *ops; +}; + +typedef struct { + void (*put)(SpicePaletteCache *cache, + SpicePalette *palette); + SpicePalette *(*get)(SpicePaletteCache *cache, + uint64_t id); + void (*release)(SpicePaletteCache *cache, + SpicePalette *palette); +} SpicePaletteCacheOps; + +struct _SpicePaletteCache { + SpicePaletteCacheOps *ops; +}; + +typedef struct { + void (*decode)(SpiceGlzDecoder *decoder, + uint8_t *data, + SpicePalette *plt, + void *usr_data); +} SpiceGlzDecoderOps; + +struct _SpiceGlzDecoder { + SpiceGlzDecoderOps *ops; +}; + + +typedef struct SpiceJpegDecoderOps { + void (*begin_decode)(SpiceJpegDecoder *decoder, + uint8_t* data, + int data_size, + int* out_width, + int* out_height); + void (*decode)(SpiceJpegDecoder *decoder, + uint8_t* dest, + int stride, + int format); +} SpiceJpegDecoderOps; + +struct _SpiceJpegDecoder { + SpiceJpegDecoderOps *ops; +}; + +typedef struct { + void (*decode)(SpiceZlibDecoder *decoder, + uint8_t *data, + int data_size, + uint8_t *dest, + int dest_size); +} SpiceZlibDecoderOps; + +struct _SpiceZlibDecoder { + SpiceZlibDecoderOps *ops; +}; + +typedef struct { + void (*draw_fill)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill); + void (*draw_copy)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy); + void (*draw_opaque)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque); + void (*copy_bits)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos); + void (*draw_text)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text); + void (*draw_stroke)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke); + void (*draw_rop3)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3); + void (*draw_blend)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend); + void (*draw_blackness)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness); + void (*draw_whiteness)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness); + void (*draw_invers)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers); + void (*draw_transparent)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent); + void (*draw_alpha_blend)(SpiceCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlend* alpha_blend); + void (*put_image)(SpiceCanvas *canvas, +#ifdef WIN32 + HDC dc, +#endif + const SpiceRect *dest, const uint8_t *src_data, + uint32_t src_width, uint32_t src_height, int src_stride, + const QRegion *clip); + void (*clear)(SpiceCanvas *canvas); + void (*read_bits)(SpiceCanvas *canvas, uint8_t *dest, int dest_stride, const SpiceRect *area); + void (*group_start)(SpiceCanvas *canvas, QRegion *region); + void (*group_end)(SpiceCanvas *canvas); + void (*destroy)(SpiceCanvas *canvas); + + /* Implementation vfuncs */ + void (*fill_solid_spans)(SpiceCanvas *canvas, + SpicePoint *points, + int *widths, + int n_spans, + uint32_t color); + void (*fill_solid_rects)(SpiceCanvas *canvas, + pixman_box32_t *rects, + int n_rects, + uint32_t color); + void (*fill_solid_rects_rop)(SpiceCanvas *canvas, + pixman_box32_t *rects, + int n_rects, + uint32_t color, + SpiceROP rop); + void (*fill_tiled_rects)(SpiceCanvas *canvas, + pixman_box32_t *rects, + int n_rects, + pixman_image_t *tile, + int offset_x, int offset_y); + void (*fill_tiled_rects_from_surface)(SpiceCanvas *canvas, + pixman_box32_t *rects, + int n_rects, + SpiceCanvas *tile, + int offset_x, int offset_y); + void (*fill_tiled_rects_rop)(SpiceCanvas *canvas, + pixman_box32_t *rects, + int n_rects, + pixman_image_t *tile, + int offset_x, int offset_y, + SpiceROP rop); + void (*fill_tiled_rects_rop_from_surface)(SpiceCanvas *canvas, + pixman_box32_t *rects, + int n_rects, + SpiceCanvas *tile, + int offset_x, int offset_y, + SpiceROP rop); + void (*blit_image)(SpiceCanvas *canvas, + pixman_region32_t *region, + pixman_image_t *src_image, + int offset_x, int offset_y); + void (*blit_image_from_surface)(SpiceCanvas *canvas, + pixman_region32_t *region, + SpiceCanvas *src_image, + int offset_x, int offset_y); + void (*blit_image_rop)(SpiceCanvas *canvas, + pixman_region32_t *region, + pixman_image_t *src_image, + int offset_x, int offset_y, + SpiceROP rop); + void (*blit_image_rop_from_surface)(SpiceCanvas *canvas, + pixman_region32_t *region, + SpiceCanvas *src_image, + int offset_x, int offset_y, + SpiceROP rop); + void (*scale_image)(SpiceCanvas *canvas, + pixman_region32_t *region, + pixman_image_t *src_image, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode); + void (*scale_image_from_surface)(SpiceCanvas *canvas, + pixman_region32_t *region, + SpiceCanvas *src_image, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode); + void (*scale_image_rop)(SpiceCanvas *canvas, + pixman_region32_t *region, + pixman_image_t *src_image, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode, SpiceROP rop); + void (*scale_image_rop_from_surface)(SpiceCanvas *canvas, + pixman_region32_t *region, + SpiceCanvas *src_image, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode, SpiceROP rop); + void (*blend_image)(SpiceCanvas *canvas, + pixman_region32_t *region, + int dest_has_alpha, + pixman_image_t *src_image, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height, + int overall_alpha); + void (*blend_image_from_surface)(SpiceCanvas *canvas, + pixman_region32_t *region, + int dest_has_alpha, + SpiceCanvas *src_image, + int src_has_alpha, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height, + int overall_alpha); + void (*blend_scale_image)(SpiceCanvas *canvas, + pixman_region32_t *region, + int dest_has_alpha, + pixman_image_t *src_image, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode, + int overall_alpha); + void (*blend_scale_image_from_surface)(SpiceCanvas *canvas, + pixman_region32_t *region, + int dest_has_alpha, + SpiceCanvas *src_image, + int src_has_alpha, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode, + int overall_alpha); + void (*colorkey_image)(SpiceCanvas *canvas, + pixman_region32_t *region, + pixman_image_t *src_image, + int offset_x, int offset_y, + uint32_t transparent_color); + void (*colorkey_image_from_surface)(SpiceCanvas *canvas, + pixman_region32_t *region, + SpiceCanvas *src_image, + int offset_x, int offset_y, + uint32_t transparent_color); + void (*colorkey_scale_image)(SpiceCanvas *canvas, + pixman_region32_t *region, + pixman_image_t *src_image, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + uint32_t transparent_color); + void (*colorkey_scale_image_from_surface)(SpiceCanvas *canvas, + pixman_region32_t *region, + SpiceCanvas *src_image, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + uint32_t transparent_color); + void (*copy_region)(SpiceCanvas *canvas, + pixman_region32_t *dest_region, + int dx, int dy); + pixman_image_t *(*get_image)(SpiceCanvas *canvas); +} SpiceCanvasOps; + +void spice_canvas_set_usr_data(SpiceCanvas *canvas, void *data, spice_destroy_fn_t destroy_fn); +void *spice_canvas_get_usr_data(SpiceCanvas *canvas); + +struct _SpiceCanvas { + SpiceCanvasOps *ops; +}; + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/canvas_utils.c spice-gtk-0.12/spice-common/common/canvas_utils.c --- spice-gtk-0.9/spice-common/common/canvas_utils.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/canvas_utils.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,296 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "spice_common.h" +#include "canvas_utils.h" + +#ifdef __GNUC__ +#include +#include +#endif +#include "mem.h" + +#ifdef WIN32 +static int gdi_handlers = 0; +#endif + +static void release_data(pixman_image_t *image, void *release_data) +{ + PixmanData *data = (PixmanData *)release_data; + +#ifdef WIN32 + if (data->bitmap) { + DeleteObject((HBITMAP)data->bitmap); + CloseHandle(data->mutex); + gdi_handlers--; + } +#endif + free(data->data); + + free(data); +} + +static PixmanData * +pixman_image_add_data(pixman_image_t *image) +{ + PixmanData *data; + + data = (PixmanData *)pixman_image_get_destroy_data(image); + if (data == NULL) { + data = (PixmanData *)calloc(1, sizeof(PixmanData)); + if (data == NULL) { + spice_error("out of memory"); + } + pixman_image_set_destroy_function(image, + release_data, + data); + } + + return data; +} + +void +spice_pixman_image_set_format(pixman_image_t *image, + pixman_format_code_t format) +{ + PixmanData *data; + + data = pixman_image_add_data(image); + data->format = format; +} + + +int spice_pixman_image_get_format(pixman_image_t *image, pixman_format_code_t *format) +{ + PixmanData *data; + + spice_return_val_if_fail(format != NULL, 0); + + data = (PixmanData *)pixman_image_get_destroy_data(image); + if (data != NULL && data->format != 0) { + *format = data->format; + return 1; + } + + spice_warn_if_reached(); + return 0; +} + +static INLINE pixman_image_t *__surface_create_stride(pixman_format_code_t format, int width, int height, + int stride) +{ + uint8_t *data; + uint8_t *stride_data; + pixman_image_t *surface; + PixmanData *pixman_data; + + data = (uint8_t *)spice_malloc_n(abs(stride), height); + if (stride < 0) { + stride_data = data + (-stride) * (height - 1); + } else { + stride_data = data; + } + + surface = pixman_image_create_bits(format, width, height, (uint32_t *)stride_data, stride); + + if (surface == NULL) { + free(data); + spice_error("create surface failed, out of memory"); + } + + pixman_data = pixman_image_add_data(surface); + pixman_data->data = data; + pixman_data->format = format; + + return surface; +} + +#ifdef WIN32 +pixman_image_t *surface_create(HDC dc, pixman_format_code_t format, + int width, int height, int top_down) +#else +pixman_image_t * surface_create(pixman_format_code_t format, int width, int height, int top_down) +#endif +{ +#ifdef WIN32 + /* + * Windows xp allow only 10,000 of gdi handlers, considering the fact that + * we limit here the number to 5000, we dont use atomic operations to sync + * this calculation against the other canvases (in case of multiple + * monitors), in worst case there will be little more than 5000 gdi + * handlers. + */ + if (dc && gdi_handlers < 5000) { + uint8_t *data; + uint8_t *src; + struct { + BITMAPINFO inf; + RGBQUAD palette[255]; + } bitmap_info; + int nstride; + pixman_image_t *surface; + PixmanData *pixman_data; + HBITMAP bitmap; + HANDLE mutex; + + memset(&bitmap_info, 0, sizeof(bitmap_info)); + bitmap_info.inf.bmiHeader.biSize = sizeof(bitmap_info.inf.bmiHeader); + bitmap_info.inf.bmiHeader.biWidth = width; + + bitmap_info.inf.bmiHeader.biHeight = (!top_down) ? height : -height; + + bitmap_info.inf.bmiHeader.biPlanes = 1; + switch (format) { + case PIXMAN_a8r8g8b8: + case PIXMAN_x8r8g8b8: + bitmap_info.inf.bmiHeader.biBitCount = 32; + nstride = width * 4; + break; + case PIXMAN_x1r5g5b5: + case PIXMAN_r5g6b5: + bitmap_info.inf.bmiHeader.biBitCount = 16; + nstride = SPICE_ALIGN(width * 2, 4); + break; + case PIXMAN_a8: + bitmap_info.inf.bmiHeader.biBitCount = 8; + nstride = SPICE_ALIGN(width, 4); + break; + case PIXMAN_a1: + bitmap_info.inf.bmiHeader.biBitCount = 1; + nstride = SPICE_ALIGN(width, 32) / 8; + break; + default: + spice_error("invalid format"); + return NULL; + } + + bitmap_info.inf.bmiHeader.biCompression = BI_RGB; + + mutex = CreateMutex(NULL, 0, NULL); + if (!mutex) { + spice_error("Unable to CreateMutex"); + } + + bitmap = CreateDIBSection(dc, &bitmap_info.inf, 0, (VOID **)&data, NULL, 0); + if (!bitmap) { + CloseHandle(mutex); + spice_error("Unable to CreateDIBSection"); + } + + if (top_down) { + src = data; + } else { + src = data + nstride * (height - 1); + nstride = -nstride; + } + + surface = pixman_image_create_bits(format, width, height, (uint32_t *)src, nstride); + if (surface == NULL) { + CloseHandle(mutex); + DeleteObject(bitmap); + spice_error("create surface failed, out of memory"); + } + pixman_data = pixman_image_add_data(surface); + pixman_data->format = format; + pixman_data->bitmap = bitmap; + pixman_data->mutex = mutex; + gdi_handlers++; + return surface; + } else { +#endif + if (top_down) { + pixman_image_t *surface; + PixmanData *data; + + surface = pixman_image_create_bits(format, width, height, NULL, 0); + data = pixman_image_add_data(surface); + data->format = format; + return surface; + } else { + // NOTE: we assume here that the lz decoders always decode to RGB32. + int stride = 0; + switch (format) { + case PIXMAN_a8r8g8b8: + case PIXMAN_x8r8g8b8: + stride = width * 4; + break; + case PIXMAN_x1r5g5b5: + case PIXMAN_r5g6b5: + stride = SPICE_ALIGN(width * 2, 4); + break; + case PIXMAN_a8: + stride = SPICE_ALIGN(width, 4); + break; + case PIXMAN_a1: + stride = SPICE_ALIGN(width, 32) / 8; + break; + default: + spice_error("invalid format"); + } + stride = -stride; + return __surface_create_stride(format, width, height, stride); + } +#ifdef WIN32 +} + +#endif +} + +#ifdef WIN32 +pixman_image_t *surface_create_stride(HDC dc, pixman_format_code_t format, int width, int height, + int stride) +#else +pixman_image_t *surface_create_stride(pixman_format_code_t format, int width, int height, + int stride) +#endif +{ +#ifdef WIN32 + if (dc) { + if (abs(stride) == (width * 4)) { + return surface_create(dc, format, width, height, (stride > 0)); + } + } +#endif + + return __surface_create_stride(format, width, height, stride); +} + +pixman_image_t *alloc_lz_image_surface(LzDecodeUsrData *canvas_data, + pixman_format_code_t pixman_format, int width, + int height, int gross_pixels, int top_down) +{ + int stride; + pixman_image_t *surface = NULL; + + stride = (gross_pixels / height) * (PIXMAN_FORMAT_BPP (pixman_format) / 8); + + if (!top_down) { + stride = -stride; + } + + surface = surface_create_stride( +#ifdef WIN32 + canvas_data->dc, +#endif + pixman_format, width, height, stride); + canvas_data->out_surface = surface; + return surface; +} diff -Nru spice-gtk-0.9/spice-common/common/canvas_utils.h spice-gtk-0.12/spice-common/common/canvas_utils.h --- spice-gtk-0.9/spice-common/common/canvas_utils.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/canvas_utils.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,78 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H_CANVAS_UTILS +#define _H_CANVAS_UTILS + +#ifdef WIN32 +#include +#endif + +#include +#include + +#include "pixman_utils.h" +#include "lz.h" + +SPICE_BEGIN_DECLS + +typedef struct PixmanData { +#ifdef WIN32 + HBITMAP bitmap; + HANDLE mutex; +#endif + uint8_t *data; + pixman_format_code_t format; +} PixmanData; + +void spice_pixman_image_set_format(pixman_image_t *image, + pixman_format_code_t format); +int spice_pixman_image_get_format(pixman_image_t *image, pixman_format_code_t *format); + + +#ifdef WIN32 +pixman_image_t *surface_create(HDC dc, pixman_format_code_t format, + int width, int height, int top_down); +#else +pixman_image_t *surface_create(pixman_format_code_t format, int width, int height, int top_down); +#endif + +#ifdef WIN32 +pixman_image_t *surface_create_stride(HDC dc, pixman_format_code_t format, int width, int height, + int stride); +#else +pixman_image_t *surface_create_stride(pixman_format_code_t format, int width, int height, + int stride); +#endif + + +typedef struct LzDecodeUsrData { +#ifdef WIN32 + HDC dc; +#endif + pixman_image_t *out_surface; +} LzDecodeUsrData; + + +pixman_image_t *alloc_lz_image_surface(LzDecodeUsrData *canvas_data, + pixman_format_code_t pixman_format, int width, + int height, int gross_pixels, int top_down); + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/client_demarshallers.h spice-gtk-0.12/spice-common/common/client_demarshallers.h --- spice-gtk-0.9/spice-common/common/client_demarshallers.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/client_demarshallers.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,35 @@ +/* + Copyright (C) 2010 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifndef _H_DEMARSHAL +#define _H_DEMARSHAL + +#include +#include + +SPICE_BEGIN_DECLS + +typedef void (*message_destructor_t)(uint8_t *message); +typedef uint8_t * (*spice_parse_channel_func_t)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, + size_t *size_out, message_destructor_t *free_message); + +spice_parse_channel_func_t spice_get_server_channel_parser(uint32_t channel, unsigned int *max_message_type); +spice_parse_channel_func_t spice_get_server_channel_parser1(uint32_t channel, unsigned int *max_message_type); + +SPICE_END_DECLS + +#endif + diff -Nru spice-gtk-0.9/spice-common/common/client_marshallers.h spice-gtk-0.12/spice-common/common/client_marshallers.h --- spice-gtk-0.9/spice-common/common/client_marshallers.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/client_marshallers.h 2012-04-21 18:50:39.000000000 +0000 @@ -0,0 +1,79 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2010 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H_MARSHALLERS +#define _H_MARSHALLERS + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "marshaller.h" +#include "messages.h" + +SPICE_BEGIN_DECLS + +typedef struct { + void (*msg_SpiceMsgEmpty)(SpiceMarshaller *m, SpiceMsgEmpty *msg); + void (*msg_SpiceMsgData)(SpiceMarshaller *m, SpiceMsgData *msg); + void (*msg_SpiceMsgAudioVolume)(SpiceMarshaller *m, SpiceMsgAudioVolume *msg); + void (*msg_SpiceMsgAudioMute)(SpiceMarshaller *m, SpiceMsgAudioMute *msg); + void (*msgc_ack_sync)(SpiceMarshaller *m, SpiceMsgcAckSync *msg); + void (*msgc_pong)(SpiceMarshaller *m, SpiceMsgPing *msg); + void (*msgc_disconnecting)(SpiceMarshaller *m, SpiceMsgDisconnect *msg); + void (*msgc_main_client_info)(SpiceMarshaller *m, SpiceMsgcClientInfo *msg); + void (*msgc_main_mouse_mode_request)(SpiceMarshaller *m, SpiceMsgcMainMouseModeRequest *msg); + void (*msgc_main_agent_start)(SpiceMarshaller *m, SpiceMsgcMainAgentStart *msg); + void (*msgc_main_agent_token)(SpiceMarshaller *m, SpiceMsgcMainAgentTokens *msg); + void (*msgc_display_init)(SpiceMarshaller *m, SpiceMsgcDisplayInit *msg); + void (*msgc_inputs_key_down)(SpiceMarshaller *m, SpiceMsgcKeyDown *msg); + void (*msgc_inputs_key_up)(SpiceMarshaller *m, SpiceMsgcKeyUp *msg); + void (*msgc_inputs_key_modifiers)(SpiceMarshaller *m, SpiceMsgcKeyModifiers *msg); + void (*msgc_inputs_mouse_motion)(SpiceMarshaller *m, SpiceMsgcMouseMotion *msg); + void (*msgc_inputs_mouse_position)(SpiceMarshaller *m, SpiceMsgcMousePosition *msg); + void (*msgc_inputs_mouse_press)(SpiceMarshaller *m, SpiceMsgcMousePress *msg); + void (*msgc_inputs_mouse_release)(SpiceMarshaller *m, SpiceMsgcMouseRelease *msg); + void (*msgc_record_data)(SpiceMarshaller *m, SpiceMsgcRecordPacket *msg); + void (*msgc_record_mode)(SpiceMarshaller *m, SpiceMsgcRecordMode *msg); + void (*msgc_record_start_mark)(SpiceMarshaller *m, SpiceMsgcRecordStartMark *msg); + void (*msgc_tunnel_service_add)(SpiceMarshaller *m, SpiceMsgcTunnelAddGenericService *msg, SpiceMarshaller **name_out, SpiceMarshaller **description_out); + void (*msgc_tunnel_service_remove)(SpiceMarshaller *m, SpiceMsgcTunnelRemoveService *msg); + void (*msgc_tunnel_socket_open_ack)(SpiceMarshaller *m, SpiceMsgcTunnelSocketOpenAck *msg); + void (*msgc_tunnel_socket_open_nack)(SpiceMarshaller *m, SpiceMsgcTunnelSocketOpenNack *msg); + void (*msgc_tunnel_socket_fin)(SpiceMarshaller *m, SpiceMsgcTunnelSocketFin *msg); + void (*msgc_tunnel_socket_closed)(SpiceMarshaller *m, SpiceMsgcTunnelSocketClosed *msg); + void (*msgc_tunnel_socket_closed_ack)(SpiceMarshaller *m, SpiceMsgcTunnelSocketClosedAck *msg); + void (*msgc_tunnel_socket_data)(SpiceMarshaller *m, SpiceMsgcTunnelSocketData *msg); + void (*msgc_tunnel_socket_token)(SpiceMarshaller *m, SpiceMsgcTunnelSocketTokens *msg); +#ifdef USE_SMARTCARD + void (*msgc_smartcard_atr)(SpiceMarshaller *m, VSCMsgATR *msg); + void (*msgc_smartcard_error)(SpiceMarshaller *m, VSCMsgError *msg); + void (*msgc_smartcard_header)(SpiceMarshaller *m, VSCMsgHeader *msg); + void (*msgc_smartcard_msg)(SpiceMarshaller *m, SpiceMsgcSmartcard *msg, SpiceMarshaller **reader_name_out); + void (*msgc_smartcard_reader_add)(SpiceMarshaller *m, VSCMsgReaderAdd *msg); +#endif +} SpiceMessageMarshallers; + +SpiceMessageMarshallers *spice_message_marshallers_get(void); +SpiceMessageMarshallers *spice_message_marshallers_get1(void); + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/draw.h spice-gtk-0.12/spice-common/common/draw.h --- spice-gtk-0.9/spice-common/common/draw.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/draw.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,278 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + 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 copyright holder 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 HOLDER 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 + HOLDER OR CONTRIBUTORS 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. +*/ + +#ifndef _H_SPICE_DRAW +#define _H_SPICE_DRAW + +#include +#include +#include +#include "mem.h" + +SPICE_BEGIN_DECLS + +#define SPICE_GET_ADDRESS(addr) ((void *)(uintptr_t)(addr)) +#define SPICE_SET_ADDRESS(addr, val) ((addr) = (uintptr_t)(val)) + +typedef int32_t SPICE_FIXED28_4; + +typedef struct SpicePointFix { + SPICE_FIXED28_4 x; + SPICE_FIXED28_4 y; +} SpicePointFix; + +typedef struct SpicePoint { + int32_t x; + int32_t y; +} SpicePoint; + +typedef struct SpicePoint16 { + int16_t x; + int16_t y; +} SpicePoint16; + +typedef struct SpiceRect { + int32_t left; + int32_t top; + int32_t right; + int32_t bottom; +} SpiceRect; + +typedef struct SpicePathSeg { + uint32_t flags; + uint32_t count; + SpicePointFix points[0]; +} SpicePathSeg; + +typedef struct SpicePath { + uint32_t num_segments; + SpicePathSeg *segments[0]; +} SpicePath; + +typedef struct SpiceClipRects { + uint32_t num_rects; + SpiceRect rects[0]; +} SpiceClipRects; + +typedef struct SpiceClip { + uint32_t type; + SpiceClipRects *rects; +} SpiceClip; + +typedef struct SpicePalette { + uint64_t unique; + uint16_t num_ents; + uint32_t ents[0]; +} SpicePalette; + +#define SPICE_SURFACE_FMT_DEPTH(_d) ((_d) & 0x3f) + +typedef struct SpiceImageDescriptor { + uint64_t id; + uint8_t type; + uint8_t flags; + uint32_t width; + uint32_t height; +} SpiceImageDescriptor; + +typedef struct SpiceBitmap { + uint8_t format; + uint8_t flags; + uint32_t x; + uint32_t y; + uint32_t stride; + SpicePalette *palette; + uint64_t palette_id; + SpiceChunks *data; +} SpiceBitmap; + +typedef struct SpiceSurface { + uint32_t surface_id; +} SpiceSurface; + +typedef struct SpiceQUICData { + uint32_t data_size; + SpiceChunks *data; +} SpiceQUICData, SpiceLZRGBData, SpiceJPEGData; + +typedef struct SpiceLZPLTData { + uint8_t flags; + uint32_t data_size; + SpicePalette *palette; + uint64_t palette_id; + SpiceChunks *data; +} SpiceLZPLTData; + +typedef struct SpiceZlibGlzRGBData { + uint32_t glz_data_size; + uint32_t data_size; + SpiceChunks *data; +} SpiceZlibGlzRGBData; + +typedef struct SpiceJPEGAlphaData { + uint8_t flags; + uint32_t jpeg_size; + uint32_t data_size; + SpiceChunks *data; +} SpiceJPEGAlphaData; + + +typedef struct SpiceImage { + SpiceImageDescriptor descriptor; + union { + SpiceBitmap bitmap; + SpiceQUICData quic; + SpiceSurface surface; + SpiceLZRGBData lz_rgb; + SpiceLZPLTData lz_plt; + SpiceJPEGData jpeg; + SpiceZlibGlzRGBData zlib_glz; + SpiceJPEGAlphaData jpeg_alpha; + } u; +} SpiceImage; + +typedef struct SpicePattern { + SpiceImage *pat; + SpicePoint pos; +} SpicePattern; + +typedef struct SpiceBrush { + uint32_t type; + union { + uint32_t color; + SpicePattern pattern; + } u; +} SpiceBrush; + +typedef struct SpiceQMask { + uint8_t flags; + SpicePoint pos; + SpiceImage *bitmap; +} SpiceQMask; + +typedef struct SpiceFill { + SpiceBrush brush; + uint16_t rop_descriptor; + SpiceQMask mask; +} SpiceFill; + +typedef struct SpiceOpaque { + SpiceImage *src_bitmap; + SpiceRect src_area; + SpiceBrush brush; + uint16_t rop_descriptor; + uint8_t scale_mode; + SpiceQMask mask; +} SpiceOpaque; + +typedef struct SpiceCopy { + SpiceImage *src_bitmap; + SpiceRect src_area; + uint16_t rop_descriptor; + uint8_t scale_mode; + SpiceQMask mask; +} SpiceCopy, SpiceBlend; + +typedef struct SpiceTransparent { + SpiceImage *src_bitmap; + SpiceRect src_area; + uint32_t src_color; + uint32_t true_color; +} SpiceTransparent; + +typedef struct SpiceAlphaBlend { + uint16_t alpha_flags; + uint8_t alpha; + SpiceImage *src_bitmap; + SpiceRect src_area; +} SpiceAlphaBlend; + +typedef struct SpiceRop3 { + SpiceImage *src_bitmap; + SpiceRect src_area; + SpiceBrush brush; + uint8_t rop3; + uint8_t scale_mode; + SpiceQMask mask; +} SpiceRop3; + +typedef struct SpiceBlackness { + SpiceQMask mask; +} SpiceBlackness, SpiceInvers, SpiceWhiteness; + +typedef struct SpiceLineAttr { + uint8_t flags; + uint8_t style_nseg; + SPICE_FIXED28_4 *style; +} SpiceLineAttr; + +typedef struct SpiceStroke { + SpicePath *path; + SpiceLineAttr attr; + SpiceBrush brush; + uint16_t fore_mode; + uint16_t back_mode; +} SpiceStroke; + +typedef struct SpiceRasterGlyph { + SpicePoint render_pos; + SpicePoint glyph_origin; + uint16_t width; + uint16_t height; + uint8_t data[0]; +} SpiceRasterGlyph; + +typedef struct SpiceString { + uint16_t length; + uint16_t flags; + SpiceRasterGlyph *glyphs[0]; +} SpiceString; + +typedef struct SpiceText { + SpiceString *str; + SpiceRect back_area; + SpiceBrush fore_brush; + SpiceBrush back_brush; + uint16_t fore_mode; + uint16_t back_mode; +} SpiceText; + +typedef struct SpiceCursorHeader { + uint64_t unique; + uint16_t type; + uint16_t width; + uint16_t height; + uint16_t hot_spot_x; + uint16_t hot_spot_y; +} SpiceCursorHeader; + +SPICE_END_DECLS + +#endif /* _H_SPICE_DRAW */ diff -Nru spice-gtk-0.9/spice-common/common/gdi_canvas.c spice-gtk-0.12/spice-common/common/gdi_canvas.c --- spice-gtk-0.9/spice-common/common/gdi_canvas.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/gdi_canvas.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,1866 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifdef HAVE_CONFIG_H +#ifdef __MINGW32__ +#undef HAVE_STDLIB_H +#endif +#include +#endif + +#include +#include +#include "gdi_canvas.h" +#define GDI_CANVAS +#include "canvas_base.c" +#include "rop3.h" +#include "rect.h" +#include "region.h" +#include "threads.h" + +typedef struct GdiCanvas GdiCanvas; + +struct GdiCanvas { + CanvasBase base; + HDC dc; + RecurciveMutex* lock; +}; + + +struct BitmapData { + HBITMAP hbitmap; + HBITMAP prev_hbitmap; + SpicePoint pos; + uint8_t flags; + HDC dc; + int cache; + int from_surface; +}; + +#define _rop3_brush 0xf0 +#define _rop3_src 0xcc +#define _rop3_dest 0xaa + +uint32_t raster_ops[] = { + 0x00000042, + 0x00010289, + 0x00020C89, + 0x000300AA, + 0x00040C88, + 0x000500A9, + 0x00060865, + 0x000702C5, + 0x00080F08, + 0x00090245, + 0x000A0329, + 0x000B0B2A, + 0x000C0324, + 0x000D0B25, + 0x000E08A5, + 0x000F0001, + 0x00100C85, + 0x001100A6, + 0x00120868, + 0x001302C8, + 0x00140869, + 0x001502C9, + 0x00165CCA, + 0x00171D54, + 0x00180D59, + 0x00191CC8, + 0x001A06C5, + 0x001B0768, + 0x001C06CA, + 0x001D0766, + 0x001E01A5, + 0x001F0385, + 0x00200F09, + 0x00210248, + 0x00220326, + 0x00230B24, + 0x00240D55, + 0x00251CC5, + 0x002606C8, + 0x00271868, + 0x00280369, + 0x002916CA, + 0x002A0CC9, + 0x002B1D58, + 0x002C0784, + 0x002D060A, + 0x002E064A, + 0x002F0E2A, + 0x0030032A, + 0x00310B28, + 0x00320688, + 0x00330008, + 0x003406C4, + 0x00351864, + 0x003601A8, + 0x00370388, + 0x0038078A, // PSDPoax + 0x00390604, // SPDnox + 0x003A0644, // SPDSxox + 0x003B0E24, // SPDnoan + 0x003C004A, // PSx + 0x003D18A4, // SPDSonox + 0x003E1B24, // SPDSnaox + 0x003F00EA, // PSan + 0x00400F0A, // PSDnaa + 0x00410249, // DPSxon + 0x00420D5D, // SDxPDxa + 0x00431CC4, // SPDSanaxn + 0x00440328, // SDna SRCERASE + 0x00450B29, // DPSnaon + 0x004606C6, // DSPDaox + 0x0047076A, // PSDPxaxn + 0x00480368, // SDPxa + 0x004916C5, // PDSPDaoxxn + 0x004A0789, // DPSDoax + 0x004B0605, // PDSnox + 0x004C0CC8, // SDPana + 0x004D1954, // SSPxDSxoxn + 0x004E0645, // PDSPxox + 0x004F0E25, // PDSnoan + 0x00500325, // PDna + 0x00510B26, // DSPnaon + 0x005206C9, // DPSDaox + 0x00530764, // SPDSxaxn + 0x005408A9, // DPSonon + 0x00550009, // Dn DSTINVERT + 0x005601A9, // DPSox + 0x00570389, // DPSoan + 0x00580785, // PDSPoax + 0x00590609, // DPSnox + 0x005A0049, // DPx PATINVERT + 0x005B18A9, // DPSDonox + 0x005C0649, // DPSDxox + 0x005D0E29, // DPSnoan + 0x005E1B29, // DPSDnaox + 0x005F00E9, // DPan + 0x00600365, // PDSxa + 0x006116C6, // DSPDSaoxxn + 0x00620786, // DSPDoax + 0x00630608, // SDPnox + 0x00640788, // SDPSoax + 0x00650606, // DSPnox + 0x00660046, // DSx SRCINVERT + 0x006718A8, // SDPSonox + 0x006858A6, // DSPDSonoxxn + 0x00690145, // PDSxxn + 0x006A01E9, // DPSax + 0x006B178A, // PSDPSoaxxn + 0x006C01E8, // SDPax + 0x006D1785, // PDSPDoaxxn + 0x006E1E28, // SDPSnoax + 0x006F0C65, // PDSxnan + 0x00700CC5, // PDSana + 0x00711D5C, // SSDxPDxaxn + 0x00720648, // SDPSxox + 0x00730E28, // SDPnoan + 0x00740646, // DSPDxox + 0x00750E26, // DSPnoan + 0x00761B28, // SDPSnaox + 0x007700E6, // DSan + 0x007801E5, // PDSax + 0x00791786, // DSPDSoaxxn + 0x007A1E29, // DPSDnoax + 0x007B0C68, // SDPxnan + 0x007C1E24, // SPDSnoax + 0x007D0C69, // DPSxnan + 0x007E0955, // SPxDSxo + 0x007F03C9, // DPSaan + 0x008003E9, // DPSaa + 0x00810975, // SPxDSxon + 0x00820C49, // DPSxna + 0x00831E04, // SPDSnoaxn + 0x00840C48, // SDPxna + 0x00851E05, // PDSPnoaxn + 0x008617A6, // DSPDSoaxx + 0x008701C5, // PDSaxn + 0x008800C6, // DSa SRCAND + 0x00891B08, // SDPSnaoxn + 0x008A0E06, // DSPnoa + 0x008B0666, // DSPDxoxn + 0x008C0E08, // SDPnoa + 0x008D0668, // SDPSxoxn + 0x008E1D7C, // SSDxPDxax + 0x008F0CE5, // PDSanan + 0x00900C45, // PDSxna + 0x00911E08, // SDPSnoaxn + 0x009217A9, // DPSDPoaxx + 0x009301C4, // SPDaxn + 0x009417AA, // PSDPSoaxx + 0x009501C9, // DPSaxn + 0x00960169, // DPSxx + 0x0097588A, // PSDPSonoxx + 0x00981888, // SDPSonoxn + 0x00990066, // DSxn + 0x009A0709, // DPSnax + 0x009B07A8, // SDPSoaxn + 0x009C0704, // SPDnax + 0x009D07A6, // DSPDoaxn + 0x009E16E6, // DSPDSaoxx + 0x009F0345, // PDSxan + 0x00A000C9, // DPa + 0x00A11B05, // PDSPnaoxn + 0x00A20E09, // DPSnoa + 0x00A30669, // DPSDxoxn + 0x00A41885, // PDSPonoxn + 0x00A50065, // PDxn + 0x00A60706, // DSPnax + 0x00A707A5, // PDSPoaxn + 0x00A803A9, // DPSoa + 0x00A90189, // DPSoxn + 0x00AA0029, // D + 0x00AB0889, // DPSono + 0x00AC0744, // SPDSxax + 0x00AD06E9, // DPSDaoxn + 0x00AE0B06, // DSPnao + 0x00AF0229, // DPno + 0x00B00E05, // PDSnoa + 0x00B10665, // PDSPxoxn + 0x00B21974, // SSPxDSxox + 0x00B30CE8, // SDPanan + 0x00B4070A, // PSDnax + 0x00B507A9, // DPSDoaxn + 0x00B616E9, // DPSDPaoxx + 0x00B70348, // SDPxan + 0x00B8074A, // PSDPxax + 0x00B906E6, // DSPDaoxn + 0x00BA0B09, // DPSnao + 0x00BB0226, // DSno MERGEPAINT + 0x00BC1CE4, // SPDSanax + 0x00BD0D7D, // SDxPDxan + 0x00BE0269, // DPSxo + 0x00BF08C9, // DPSano + 0x00C000CA, // PSa MERGECOPY + 0x00C11B04, // SPDSnaoxn + 0x00C21884, // SPDSonoxn + 0x00C3006A, // PSxn + 0x00C40E04, // SPDnoa + 0x00C50664, // SPDSxoxn + 0x00C60708, // SDPnax + 0x00C707AA, // PSDPoaxn + 0x00C803A8, // SDPoa + 0x00C90184, // SPDoxn + 0x00CA0749, // DPSDxax + 0x00CB06E4, // SPDSaoxn + 0x00CC0020, // S SRCCOPY + 0x00CD0888, // SDPono + 0x00CE0B08, // SDPnao + 0x00CF0224, // SPno + 0x00D00E0A, // PSDnoa + 0x00D1066A, // PSDPxoxn + 0x00D20705, // PDSnax + 0x00D307A4, // SPDSoaxn + 0x00D41D78, // SSPxPDxax + 0x00D50CE9, // DPSanan + 0x00D616EA, // PSDPSaoxx + 0x00D70349, // DPSxan + 0x00D80745, // PDSPxax + 0x00D906E8, // SDPSaoxn + 0x00DA1CE9, // DPSDanax + 0x00DB0D75, // SPxDSxan + 0x00DC0B04, // SPDnao + 0x00DD0228, // SDno + 0x00DE0268, // SDPxo + 0x00DF08C8, // SDPano + 0x00E003A5, // PDSoa + 0x00E10185, // PDSoxn + 0x00E20746, // DSPDxax + 0x00E306EA, // PSDPaoxn + 0x00E40748, // SDPSxax + 0x00E506E5, // PDSPaoxn + 0x00E61CE8, // SDPSanax + 0x00E70D79, // SPxPDxan + 0x00E81D74, // SSPxDSxax + 0x00E95CE6, // DSPDSanaxxn + 0x00EA02E9, // DPSao + 0x00EB0849, // DPSxno + 0x00EC02E8, // SDPao + 0x00ED0848, // SDPxno + 0x00EE0086, // DSo SRCPAINT + 0x00EF0A08, // SDPnoo + 0x00F00021, // P PATCOPY + 0x00F10885, // PDSono + 0x00F20B05, // PDSnao + 0x00F3022A, // PSno + 0x00F40B0A, // PSDnao + 0x00F50225, // PDno + 0x00F60265, // PDSxo + 0x00F708C5, // PDSano + 0x00F802E5, // PDSao + 0x00F90845, // PDSxno + 0x00FA0089, // DPo + 0x00FB0A09, // DPSnoo PATPAINT + 0x00FC008A, // PSo + 0x00FD0A0A, // PSDnoo + 0x00FE02A9, // DPSoo + 0x00FF0062 // 1 WHITENESS +}; + +static void set_path(GdiCanvas *canvas, SpicePath *s) +{ + unsigned int i; + + for (i = 0; i < s->num_segments; i++) { + SpicePathSeg* seg = s->segments[0]; + SpicePointFix* point = seg->points; + SpicePointFix* end_point = point + seg->count; + + if (seg->flags & SPICE_PATH_BEGIN) { + BeginPath(canvas->dc); + if (!MoveToEx(canvas->dc, (int)fix_to_double(point->x), (int)fix_to_double(point->y), + NULL)) { + spice_critical("MoveToEx failed"); + return; + } + point++; + } + + if (seg->flags & SPICE_PATH_BEZIER) { + spice_return_if_fail((point - end_point) % 3 == 0); + for (; point + 2 < end_point; point += 3) { + POINT points[3]; + + points[0].x = (int)fix_to_double(point[0].x); + points[0].y = (int)fix_to_double(point[0].y); + points[1].x = (int)fix_to_double(point[1].x); + points[1].y = (int)fix_to_double(point[1].y); + points[2].x = (int)fix_to_double(point[2].x); + points[2].y = (int)fix_to_double(point[2].y); + if (!PolyBezierTo(canvas->dc, points, 3)) { + spice_critical("PolyBezierTo failed"); + return; + } + } + } else { + for (; point < end_point; point++) { + if (!LineTo(canvas->dc, (int)fix_to_double(point->x), + (int)fix_to_double(point->y))) { + spice_critical("LineTo failed"); + } + } + } + + if (seg->flags & SPICE_PATH_END) { + + if (seg->flags & SPICE_PATH_CLOSE) { + if (!CloseFigure(canvas->dc)) { + spice_critical("CloseFigure failed"); + } + } + + if (!EndPath(canvas->dc)) { + spice_critical("EndPath failed"); + } + } + + } +} + +static void set_scale_mode(GdiCanvas *canvas, uint8_t scale_mode) +{ + if (scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE) { + SetStretchBltMode(canvas->dc, HALFTONE); + } else if (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) { + SetStretchBltMode(canvas->dc, COLORONCOLOR); + } else { + spice_critical("Unknown ScaleMode"); + } +} + +static void set_clip(GdiCanvas *canvas, SpiceClip *clip) +{ + switch (clip->type) { + case SPICE_CLIP_TYPE_NONE: + if (SelectClipRgn(canvas->dc, NULL) == ERROR) { + spice_critical("SelectClipRgn failed"); + } + break; + case SPICE_CLIP_TYPE_RECTS: { + uint32_t n = clip->rects->num_rects; + + SpiceRect *now = clip->rects->rects; + SpiceRect *end = now + n; + + if (now < end) { + HRGN main_hrgn; + + main_hrgn = CreateRectRgn(now->left, now->top, now->right, now->bottom); + if (!main_hrgn) { + return; + } + now++; + for (; now < end; now++) { + HRGN combaine_hrgn; + combaine_hrgn = CreateRectRgn(now->left, now->top, now->right, + now->bottom); + if (!combaine_hrgn) { + spice_critical("Unable to CreateRectRgn"); + DeleteObject(main_hrgn); + return; + } + if (CombineRgn(main_hrgn, main_hrgn, combaine_hrgn, RGN_OR) == ERROR) { + spice_critical("Unable to CombineRgn"); + DeleteObject(combaine_hrgn); + return; + } + DeleteObject(combaine_hrgn); + } + if (SelectClipRgn(canvas->dc, main_hrgn) == ERROR) { + spice_critical("Unable to SelectClipRgn"); + } + DeleteObject(main_hrgn); + } + break; + } + default: + spice_warn_if_reached(); + return; + } +} + +static void copy_bitmap(const uint8_t *src_image, int height, int src_stride, + uint8_t *dest_bitmap, int dest_stride) +{ + int copy_width = MIN(dest_stride, src_stride); + int y = 0; + + spice_return_if_fail(dest_stride >= 0 && src_stride >= 0); + + while (y < height) { + memcpy(dest_bitmap, src_image, copy_width); + src_image += src_stride; + dest_bitmap += dest_stride; + y++; + } +} + +static void copy_bitmap_alpha(const uint8_t *src_alpha, int height, int width, int src_stride, + uint8_t *dest_bitmap, int dest_stride, int alpha_bits_size) +{ + int y = 0; + uint8_t i_offset; + int i_count = 0; + int i = 0; + + if (alpha_bits_size == 1) { + i_offset = 1; + } else { + i_offset = 8; + } + + + while (y < height) { + int x; + + for (x = 0; x < width; ++x) { + uint8_t alphaval; + double alpha; + + alphaval = src_alpha[i]; + alphaval = alphaval >> (i_count * i_offset); + alphaval &= ((uint8_t)0xff >> (8 - i_offset)); + alphaval = ((255 * alphaval) / ((uint8_t)0xff >> (8 - i_offset))); + + dest_bitmap[x * 4 + 3] = alphaval; + alpha = (double)alphaval / 0xff; + dest_bitmap[x * 4 + 2] = (uint8_t)(alpha * dest_bitmap[x * 4 + 2]); + dest_bitmap[x * 4 + 1] = (uint8_t)(alpha * dest_bitmap[x * 4 + 1]); + dest_bitmap[x * 4] = (uint8_t)(alpha * dest_bitmap[x * 4]); + + i_count++; + if (i_count == (8 / i_offset)) { + i++; + i_count = 0; + } + } + + dest_bitmap += width * 4; + i = 0; + src_alpha += src_stride; + i_count = 0; + y++; + } +} + +static uint8_t *create_bitmap(HBITMAP *bitmap, HBITMAP *prev_bitmap, HDC *dc, + const uint8_t *bitmap_data, int width, int height, + int stride, int bits, int rotate) +{ + uint8_t *data; + const uint8_t *src_data; + uint32_t nstride; + struct { + BITMAPINFO inf; + RGBQUAD palette[255]; + } bitmap_info; + + memset(&bitmap_info, 0, sizeof(bitmap_info)); + bitmap_info.inf.bmiHeader.biSize = sizeof(bitmap_info.inf.bmiHeader); + bitmap_info.inf.bmiHeader.biWidth = width; + if (stride < 0) { + bitmap_info.inf.bmiHeader.biHeight = height; + } else { + bitmap_info.inf.bmiHeader.biHeight = -height; + } + + if (rotate) { + bitmap_info.inf.bmiHeader.biHeight = -bitmap_info.inf.bmiHeader.biHeight; + } + + bitmap_info.inf.bmiHeader.biPlanes = 1; + bitmap_info.inf.bmiHeader.biBitCount = bits; + bitmap_info.inf.bmiHeader.biCompression = BI_RGB; + + *dc = create_compatible_dc(); + if (!*dc) { + spice_critical("create_compatible_dc() failed"); + return NULL; + } + + *bitmap = CreateDIBSection(*dc, &bitmap_info.inf, 0, (VOID **)&data, NULL, 0); + if (!*bitmap) { + spice_critical("Unable to CreateDIBSection"); + DeleteDC(*dc); + return NULL; + } + *prev_bitmap = (HBITMAP)SelectObject(*dc, *bitmap); + + if (stride < 0) { + src_data = bitmap_data - (height - 1) * -stride; + } else { + src_data = bitmap_data; + } + + switch (bits) { + case 1: + nstride = SPICE_ALIGN(width, 32) / 8; + break; + case 8: + nstride = SPICE_ALIGN(width, 4); + break; + case 16: + nstride = SPICE_ALIGN(width * 2, 4); + break; + case 32: + nstride = width * 4; + break; + default: + spice_warn_if_reached(); + return; + } + + if (bitmap_data) { + if (stride < 0) { + copy_bitmap(src_data, height, -stride, data, nstride); + } else { + copy_bitmap(src_data, height, stride, data, nstride); + } + } + + return data; +} + +static uint8_t *create_bitmap_from_pixman(HBITMAP *bitmap, HBITMAP *prev_bitmap, HDC *dc, + pixman_image_t *surface, int rotate) +{ + return create_bitmap(bitmap, prev_bitmap, dc, + (uint8_t*)pixman_image_get_data(surface), + pixman_image_get_width(surface), + pixman_image_get_height(surface), + pixman_image_get_stride(surface), + spice_pixman_image_get_bpp(surface), + rotate); +} + + +static void release_bitmap(HDC dc, HBITMAP bitmap, HBITMAP prev_bitmap, int cache) +{ + bitmap = (HBITMAP)SelectObject(dc, prev_bitmap); + if (!cache) { + DeleteObject(bitmap); + } + DeleteDC(dc); +} + +static inline uint8_t get_converted_color(uint8_t color) +{ + uint8_t msb; + + msb = color & 0xE0; + msb = msb >> 5; + color |= msb; + return color; +} + +static inline COLORREF get_color_ref(GdiCanvas *canvas, uint32_t color) +{ + int shift = canvas->base.color_shift == 8 ? 0 : 3; + uint8_t r, g, b; + + b = (color & canvas->base.color_mask); + color >>= canvas->base.color_shift; + g = (color & canvas->base.color_mask); + color >>= canvas->base.color_shift; + r = (color & canvas->base.color_mask); + if (shift) { + r = get_converted_color(r << shift); + g = get_converted_color(g << shift); + b = get_converted_color(b << shift); + } + return RGB(r, g, b); +} + +static HBRUSH get_brush(GdiCanvas *canvas, SpiceBrush *brush, RecurciveMutex **brush_lock) +{ + HBRUSH hbrush; + + *brush_lock = NULL; + + switch (brush->type) { + case SPICE_BRUSH_TYPE_SOLID: + if (!(hbrush = CreateSolidBrush(get_color_ref(canvas, brush->u.color)))) { + spice_critical("CreateSolidBrush failed"); + return NULL; + } + return hbrush; + case SPICE_BRUSH_TYPE_PATTERN: { + GdiCanvas *gdi_surface = NULL; + HBRUSH hbrush; + pixman_image_t *surface = NULL; + HDC dc; + HBITMAP bitmap; + HBITMAP prev_bitmap; + + gdi_surface = (GdiCanvas *)canvas_get_surface(&canvas->base, brush->u.pattern.pat); + if (gdi_surface) { + bitmap = (HBITMAP)GetCurrentObject(gdi_surface->dc, OBJ_BITMAP); + if (!bitmap) { + spice_critical("GetCurrentObject failed"); + return NULL; + } + *brush_lock = gdi_surface->lock; + } else { + surface = canvas_get_image(&canvas->base, brush->u.pattern.pat, FALSE); + if (!create_bitmap_from_pixman(&bitmap, &prev_bitmap, &dc, surface, 0)) { + spice_critical("create_bitmap failed"); + return NULL; + } + } + + if (!(hbrush = CreatePatternBrush(bitmap))) { + spice_critical("CreatePatternBrush failed"); + return NULL; + } + + if (!gdi_surface) { + release_bitmap(dc, bitmap, prev_bitmap, 0); + pixman_image_unref(surface); + } + return hbrush; + } + case SPICE_BRUSH_TYPE_NONE: + return NULL; + default: + spice_warn_if_reached(); + return NULL; + } +} + +static HBRUSH set_brush(HDC dc, HBRUSH hbrush, SpiceBrush *brush) +{ + switch (brush->type) { + case SPICE_BRUSH_TYPE_SOLID: { + return (HBRUSH)SelectObject(dc, hbrush); + } + case SPICE_BRUSH_TYPE_PATTERN: { + HBRUSH prev_hbrush; + prev_hbrush = (HBRUSH)SelectObject(dc, hbrush); + if (!SetBrushOrgEx(dc, brush->u.pattern.pos.x, brush->u.pattern.pos.y, NULL)) { + spice_critical("SetBrushOrgEx failed"); + return NULL; + } + return prev_hbrush; + } + default: + spice_warn_if_reached(); + return NULL; + } +} + +static void unset_brush(HDC dc, HBRUSH prev_hbrush) +{ + if (!prev_hbrush) { + return; + } + prev_hbrush = (HBRUSH)SelectObject(dc, prev_hbrush); + DeleteObject(prev_hbrush); +} + +uint8_t calc_rop3(uint16_t rop3_bits, int brush) +{ + uint8_t rop3 = 0; + uint8_t rop3_src = _rop3_src; + uint8_t rop3_dest = _rop3_dest; + uint8_t rop3_brush = _rop3_brush; + uint8_t rop3_src_brush; + + if (rop3_bits & SPICE_ROPD_INVERS_SRC) { + rop3_src = ~rop3_src; + } + if (rop3_bits & SPICE_ROPD_INVERS_BRUSH) { + rop3_brush = ~rop3_brush; + } + if (rop3_bits & SPICE_ROPD_INVERS_DEST) { + rop3_dest = ~rop3_dest; + } + + if (brush) { + rop3_src_brush = rop3_brush; + } else { + rop3_src_brush = rop3_src; + } + + if (rop3_bits & SPICE_ROPD_OP_PUT) { + rop3 = rop3_src_brush; + } + if (rop3_bits & SPICE_ROPD_OP_OR) { + rop3 = rop3_src_brush | rop3_dest; + } + if (rop3_bits & SPICE_ROPD_OP_AND) { + rop3 = rop3_src_brush & rop3_dest; + } + if (rop3_bits & SPICE_ROPD_OP_XOR) { + rop3 = rop3_src_brush ^ rop3_dest; + } + if (rop3_bits & SPICE_ROPD_INVERS_RES) { + rop3 = ~rop3_dest; + } + + if (rop3_bits & SPICE_ROPD_OP_BLACKNESS || rop3_bits & SPICE_ROPD_OP_WHITENESS || + rop3_bits & SPICE_ROPD_OP_INVERS) { + spice_warn_if_reached("invalid rop3 type"); + return 0; + } + return rop3; +} + +uint8_t calc_rop3_src_brush(uint16_t rop3_bits) +{ + uint8_t rop3 = 0; + uint8_t rop3_src = _rop3_src; + uint8_t rop3_brush = _rop3_brush; + + if (rop3_bits & SPICE_ROPD_INVERS_SRC) { + rop3_src = ~rop3_src; + } + if (rop3_bits & SPICE_ROPD_INVERS_BRUSH) { + rop3_brush = ~rop3_brush; + } + + if (rop3_bits & SPICE_ROPD_OP_OR) { + rop3 = rop3_src | rop3_brush; + } + if (rop3_bits & SPICE_ROPD_OP_AND) { + rop3 = rop3_src & rop3_brush; + } + if (rop3_bits & SPICE_ROPD_OP_XOR) { + rop3 = rop3_src ^ rop3_brush; + } + + return rop3; +} + +static struct BitmapData get_mask_bitmap(struct GdiCanvas *canvas, struct SpiceQMask *mask) +{ + GdiCanvas *gdi_surface; + pixman_image_t *surface; + struct BitmapData bitmap; + PixmanData *pixman_data; + + bitmap.hbitmap = NULL; + if (!mask->bitmap) { + return bitmap; + } + + gdi_surface = (GdiCanvas *)canvas_get_surface_mask(&canvas->base, mask->bitmap); + if (gdi_surface) { + HBITMAP _bitmap; + + _bitmap = (HBITMAP)GetCurrentObject(gdi_surface->dc, OBJ_BITMAP); + if (!_bitmap) { + spice_critical("GetCurrentObject failed"); + return bitmap; + } + bitmap.dc = gdi_surface->dc; + bitmap.hbitmap = _bitmap; + bitmap.prev_hbitmap = (HBITMAP)0; + bitmap.cache = 0; + bitmap.from_surface = 1; + } else { + + if (!(surface = canvas_get_mask(&canvas->base, mask, NULL))) { + return bitmap; + } + + pixman_data = (PixmanData *)pixman_image_get_destroy_data (surface); + if (pixman_data && (WaitForSingleObject(pixman_data->mutex, INFINITE) != WAIT_FAILED)) { + bitmap.dc = create_compatible_dc(); + bitmap.prev_hbitmap = (HBITMAP)SelectObject(bitmap.dc, pixman_data->bitmap); + bitmap.hbitmap = pixman_data->bitmap; + ReleaseMutex(pixman_data->mutex); + bitmap.cache = 1; + } else if (!create_bitmap_from_pixman(&bitmap.hbitmap, &bitmap.prev_hbitmap, &bitmap.dc, + surface, 0)) { + bitmap.hbitmap = NULL; + } else { + bitmap.cache = 0; + } + + bitmap.from_surface = 0; + } + + bitmap.flags = mask->flags; + bitmap.pos = mask->pos; + + return bitmap; +} + +static void gdi_draw_bitmap(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest, + HDC src_dc, struct BitmapData *bitmapmask, uint32_t rop3_val) +{ + uint32_t rast_oper; + + rast_oper = raster_ops[rop3_val]; + + if (!bitmapmask || !bitmapmask->hbitmap) { + if ((dest->right - dest->left) == (src->right - src->left) && + (dest->bottom - dest->top) == (src->bottom - src->top)) { + if (!BitBlt(dest_dc, dest->left, dest->top, dest->right - dest->left, + dest->bottom - dest->top, src_dc, src->left, src->top, rast_oper)) { + spice_critical("BitBlt failed"); + return; + } + } else { + if (!StretchBlt(dest_dc, dest->left, dest->top, dest->right - dest->left, + dest->bottom - dest->top, src_dc, src->left, src->top, + src->right - src->left, src->bottom - src->top, rast_oper)) { + spice_critical("StretchBlt failed"); + return; + } + } + } else { + rast_oper = MAKEROP4(rast_oper, raster_ops[_rop3_dest]); + + if (!MaskBlt(dest_dc, dest->left, dest->top, dest->right - dest->left, + dest->bottom - dest->top, src_dc, src->left, src->top, + bitmapmask->hbitmap, bitmapmask->pos.x, bitmapmask->pos.y, + rast_oper)) { + spice_critical("MaskBlt failed"); + return; + } + } +} + +static void gdi_draw_bitmap_redrop(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest, + HDC src_dc, struct BitmapData *bitmapmask, + uint16_t rop, int brush) +{ + uint32_t rop3_val; + + rop3_val = calc_rop3(rop, brush); + gdi_draw_bitmap(dest_dc, src, dest, src_dc, bitmapmask, rop3_val); +} + +static void free_mask(struct BitmapData *bitmap) +{ + if (bitmap->hbitmap) { + if (!bitmap->from_surface) { + release_bitmap(bitmap->dc, bitmap->hbitmap, bitmap->prev_hbitmap, bitmap->cache); + } + } +} + +static void draw_str_mask_bitmap(struct GdiCanvas *canvas, + SpiceString *str, int n, SpiceRect *dest, + SpiceRect *src, SpiceBrush *brush) +{ + pixman_image_t *surface; + struct BitmapData bitmap; + SpicePoint pos; + int dest_stride; + uint8_t *bitmap_data; + HBRUSH prev_hbrush; + HBRUSH hbrush; + RecurciveMutex *brush_lock; + + bitmap.hbitmap = (HBITMAP)1; + if (!(surface = canvas_get_str_mask(&canvas->base, str, n, &pos))) { + spice_critical("unable to canvas_get_str_mask"); + return; + } + + bitmap.from_surface = 0; + bitmap.cache = 0; + bitmap_data = create_bitmap(&bitmap.hbitmap, &bitmap.prev_hbitmap, + &bitmap.dc, NULL, + pixman_image_get_width(surface), + pixman_image_get_height(surface), + pixman_image_get_stride(surface), 32, 0); + + if (!bitmap_data) { + return; + } + + bitmap.flags = 0; + bitmap.pos.x = 0; + bitmap.pos.y = 0; + + dest->left = pos.x; + dest->top = pos.y; + dest->right = pos.x + pixman_image_get_width(surface); + dest->bottom = pos.y + pixman_image_get_height(surface); + src->left = 0; + src->top = 0; + src->right = pixman_image_get_width(surface); + src->bottom = pixman_image_get_height(surface); + + dest_stride = pixman_image_get_width(surface); + switch (n) { + case 1: + dest_stride = dest_stride / 8; + break; + case 4: + dest_stride = dest_stride / 2; + break; + case 32: + dest_stride = dest_stride * 4; + break; + default: + spice_warn_if_reached(); + return; + } + dest_stride = dest_stride + 3; + dest_stride = dest_stride & ~3; + + hbrush = get_brush(canvas, brush, &brush_lock); + prev_hbrush = set_brush(bitmap.dc, hbrush, brush); + if (brush_lock) { + RecurciveLock b_lock(*brush_lock); + gdi_draw_bitmap(bitmap.dc, src, src, bitmap.dc, NULL, _rop3_brush); + } else { + gdi_draw_bitmap(bitmap.dc, src, src, bitmap.dc, NULL, _rop3_brush); + } + + unset_brush(bitmap.dc, prev_hbrush); + + copy_bitmap_alpha((uint8_t *)pixman_image_get_data(surface), + pixman_image_get_height(surface), + pixman_image_get_width(surface), + pixman_image_get_stride(surface), + bitmap_data, dest_stride, n); + + BLENDFUNCTION bf = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA}; + + RecurciveLock lock(*canvas->lock); + AlphaBlend(canvas->dc, dest->left, dest->top, dest->right - dest->left, + dest->bottom - dest->top, bitmap.dc, src->left, src->top, + src->right - src->left, src->bottom - src->top, bf); + + free_mask(&bitmap); +} + +static void gdi_draw_image(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest, + pixman_image_t *image, struct BitmapData *bitmapmask, uint16_t rop, + int rotate) +{ + HDC dc; + HBITMAP bitmap; + HBITMAP prev_bitmap; + + create_bitmap_from_pixman(&bitmap, &prev_bitmap, &dc, image, rotate); + + gdi_draw_bitmap_redrop(dest_dc, src, dest, dc, bitmapmask, rop, 0); + + release_bitmap(dc, bitmap, prev_bitmap, 0); +} + +static void gdi_draw_image_rop3(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest, + pixman_image_t *image, struct BitmapData *bitmapmask, uint8_t rop3, + int rotate) +{ + HDC dc; + HBITMAP bitmap; + HBITMAP prev_bitmap; + + create_bitmap_from_pixman(&bitmap, &prev_bitmap, &dc, image, rotate); + + gdi_draw_bitmap(dest_dc, src, dest, dc, bitmapmask, rop3); + + release_bitmap(dc, bitmap, prev_bitmap, 0); +} + +static void gdi_canvas_draw_fill(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill) +{ + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + HBRUSH prev_hbrush; + HBRUSH brush; + struct BitmapData bitmapmask; + RecurciveMutex *brush_lock; + + RecurciveLock lock(*canvas->lock); + + brush = get_brush(canvas, &fill->brush, &brush_lock); + spice_return_if_fail(brush != NULL); + + bitmapmask = get_mask_bitmap(canvas, &fill->mask); + + set_clip(canvas, clip); + prev_hbrush = set_brush(canvas->dc, brush, &fill->brush); + if (brush_lock) { + RecurciveLock b_lock(*brush_lock); + gdi_draw_bitmap_redrop(canvas->dc, bbox, bbox, canvas->dc, &bitmapmask, + fill->rop_descriptor, fill->brush.type != SPICE_BRUSH_TYPE_NONE); + } else { + gdi_draw_bitmap_redrop(canvas->dc, bbox, bbox, canvas->dc, &bitmapmask, + fill->rop_descriptor, fill->brush.type != SPICE_BRUSH_TYPE_NONE); + } + + free_mask(&bitmapmask); + unset_brush(canvas->dc, prev_hbrush); +} + +static void gdi_canvas_draw_copy(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy) +{ + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + GdiCanvas *gdi_surface; + pixman_image_t *surface; + struct BitmapData bitmapmask; + PixmanData *pixman_data; + + gdi_surface = (GdiCanvas *)canvas_get_surface(&canvas->base, copy->src_bitmap); + if (gdi_surface) { + RecurciveLock lock(*canvas->lock); + RecurciveLock s_lock(*gdi_surface->lock); + bitmapmask = get_mask_bitmap(canvas, ©->mask); + set_scale_mode(canvas, copy->scale_mode); + set_clip(canvas, clip); + gdi_draw_bitmap_redrop(canvas->dc, ©->src_area, bbox, gdi_surface->dc, + &bitmapmask, copy->rop_descriptor, 0); + } else { + surface = canvas_get_image(&canvas->base, copy->src_bitmap, FALSE); + pixman_data = (PixmanData *)pixman_image_get_destroy_data(surface); + + RecurciveLock lock(*canvas->lock); + bitmapmask = get_mask_bitmap(canvas, ©->mask); + set_scale_mode(canvas, copy->scale_mode); + set_clip(canvas, clip); + + if (pixman_data && (WaitForSingleObject(pixman_data->mutex, INFINITE) != WAIT_FAILED)) { + HDC dc; + HBITMAP prev_bitmap; + + dc = create_compatible_dc(); + prev_bitmap = (HBITMAP)SelectObject(dc, pixman_data->bitmap); + gdi_draw_bitmap_redrop(canvas->dc, ©->src_area, bbox, dc, + &bitmapmask, copy->rop_descriptor, 0); + SelectObject(dc, prev_bitmap); + DeleteObject(dc); + ReleaseMutex(pixman_data->mutex); + } else { + gdi_draw_image(canvas->dc, ©->src_area, bbox, surface, &bitmapmask, + copy->rop_descriptor, 0); + } + + pixman_image_unref(surface); + } + free_mask(&bitmapmask); +} + +static void gdi_canvas_put_image(SpiceCanvas *spice_canvas, HDC dc, const SpiceRect *dest, const uint8_t *src_data, + uint32_t src_width, uint32_t src_height, int src_stride, + const QRegion *clip) +{ + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + SpiceRect src; + src.top = 0; + src.bottom = src_height; + src.left = 0; + src.right = src_width; + int num_rects; + pixman_box32_t *rects; + + RecurciveLock lock(*canvas->lock); + set_scale_mode(canvas, SPICE_IMAGE_SCALE_MODE_NEAREST); + if (clip) { + rects = pixman_region32_rectangles((pixman_region32_t*)clip, &num_rects); + if (num_rects == 0) { + return; + } else { + HRGN main_hrgn; + int i; + + main_hrgn = CreateRectRgn(rects[0].x1, rects[0].y1, rects[0].x2, + rects[0].y2); + if (!main_hrgn) { + return; + } + + for (i = 1; i < num_rects; i++) { + HRGN combaine_hrgn; + + combaine_hrgn = CreateRectRgn(rects[i].x1, rects[i].y1, + rects[i].x2, + rects[i].y2); + if (!combaine_hrgn) { + spice_critical("CreateRectRgn failed"); + DeleteObject(main_hrgn); + return; + } + if (!CombineRgn(main_hrgn, main_hrgn, combaine_hrgn, RGN_OR)) { + spice_critical("CombineRgn failed in put_image"); + return; + } + DeleteObject(combaine_hrgn); + } + if (SelectClipRgn(canvas->dc, main_hrgn) == ERROR) { + spice_critical("SelectClipRgn failed in put_image"); + DeleteObject(main_hrgn); + return; + } + DeleteObject(main_hrgn); + } + } else { + SelectClipRgn(canvas->dc, NULL); + } + + if (dc) { + gdi_draw_bitmap_redrop(canvas->dc, &src, dest, dc, + NULL, SPICE_ROPD_OP_PUT, 0); + } else { + pixman_image_t *image = pixman_image_create_bits(PIXMAN_a8r8g8b8, src_width, src_height, + (uint32_t *)src_data, src_stride); + gdi_draw_image(canvas->dc, &src, dest, image, NULL, SPICE_ROPD_OP_PUT, 0); + pixman_image_unref(image); + } +} + +static void gdi_draw_bitmap_transparent(GdiCanvas *canvas, HDC dest_dc, const SpiceRect *src, + const SpiceRect *dest, HDC src_dc, uint32_t color) +{ + TransparentBlt(dest_dc, dest->left, dest->top, dest->right - dest->left, + dest->bottom - dest->top, src_dc, src->left, src->top, + src->right - src->left, src->bottom - src->top, + RGB(((uint8_t*)&color)[2], ((uint8_t*)&color)[1], ((uint8_t*)&color)[0])); +} + +static void gdi_draw_image_transparent(GdiCanvas *canvas, HDC dest_dc, const SpiceRect *src, + const SpiceRect *dest, pixman_image_t *image, + uint32_t color, int rotate) +{ + HDC dc; + HBITMAP bitmap; + HBITMAP prev_bitmap; + + create_bitmap_from_pixman(&bitmap, &prev_bitmap, &dc, image, rotate); + + gdi_draw_bitmap_transparent(canvas, dest_dc, src, dest, dc, color); + + release_bitmap(dc, bitmap, prev_bitmap, 0); +} + +static void gdi_canvas_draw_transparent(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, + SpiceTransparent* transparent) +{ + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + GdiCanvas *gdi_surface; + pixman_image_t *surface; + PixmanData *pixman_data; + + gdi_surface = (GdiCanvas *)canvas_get_surface(&canvas->base, transparent->src_bitmap); + if (gdi_surface) { + RecurciveLock lock(*canvas->lock); + RecurciveLock s_lock(*gdi_surface->lock); + set_clip(canvas, clip); + gdi_draw_bitmap_transparent(canvas, canvas->dc, &transparent->src_area, bbox, + gdi_surface->dc, transparent->true_color); + } else { + surface = canvas_get_image(&canvas->base, transparent->src_bitmap, FALSE); + pixman_data = (PixmanData *)pixman_image_get_destroy_data(surface); + RecurciveLock lock(*canvas->lock); + set_clip(canvas, clip); + if (pixman_data && (WaitForSingleObject(pixman_data->mutex, INFINITE) != WAIT_FAILED)) { + HDC dc; + HBITMAP prev_bitmap; + + dc = create_compatible_dc(); + prev_bitmap = (HBITMAP)SelectObject(dc, pixman_data->bitmap); + gdi_draw_bitmap_transparent(canvas, canvas->dc, &transparent->src_area, bbox, dc, + transparent->true_color); + + SelectObject(dc, prev_bitmap); + DeleteObject(dc); + ReleaseMutex(pixman_data->mutex); + } else { + gdi_draw_image_transparent(canvas, canvas->dc, &transparent->src_area, bbox, surface, + transparent->true_color, 0); + } + + pixman_image_unref(surface); + } +} + +static void gdi_draw_bitmap_alpha(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest, + HDC src_dc, uint8_t alpha, int use_bitmap_alpha) +{ + BLENDFUNCTION bf; + + bf.BlendOp = AC_SRC_OVER; + bf.BlendFlags = 0; + bf.SourceConstantAlpha = alpha; + + if (use_bitmap_alpha) { + bf.AlphaFormat = AC_SRC_ALPHA; + } else { + bf.AlphaFormat = 0; + } + + if (!AlphaBlend(dest_dc, dest->left, dest->top, dest->right - dest->left, + dest->bottom - dest->top, src_dc, src->left, src->top, + src->right - src->left, src->bottom - src->top, bf)) { + spice_critical("AlphaBlend failed"); + return; + } +} + +static void gdi_draw_image_alpha(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest, + pixman_image_t *image, uint8_t alpha, + int rotate, int use_bitmap_alpha) +{ + HDC dc; + HBITMAP bitmap; + HBITMAP prev_bitmap; + + create_bitmap_from_pixman(&bitmap, &prev_bitmap, &dc, image, rotate); + + gdi_draw_bitmap_alpha(dest_dc, src, dest, dc, alpha, use_bitmap_alpha); + + release_bitmap(dc, bitmap, prev_bitmap, 0); +} + +static void gdi_canvas_draw_alpha_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlend* alpha_blend) +{ + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + GdiCanvas *gdi_surface; + pixman_image_t *surface; + PixmanData *pixman_data; + int use_bitmap_alpha; + + gdi_surface = (GdiCanvas *)canvas_get_surface(&canvas->base, alpha_blend->src_bitmap); + if (gdi_surface) { + RecurciveLock lock(*canvas->lock); + RecurciveLock s_lock(*gdi_surface->lock); + set_clip(canvas, clip); + use_bitmap_alpha = alpha_blend->alpha_flags & SPICE_ALPHA_FLAGS_SRC_SURFACE_HAS_ALPHA; + gdi_draw_bitmap_alpha(canvas->dc, &alpha_blend->src_area, bbox, gdi_surface->dc, + alpha_blend->alpha, use_bitmap_alpha); + } else { + surface = canvas_get_image(&canvas->base, alpha_blend->src_bitmap, TRUE); + use_bitmap_alpha = pixman_image_get_depth(surface) == 32; + pixman_data = (PixmanData *)pixman_image_get_destroy_data(surface); + + RecurciveLock lock(*canvas->lock); + set_clip(canvas, clip); + if (pixman_data && (WaitForSingleObject(pixman_data->mutex, INFINITE) != WAIT_FAILED)) { + HDC dc; + HBITMAP prev_bitmap; + + dc = create_compatible_dc(); + prev_bitmap = (HBITMAP)SelectObject(dc, pixman_data->bitmap); + gdi_draw_bitmap_alpha(canvas->dc, &alpha_blend->src_area, bbox, dc, alpha_blend->alpha, + use_bitmap_alpha); + SelectObject(dc, prev_bitmap); + DeleteObject(dc); + ReleaseMutex(pixman_data->mutex); + } else { + gdi_draw_image_alpha(canvas->dc, &alpha_blend->src_area, bbox, surface, + alpha_blend->alpha, 0, use_bitmap_alpha); + } + + pixman_image_unref(surface); + } +} + +static void gdi_canvas_draw_opaque(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque) +{ + GdiCanvas *gdi_surface; + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + pixman_image_t *surface; + struct BitmapData bitmapmask; + PixmanData *pixman_data; + HBRUSH prev_hbrush; + HBRUSH hbrush; + uint8_t rop3; + RecurciveMutex *brush_lock; + + rop3 = calc_rop3_src_brush(opaque->rop_descriptor); + + gdi_surface = (GdiCanvas *)canvas_get_surface(&canvas->base, opaque->src_bitmap); + if (gdi_surface) { + RecurciveLock lock(*canvas->lock); + RecurciveLock s_lock(*gdi_surface->lock); + bitmapmask = get_mask_bitmap(canvas, &opaque->mask); + hbrush = get_brush(canvas, &opaque->brush, &brush_lock); + set_scale_mode(canvas, opaque->scale_mode); + set_clip(canvas, clip); + prev_hbrush = set_brush(canvas->dc, hbrush, &opaque->brush); + if (brush_lock) { + RecurciveLock b_lock(*brush_lock); + gdi_draw_bitmap(canvas->dc, &opaque->src_area, bbox, gdi_surface->dc, &bitmapmask, rop3); + } else { + gdi_draw_bitmap(canvas->dc, &opaque->src_area, bbox, gdi_surface->dc, &bitmapmask, rop3); + } + unset_brush(canvas->dc, prev_hbrush); + } else { + surface = canvas_get_image(&canvas->base, opaque->src_bitmap, FALSE); + pixman_data = (PixmanData *)pixman_image_get_destroy_data(surface); + + RecurciveLock lock(*canvas->lock); + bitmapmask = get_mask_bitmap(canvas, &opaque->mask); + hbrush = get_brush(canvas, &opaque->brush, &brush_lock); + set_scale_mode(canvas, opaque->scale_mode); + set_clip(canvas, clip); + prev_hbrush = set_brush(canvas->dc, hbrush, &opaque->brush); + + if (pixman_data && (WaitForSingleObject(pixman_data->mutex, INFINITE) != WAIT_FAILED)) { + HDC dc; + HBITMAP prev_bitmap; + + dc = create_compatible_dc(); + prev_bitmap = (HBITMAP)SelectObject(dc, pixman_data->bitmap); + if (brush_lock) { + RecurciveLock b_lock(*brush_lock); + gdi_draw_bitmap(canvas->dc, &opaque->src_area, bbox, dc, &bitmapmask, rop3); + } else { + gdi_draw_bitmap(canvas->dc, &opaque->src_area, bbox, dc, &bitmapmask, rop3); + } + SelectObject(dc, prev_bitmap); + DeleteObject(dc); + ReleaseMutex(pixman_data->mutex); + } else { + if (brush_lock) { + RecurciveLock b_lock(*brush_lock); + gdi_draw_image_rop3(canvas->dc, &opaque->src_area, bbox, surface, &bitmapmask, rop3, 0); + } else { + gdi_draw_image_rop3(canvas->dc, &opaque->src_area, bbox, surface, &bitmapmask, rop3, 0); + } + } + unset_brush(canvas->dc, prev_hbrush); + pixman_image_unref(surface); + } + + free_mask(&bitmapmask); +} + +static void gdi_canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend) +{ + GdiCanvas *gdi_surface; + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + pixman_image_t *surface; + struct BitmapData bitmapmask; + PixmanData *pixman_data; + + gdi_surface = (GdiCanvas *)canvas_get_surface(&canvas->base, blend->src_bitmap); + if (gdi_surface) { + RecurciveLock lock(*canvas->lock); + RecurciveLock s_lock(*gdi_surface->lock); + bitmapmask = get_mask_bitmap(canvas, &blend->mask); + set_scale_mode(canvas, blend->scale_mode); + set_clip(canvas, clip); + gdi_draw_bitmap_redrop(canvas->dc, &blend->src_area, bbox, gdi_surface->dc, + &bitmapmask, blend->rop_descriptor, 0); + } else { + surface = canvas_get_image(&canvas->base, blend->src_bitmap, FALSE); + pixman_data = (PixmanData *)pixman_image_get_destroy_data(surface); + + RecurciveLock lock(*canvas->lock); + bitmapmask = get_mask_bitmap(canvas, &blend->mask); + set_scale_mode(canvas, blend->scale_mode); + set_clip(canvas, clip); + + if (pixman_data && (WaitForSingleObject(pixman_data->mutex, INFINITE) != WAIT_FAILED)) { + HDC dc; + HBITMAP prev_bitmap; + + dc = create_compatible_dc(); + prev_bitmap = (HBITMAP)SelectObject(dc, pixman_data->bitmap); + gdi_draw_bitmap_redrop(canvas->dc, &blend->src_area, bbox, dc, + &bitmapmask, blend->rop_descriptor, 0); + SelectObject(dc, prev_bitmap); + DeleteObject(dc); + ReleaseMutex(pixman_data->mutex); + } else { + gdi_draw_image(canvas->dc, &blend->src_area, bbox, surface, + &bitmapmask, blend->rop_descriptor, 0); + } + + pixman_image_unref(surface); + } + + free_mask(&bitmapmask); +} + +static void gdi_canvas_draw_blackness(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness) +{ + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + struct BitmapData bitmapmask; + + RecurciveLock lock(*canvas->lock); + bitmapmask = get_mask_bitmap(canvas, &blackness->mask); + set_clip(canvas, clip); + gdi_draw_bitmap(canvas->dc, bbox, bbox, canvas->dc, &bitmapmask, 0x0); + + free_mask(&bitmapmask); +} + +static void gdi_canvas_draw_invers(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers) +{ + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + struct BitmapData bitmapmask; + + RecurciveLock lock(*canvas->lock); + bitmapmask = get_mask_bitmap(canvas, &invers->mask); + set_clip(canvas, clip); + gdi_draw_bitmap(canvas->dc, bbox, bbox, canvas->dc, &bitmapmask, 0x55); + + free_mask(&bitmapmask); +} + +static void gdi_canvas_draw_whiteness(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness) +{ + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + struct BitmapData bitmapmask; + + RecurciveLock lock(*canvas->lock); + bitmapmask = get_mask_bitmap(canvas, &whiteness->mask); + set_clip(canvas, clip); + gdi_draw_bitmap(canvas->dc, bbox, bbox, canvas->dc, &bitmapmask, 0xff); + + free_mask(&bitmapmask); +} + +static void gdi_canvas_draw_rop3(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3) +{ + GdiCanvas *gdi_surface; + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + pixman_image_t *surface; + struct BitmapData bitmapmask; + HBRUSH prev_hbrush; + HBRUSH hbrush; + PixmanData *pixman_data; + RecurciveMutex *brush_lock; + + gdi_surface = (GdiCanvas *)canvas_get_surface(&canvas->base, rop3->src_bitmap); + if (gdi_surface) { + RecurciveLock lock(*canvas->lock); + RecurciveLock s_lock(*gdi_surface->lock); + hbrush = get_brush(canvas, &rop3->brush, &brush_lock); + bitmapmask = get_mask_bitmap(canvas, &rop3->mask); + set_scale_mode(canvas, rop3->scale_mode); + set_clip(canvas, clip); + prev_hbrush = set_brush(canvas->dc, hbrush, &rop3->brush); + if (brush_lock) { + RecurciveLock b_lock(*brush_lock); + gdi_draw_bitmap(canvas->dc, &rop3->src_area, bbox, gdi_surface->dc, + &bitmapmask, rop3->rop3); + } else { + gdi_draw_bitmap(canvas->dc, &rop3->src_area, bbox, gdi_surface->dc, + &bitmapmask, rop3->rop3); + } + unset_brush(canvas->dc, prev_hbrush); + } else { + surface = canvas_get_image(&canvas->base, rop3->src_bitmap, FALSE); + pixman_data = (PixmanData *)pixman_image_get_destroy_data(surface); + RecurciveLock lock(*canvas->lock); + hbrush = get_brush(canvas, &rop3->brush, &brush_lock); + bitmapmask = get_mask_bitmap(canvas, &rop3->mask); + set_scale_mode(canvas, rop3->scale_mode); + set_clip(canvas, clip); + prev_hbrush = set_brush(canvas->dc, hbrush, &rop3->brush); + + if (pixman_data && (WaitForSingleObject(pixman_data->mutex, INFINITE) != WAIT_FAILED)) { + HDC dc; + HBITMAP prev_bitmap; + + dc = create_compatible_dc(); + prev_bitmap = (HBITMAP)SelectObject(dc, pixman_data->bitmap); + if (brush_lock) { + RecurciveLock b_lock(*brush_lock); + gdi_draw_bitmap(canvas->dc, &rop3->src_area, bbox, dc, + &bitmapmask, rop3->rop3); + } else { + gdi_draw_bitmap(canvas->dc, &rop3->src_area, bbox, dc, + &bitmapmask, rop3->rop3); + } + SelectObject(dc, prev_bitmap); + DeleteObject(dc); + ReleaseMutex(pixman_data->mutex); + } else { + if (brush_lock) { + RecurciveLock b_lock(*brush_lock); + gdi_draw_image_rop3(canvas->dc, &rop3->src_area, bbox, surface, &bitmapmask, rop3->rop3, 0); + } else { + gdi_draw_image_rop3(canvas->dc, &rop3->src_area, bbox, surface, &bitmapmask, rop3->rop3, 0); + } + } + + unset_brush(canvas->dc, prev_hbrush); + pixman_image_unref(surface); + } + + free_mask(&bitmapmask); +} + +static void gdi_canvas_copy_bits(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos) +{ + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + RecurciveLock lock(*canvas->lock); + + set_clip(canvas, clip); + + BitBlt(canvas->dc, bbox->left, bbox->top, bbox->right - bbox->left, + bbox->bottom - bbox->top, canvas->dc, src_pos->x, src_pos->y, SRCCOPY); +} + +static void gdi_canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text) +{ + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + SpiceString *str; + RecurciveMutex *brush_lock; + + RecurciveLock lock(*canvas->lock); + set_clip(canvas, clip); + lock.unlock(); + + if (!rect_is_empty(&text->back_area)) { + HBRUSH prev_hbrush; + HBRUSH hbrush; + + RecurciveLock lock(*canvas->lock); + hbrush = get_brush(canvas, &text->back_brush, &brush_lock); + prev_hbrush = set_brush(canvas->dc, hbrush, &text->back_brush); + if (brush_lock) { + RecurciveLock b_lock(*brush_lock); + gdi_draw_bitmap_redrop(canvas->dc, bbox, bbox, canvas->dc, NULL, + text->back_mode, 1); + } else { + gdi_draw_bitmap_redrop(canvas->dc, bbox, bbox, canvas->dc, NULL, + text->back_mode, 1); + } + unset_brush(canvas->dc, prev_hbrush); + } + + str = (SpiceString *)SPICE_GET_ADDRESS(text->str); + + if (str->flags & SPICE_STRING_FLAGS_RASTER_A1) { + SpiceRect dest; + SpiceRect src; + + draw_str_mask_bitmap(canvas, str, 1, &dest, &src, &text->fore_brush); + } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A4) { + SpiceRect dest; + SpiceRect src; + + draw_str_mask_bitmap(canvas, str, 4, &dest, &src, &text->fore_brush); + } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A8) { + spice_warning("untested path A8 glyphs, doing nothing"); + if (0) { + SpiceRect dest; + SpiceRect src; + + draw_str_mask_bitmap(canvas, str, 8, &dest, &src, &text->fore_brush); + } + } else { + spice_warning("untested path vector glyphs, doing nothing"); + if (0) { + } + } +} + +static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, uint8_t nseg, SPICE_FIXED28_4* style, int start_is_gap) +{ + uint32_t *local_style; + int i; + + spice_return_val_if_fail(nseg != 0, NULL); + + local_style = spice_new(uint32_t , nseg); + + if (start_is_gap) { + local_style[nseg - 1] = (uint32_t)fix_to_double(*style); + style++; + + for (i = 0; i < nseg - 1; i++, style++) { + local_style[i] = (uint32_t)fix_to_double(*style); + } + } else { + for (i = 0; i < nseg; i++, style++) { + local_style[i] = (uint32_t)fix_to_double(*style); + } + } + + return local_style; +} + +static void gdi_canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke) +{ + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + HPEN hpen; + HPEN prev_hpen; + LOGBRUSH logbrush; + uint32_t *user_style = NULL; + pixman_image_t *surface = NULL; + + if (stroke->brush.type == SPICE_BRUSH_TYPE_PATTERN) { + surface = canvas_get_image(&canvas->base, stroke->brush.u.pattern.pat, FALSE); + } + + RecurciveLock lock(*canvas->lock); + set_clip(canvas, clip); + + switch (stroke->fore_mode) { + case SPICE_ROPD_OP_WHITENESS: + SetROP2(canvas->dc, R2_WHITE); //0 + break; + case SPICE_ROPD_OP_BLACKNESS: + SetROP2(canvas->dc, R2_BLACK); //1 + break; + case SPICE_ROPD_OP_INVERS: + SetROP2(canvas->dc, R2_NOT); //Dn + break; + case SPICE_ROPD_OP_PUT: + SetROP2(canvas->dc, R2_COPYPEN); //P + break; + case SPICE_ROPD_OP_OR: + SetROP2(canvas->dc, R2_MERGEPEN); //DPo + break; + case SPICE_ROPD_OP_XOR: + SetROP2(canvas->dc, R2_XORPEN); //DPx + break; + case SPICE_ROPD_OP_AND: + SetROP2(canvas->dc, R2_MASKPEN); //DPa + break; + case SPICE_ROPD_INVERS_BRUSH | SPICE_ROPD_OP_PUT: //Pn + SetROP2(canvas->dc, R2_NOTCOPYPEN); + break; + case SPICE_ROPD_OP_XOR | SPICE_ROPD_INVERS_RES: + SetROP2(canvas->dc, R2_NOTXORPEN); //DPxn + break; + case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_RES: + SetROP2(canvas->dc, R2_NOTMERGEPEN); //DPon + break; + case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_RES: + SetROP2(canvas->dc, R2_NOTMASKPEN); //DPan + break; + case SPICE_ROPD_INVERS_DEST | SPICE_ROPD_OP_AND: + SetROP2(canvas->dc, R2_MASKPENNOT); //PDna + break; + case SPICE_ROPD_INVERS_BRUSH | SPICE_ROPD_OP_AND: + SetROP2(canvas->dc, R2_MASKNOTPEN); //DPna + break; + case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_BRUSH: + SetROP2(canvas->dc, R2_MERGENOTPEN); //DPno + break; + case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_DEST: + SetROP2(canvas->dc, R2_MERGEPENNOT); //PDno + break; + default: + SetROP2(canvas->dc, R2_NOP); //D + } + + + if (stroke->brush.type == SPICE_BRUSH_TYPE_SOLID) { + logbrush.lbStyle = BS_SOLID | DIB_RGB_COLORS; + logbrush.lbHatch = 0; + logbrush.lbColor = get_color_ref(canvas, stroke->brush.u.color); + } else if (stroke->brush.type == SPICE_BRUSH_TYPE_PATTERN) { +#if 0 + struct { + BITMAPINFO inf; + RGBQUAD palette[255]; + } bitmap_info; + GdiImage image; +#endif +#if 0 + spice_return_if_fail(surface != NULL) + surface_to_image(surface, &image); + + memset(&bitmap_info, 0, sizeof(bitmap_info)); + bitmap_info.inf.bmiHeader.biSize = sizeof(bitmap_info.inf.bmiHeader); + bitmap_info.inf.bmiHeader.biWidth = image.width; + if (image.stride < 0) { + bitmap_info.inf.bmiHeader.biHeight = image.height; + } else { + bitmap_info.inf.bmiHeader.biHeight = -image.height; + } + bitmap_info.inf.bmiHeader.biPlanes = 1; + bitmap_info.inf.bmiHeader.biBitCount = 32; + bitmap_info.inf.bmiHeader.biCompression = BI_RGB; + + if (image.stride < 0) { + logbrush.lbHatch = (LONG)GlobalAlloc(GMEM_MOVEABLE, + image.height * -image.stride + sizeof(BITMAPINFO)); + if (!logbrush.lbHatch) { + spice_critical("GlobalAlloc failed"); + return; + } + copy_bitmap(image.pixels - (image.height - 1) * -image.stride, + image.height, -image.stride, + (uint8_t *)logbrush.lbHatch, image.width); + } else { + logbrush.lbHatch = (LONG)GlobalAlloc(GMEM_MOVEABLE, + image.height * image.stride + sizeof(BITMAPINFO)); + if (!logbrush.lbHatch) { + spice_critical("GlobalAlloc failed"); + return; + } + copy_bitmap(image.pixels, image.height, image.stride, + (uint8_t *)logbrush.lbHatch, image.width); + } + + memcpy((void *)logbrush.lbHatch, &bitmap_info.inf, sizeof(BITMAPINFO)); + + logbrush.lbStyle = BS_DIBPATTERN | DIB_RGB_COLORS; + logbrush.lbColor = 0; +#endif + pixman_image_unref(surface); + } + + if (stroke->attr.flags & SPICE_LINE_FLAGS_STYLED) { + user_style = gdi_get_userstyle(canvas, stroke->attr.style_nseg, + stroke->attr.style, + !!(stroke->attr.flags & SPICE_LINE_FLAGS_START_WITH_GAP)); + hpen = ExtCreatePen(PS_COSMETIC | PS_USERSTYLE, + 1, + &logbrush, stroke->attr.style_nseg, (DWORD *)user_style); + } else { + hpen = ExtCreatePen(PS_COSMETIC, + 1, + &logbrush, 0, NULL); + } + prev_hpen = (HPEN)SelectObject(canvas->dc, hpen); + + set_path(canvas, stroke->path); + + StrokePath(canvas->dc); + + SelectObject(canvas->dc, prev_hpen); + DeleteObject(hpen); + +#if 0 + if (stroke->brush.type == SPICE_BRUSH_TYPE_PATTERN) { + GlobalFree((HGLOBAL)logbrush.lbHatch); + } +#endif + + free(user_style); +} + +static void gdi_canvas_clear(SpiceCanvas *spice_canvas) +{ +} + +static void gdi_canvas_destroy(SpiceCanvas *spice_canvas) +{ + GdiCanvas *canvas = (GdiCanvas *)spice_canvas; + if (!canvas) { + return; + } + canvas_base_destroy(&canvas->base); + free(canvas); +} + +static int need_init = 1; +static SpiceCanvasOps gdi_canvas_ops; + +SpiceCanvas *gdi_canvas_create(int width, int height, + HDC dc, RecurciveMutex* lock, uint32_t format +#ifdef SW_CANVAS_CACHE + , SpiceImageCache *bits_cache + , SpicePaletteCache *palette_cache +#elif defined(SW_CANVAS_IMAGE_CACHE) + , SpiceImageCache *bits_cache +#endif + , SpiceImageSurfaces *surfaces + , SpiceGlzDecoder *glz_decoder + , SpiceJpegDecoder *jpeg_decoder + , SpiceZlibDecoder *zlib_decoder + ) +{ + GdiCanvas *canvas; + + if (need_init) { + return NULL; + } + canvas = spice_new0(GdiCanvas, 1); + canvas_base_init(&canvas->base, &gdi_canvas_ops, + width, height, format, +#ifdef SW_CANVAS_CACHE + bits_cache, + palette_cache, +#elif defined(SW_CANVAS_IMAGE_CACHE) + bits_cache, +#endif + surfaces, + glz_decoder, + jpeg_decoder, + zlib_decoder); + canvas->dc = dc; + canvas->lock = lock; + return (SpiceCanvas *)canvas; +} + +void gdi_canvas_init(void) //unsafe global function +{ + if (!need_init) { + return; + } + need_init = 0; + + canvas_base_init_ops(&gdi_canvas_ops); + gdi_canvas_ops.draw_fill = gdi_canvas_draw_fill; + gdi_canvas_ops.draw_copy = gdi_canvas_draw_copy; + gdi_canvas_ops.draw_opaque = gdi_canvas_draw_opaque; + gdi_canvas_ops.copy_bits = gdi_canvas_copy_bits; + gdi_canvas_ops.draw_text = gdi_canvas_draw_text; + gdi_canvas_ops.draw_stroke = gdi_canvas_draw_stroke; + gdi_canvas_ops.draw_rop3 = gdi_canvas_draw_rop3; + gdi_canvas_ops.draw_blend = gdi_canvas_draw_blend; + gdi_canvas_ops.draw_blackness = gdi_canvas_draw_blackness; + gdi_canvas_ops.draw_whiteness = gdi_canvas_draw_whiteness; + gdi_canvas_ops.draw_invers = gdi_canvas_draw_invers; + gdi_canvas_ops.draw_transparent = gdi_canvas_draw_transparent; + gdi_canvas_ops.draw_alpha_blend = gdi_canvas_draw_alpha_blend; + gdi_canvas_ops.put_image = gdi_canvas_put_image; + gdi_canvas_ops.clear = gdi_canvas_clear; + gdi_canvas_ops.destroy = gdi_canvas_destroy; + + rop3_init(); +} diff -Nru spice-gtk-0.9/spice-common/common/gdi_canvas.h spice-gtk-0.12/spice-common/common/gdi_canvas.h --- spice-gtk-0.9/spice-common/common/gdi_canvas.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/gdi_canvas.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,44 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H__GDI_CANVAS +#define _H__GDI_CANVAS + +#include +#include + +#include "pixman_utils.h" +#include "canvas_base.h" +#include "region.h" + +SPICE_BEGIN_DECLS + +SpiceCanvas *gdi_canvas_create(int width, int height, + HDC dc, class RecurciveMutex *lock, uint32_t format, + SpiceImageCache *bits_cache, + SpicePaletteCache *palette_cache, + SpiceImageSurfaces *surfaces, + SpiceGlzDecoder *glz_decoder, + SpiceJpegDecoder *jpeg_decoder, + SpiceZlibDecoder *zlib_decoder); + +void gdi_canvas_init(void); + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/generated_client_demarshallers1.c spice-gtk-0.12/spice-common/common/generated_client_demarshallers1.c --- spice-gtk-0.9/spice-common/common/generated_client_demarshallers1.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/generated_client_demarshallers1.c 2012-04-24 11:24:34.000000000 +0000 @@ -0,0 +1,5847 @@ +/* this is a file autogenerated by spice_codegen.py */ +#ifdef HAVE_CONFIG_H +#include +#endif +#include "messages.h" +#include +#include +#include +#include +#include +#include +#include "mem.h" + +#ifdef _MSC_VER +#pragma warning(disable:4101) +#endif + + + +#ifdef WORDS_BIGENDIAN +#define read_int8(ptr) (*((int8_t *)(ptr))) +#define write_int8(ptr, val) *(int8_t *)(ptr) = val +#define read_uint8(ptr) (*((uint8_t *)(ptr))) +#define write_uint8(ptr, val) *(uint8_t *)(ptr) = val +#define read_int16(ptr) ((int16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr))) +#define write_int16(ptr, val) *(uint16_t *)(ptr) = SPICE_BYTESWAP16((uint16_t)val) +#define read_uint16(ptr) ((uint16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr))) +#define write_uint16(ptr, val) *(uint16_t *)(ptr) = SPICE_BYTESWAP16((uint16_t)val) +#define read_int32(ptr) ((int32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr))) +#define write_int32(ptr, val) *(uint32_t *)(ptr) = SPICE_BYTESWAP32((uint32_t)val) +#define read_uint32(ptr) ((uint32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr))) +#define write_uint32(ptr, val) *(uint32_t *)(ptr) = SPICE_BYTESWAP32((uint32_t)val) +#define read_int64(ptr) ((int64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))) +#define write_int64(ptr, val) *(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val) +#define read_uint64(ptr) ((uint64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))) +#define write_uint64(ptr, val) *(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val) +#else +#define read_int8(ptr) (*((int8_t *)(ptr))) +#define write_int8(ptr, val) (*((int8_t *)(ptr))) = val +#define read_uint8(ptr) (*((uint8_t *)(ptr))) +#define write_uint8(ptr, val) (*((uint8_t *)(ptr))) = val +#define read_int16(ptr) (*((int16_t *)(ptr))) +#define write_int16(ptr, val) (*((int16_t *)(ptr))) = val +#define read_uint16(ptr) (*((uint16_t *)(ptr))) +#define write_uint16(ptr, val) (*((uint16_t *)(ptr))) = val +#define read_int32(ptr) (*((int32_t *)(ptr))) +#define write_int32(ptr, val) (*((int32_t *)(ptr))) = val +#define read_uint32(ptr) (*((uint32_t *)(ptr))) +#define write_uint32(ptr, val) (*((uint32_t *)(ptr))) = val +#define read_int64(ptr) (*((int64_t *)(ptr))) +#define write_int64(ptr, val) (*((int64_t *)(ptr))) = val +#define read_uint64(ptr) (*((uint64_t *)(ptr))) +#define write_uint64(ptr, val) (*((uint64_t *)(ptr))) = val +#endif + +static int8_t SPICE_GNUC_UNUSED consume_int8(uint8_t **ptr) +{ + int8_t val; + val = read_int8(*ptr); + *ptr += 1; + return val; +} + +static uint8_t SPICE_GNUC_UNUSED consume_uint8(uint8_t **ptr) +{ + uint8_t val; + val = read_uint8(*ptr); + *ptr += 1; + return val; +} + +static int16_t SPICE_GNUC_UNUSED consume_int16(uint8_t **ptr) +{ + int16_t val; + val = read_int16(*ptr); + *ptr += 2; + return val; +} + +static uint16_t SPICE_GNUC_UNUSED consume_uint16(uint8_t **ptr) +{ + uint16_t val; + val = read_uint16(*ptr); + *ptr += 2; + return val; +} + +static int32_t SPICE_GNUC_UNUSED consume_int32(uint8_t **ptr) +{ + int32_t val; + val = read_int32(*ptr); + *ptr += 4; + return val; +} + +static uint32_t SPICE_GNUC_UNUSED consume_uint32(uint8_t **ptr) +{ + uint32_t val; + val = read_uint32(*ptr); + *ptr += 4; + return val; +} + +static int64_t SPICE_GNUC_UNUSED consume_int64(uint8_t **ptr) +{ + int64_t val; + val = read_int64(*ptr); + *ptr += 8; + return val; +} + +static uint64_t SPICE_GNUC_UNUSED consume_uint64(uint8_t **ptr) +{ + uint64_t val; + val = read_uint64(*ptr); + *ptr += 8; + return val; +} + +typedef struct PointerInfo PointerInfo; +typedef void (*message_destructor_t)(uint8_t *message); +typedef uint8_t * (*parse_func_t)(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *ptr_info, int minor); +typedef uint8_t * (*parse_msg_func_t)(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size_out, message_destructor_t *free_message); +typedef uint8_t * (*spice_parse_channel_func_t)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message); + +struct PointerInfo { + uint64_t offset; + parse_func_t parse; + void * *dest; + uint32_t nelements; +}; + +static uint8_t * parse_msg_migrate(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgMigrate *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgMigrate); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMigrate); + in = start; + + out = (SpiceMsgMigrate *)data; + + out->flags = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static void nofree(uint8_t *data) +{ +} + +static uint8_t * parse_SpiceMsgData(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t data__nw_size; + uint32_t data__nelements; + + { /* data */ + data__nelements = message_end - (start + 0); + + data__nw_size = data__nelements; + } + + nw_size = 0 + data__nw_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = message_start; + *size = message_end - message_start; + *free_message = nofree; + return data; + +} + +static uint8_t * parse_msg_set_ack(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgSetAck *out; + + nw_size = 8; + mem_size = sizeof(SpiceMsgSetAck); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgSetAck); + in = start; + + out = (SpiceMsgSetAck *)data; + + out->generation = consume_uint32(&in); + out->window = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_ping(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t data__nw_size; + uint32_t data__nelements; + SpiceMsgPing *out; + + { /* data */ + data__nelements = message_end - (start + 12); + + data__nw_size = data__nelements; + } + + nw_size = 12 + data__nw_size; + mem_size = sizeof(SpiceMsgPing); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgPing); + in = start; + + out = (SpiceMsgPing *)data; + + out->id = consume_uint32(&in); + out->timestamp = consume_uint64(&in); + /* use array as pointer */ + out->data = (uint8_t *)in; + out->data_len = data__nelements; + in += data__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_wait_for_channels(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t wait_list__nw_size, wait_list__mem_size; + uint32_t wait_list__nelements; + SpiceMsgWaitForChannels *out; + uint32_t i; + + { /* wait_list */ + uint8_t wait_count__value; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + wait_count__value = read_uint8(pos); + wait_list__nelements = wait_count__value; + + wait_list__nw_size = (10) * wait_list__nelements; + wait_list__mem_size = sizeof(SpiceWaitForChannel) * wait_list__nelements; + } + + nw_size = 1 + wait_list__nw_size; + mem_size = sizeof(SpiceMsgWaitForChannels) + wait_list__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgWaitForChannels); + in = start; + + out = (SpiceMsgWaitForChannels *)data; + + out->wait_count = consume_uint8(&in); + for (i = 0; i < wait_list__nelements; i++) { + SpiceWaitForChannel *out2; + out2 = (SpiceWaitForChannel *)end; + end += sizeof(SpiceWaitForChannel); + + out2->channel_type = consume_uint8(&in); + out2->channel_id = consume_uint8(&in); + out2->message_serial = consume_uint64(&in); + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_disconnecting(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgDisconnect *out; + + nw_size = 12; + mem_size = sizeof(SpiceMsgDisconnect); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisconnect); + in = start; + + out = (SpiceMsgDisconnect *)data; + + out->time_stamp = consume_uint64(&in); + out->reason = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_notify(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t message__nw_size, message__mem_size; + uint32_t message__nelements; + size_t zero__mem_size; + SpiceMsgNotify *out; + + { /* message */ + uint32_t message_len__value; + pos = start + 20; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + message_len__value = read_uint32(pos); + message__nelements = message_len__value; + + message__nw_size = message__nelements; + message__mem_size = sizeof(uint8_t) * message__nelements; + } + + { /* zero */ + zero__mem_size = sizeof(uint8_t); + } + + nw_size = 25 + message__nw_size; + mem_size = sizeof(SpiceMsgNotify) + message__mem_size + zero__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgNotify); + in = start; + + out = (SpiceMsgNotify *)data; + + out->time_stamp = consume_uint64(&in); + out->severity = consume_uint32(&in); + out->visibilty = consume_uint32(&in); + out->what = consume_uint32(&in); + out->message_len = consume_uint32(&in); + memcpy(out->message, in, message__nelements); + in += message__nelements; + end += message__nelements; + *(uint8_t *)end = consume_uint8(&in); + end += sizeof(uint8_t); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_migrate_begin(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t host_data__nw_size; + uint32_t host_data__nelements; + size_t pub_key_data__nw_size; + uint32_t pub_key_data__nelements; + SpiceMsgMainMigrationBegin *out; + + { /* host_data */ + uint32_t host_size__value; + pos = start + 8; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + host_size__value = read_uint32(pos); + host_data__nelements = host_size__value; + + host_data__nw_size = host_data__nelements; + } + + if (minor >= 1) { /* pub_key_data */ + uint32_t pub_key_size__value; + pos = start + 12 + ((minor >= 1)?6:0); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + pub_key_size__value = read_uint32(pos); + pub_key_data__nelements = pub_key_size__value; + + pub_key_data__nw_size = pub_key_data__nelements; + } else { /* minor < 1 */ + pub_key_data__nelements = 0; + pub_key_data__nw_size = 0; + } + + nw_size = 12 + ((minor >= 1)?10:0) + host_data__nw_size + pub_key_data__nw_size; + mem_size = sizeof(SpiceMsgMainMigrationBegin); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainMigrationBegin); + in = start; + + out = (SpiceMsgMainMigrationBegin *)data; + + out->port = consume_uint16(&in); + out->sport = consume_uint16(&in); + consume_uint32(&in); + out->host_size = consume_uint32(&in); + if (minor >= 1) { + out->pub_key_type = consume_uint16(&in); + } else { + out->pub_key_type = 0; + } + if (minor >= 1) { + consume_uint32(&in); + } else { + } + if (minor >= 1) { + out->pub_key_size = consume_uint32(&in); + } else { + out->pub_key_size = 0; + } + /* use array as pointer */ + out->host_data = (uint8_t *)in; + in += host_data__nelements; + if (minor >= 1) { + /* use array as pointer */ + out->pub_key_data = (uint8_t *)in; + in += pub_key_data__nelements; + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_SpiceMsgEmpty(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + + nw_size = 0; + mem_size = sizeof(SpiceMsgEmpty); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgEmpty); + in = start; + + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgMainInit *out; + + nw_size = 32; + mem_size = sizeof(SpiceMsgMainInit); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainInit); + in = start; + + out = (SpiceMsgMainInit *)data; + + out->session_id = consume_uint32(&in); + out->display_channels_hint = consume_uint32(&in); + out->supported_mouse_modes = consume_uint32(&in); + out->current_mouse_mode = consume_uint32(&in); + out->agent_connected = consume_uint32(&in); + out->agent_tokens = consume_uint32(&in); + out->multi_media_time = consume_uint32(&in); + out->ram_hint = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_channels_list(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t channels__nw_size, channels__mem_size; + uint32_t channels__nelements; + SpiceMsgChannels *out; + uint32_t i; + + { /* channels */ + uint32_t num_of_channels__value; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_of_channels__value = read_uint32(pos); + channels__nelements = num_of_channels__value; + + channels__nw_size = (2) * channels__nelements; + channels__mem_size = sizeof(SpiceChannelId) * channels__nelements; + } + + nw_size = 4 + channels__nw_size; + mem_size = sizeof(SpiceMsgChannels) + channels__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgChannels); + in = start; + + out = (SpiceMsgChannels *)data; + + out->num_of_channels = consume_uint32(&in); + for (i = 0; i < channels__nelements; i++) { + SpiceChannelId *out2; + out2 = (SpiceChannelId *)end; + end += sizeof(SpiceChannelId); + + out2->type = consume_uint8(&in); + out2->id = consume_uint8(&in); + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_mouse_mode(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgMainMouseMode *out; + + nw_size = 8; + mem_size = sizeof(SpiceMsgMainMouseMode); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainMouseMode); + in = start; + + out = (SpiceMsgMainMouseMode *)data; + + out->supported_modes = consume_uint32(&in); + out->current_mode = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_multi_media_time(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgMainMultiMediaTime *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgMainMultiMediaTime); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainMultiMediaTime); + in = start; + + out = (SpiceMsgMainMultiMediaTime *)data; + + out->time = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_agent_disconnected(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgMainAgentDisconnect *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgMainAgentDisconnect); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainAgentDisconnect); + in = start; + + out = (SpiceMsgMainAgentDisconnect *)data; + + out->error_code = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_agent_token(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgMainAgentTokens *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgMainAgentTokens); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainAgentTokens); + in = start; + + out = (SpiceMsgMainAgentTokens *)data; + + out->num_tokens = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_migrate_switch_host(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t host_data__nw_size; + uint32_t host_data__nelements; + size_t cert_subject_data__nw_size; + uint32_t cert_subject_data__nelements; + SpiceMsgMainMigrationSwitchHost *out; + + { /* host_data */ + uint32_t host_size__value; + pos = start + 8; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + host_size__value = read_uint32(pos); + host_data__nelements = host_size__value; + + host_data__nw_size = host_data__nelements; + } + + { /* cert_subject_data */ + uint32_t cert_subject_size__value; + pos = start + 16; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + cert_subject_size__value = read_uint32(pos); + cert_subject_data__nelements = cert_subject_size__value; + + cert_subject_data__nw_size = cert_subject_data__nelements; + } + + nw_size = 20 + host_data__nw_size + cert_subject_data__nw_size; + mem_size = sizeof(SpiceMsgMainMigrationSwitchHost); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainMigrationSwitchHost); + in = start; + + out = (SpiceMsgMainMigrationSwitchHost *)data; + + out->port = consume_uint16(&in); + out->sport = consume_uint16(&in); + consume_uint32(&in); + out->host_size = consume_uint32(&in); + consume_uint32(&in); + out->cert_subject_size = consume_uint32(&in); + /* use array as pointer */ + out->host_data = (uint8_t *)in; + in += host_data__nelements; + /* use array as pointer */ + out->cert_subject_data = (uint8_t *)in; + in += cert_subject_data__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_MainChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[7] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify + }; + static parse_msg_func_t funcs2[11] = { + parse_msg_main_migrate_begin, + parse_SpiceMsgEmpty, + parse_msg_main_init, + parse_msg_main_channels_list, + parse_msg_main_mouse_mode, + parse_msg_main_multi_media_time, + parse_SpiceMsgEmpty, + parse_msg_main_agent_disconnected, + parse_SpiceMsgData, + parse_msg_main_agent_token, + parse_msg_main_migrate_switch_host + }; + if (message_type >= 1 && message_type < 8) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 112) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msg_display_mode(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgDisplayMode *out; + + nw_size = 12; + mem_size = sizeof(SpiceMsgDisplayMode); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayMode); + in = start; + + out = (SpiceMsgDisplayMode *)data; + + out->x_res = consume_uint32(&in); + out->y_res = consume_uint32(&in); + out->bits = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static intptr_t validate_SpiceClipRects(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) +{ + uint8_t *start = message_start + offset; + SPICE_GNUC_UNUSED uint8_t *pos; + size_t mem_size, nw_size; + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + + if (offset == 0) { + return 0; + } + + if (SPICE_UNLIKELY(start >= message_end)) { + goto error; + } + + { /* rects */ + uint32_t num_rects__value; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + nw_size = 4 + rects__nw_size; + mem_size = sizeof(SpiceClipRects) + rects__mem_size; + + /* Check if struct fits in reported side */ + if (SPICE_UNLIKELY(start + nw_size > message_end)) { + goto error; + } + return mem_size; + + error: + return -1; +} + +static uint8_t * parse_struct_SpiceClipRects(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) +{ + uint8_t *in = message_start + this_ptr_info->offset; + uint8_t *end; + SpiceClipRects *out; + uint32_t rects__nelements; + uint32_t i; + + end = struct_data + sizeof(SpiceClipRects); + out = (SpiceClipRects *)struct_data; + + out->num_rects = consume_uint32(&in); + rects__nelements = out->num_rects; + for (i = 0; i < rects__nelements; i++) { + SpiceRect *out2; + out2 = (SpiceRect *)end; + end += sizeof(SpiceRect); + + out2->top = consume_int32(&in); + out2->left = consume_int32(&in); + out2->bottom = consume_int32(&in); + out2->right = consume_int32(&in); + } + return end; +} + +static uint8_t * parse_msg_display_copy_bits(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[1]; + size_t base__extra_size; + SpiceMsgDisplayCopyBits *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start3 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + base__extra_size = clip__extra_size; + } + + nw_size = 36; + mem_size = sizeof(SpiceMsgDisplayCopyBits) + base__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayCopyBits); + in = start; + + out = (SpiceMsgDisplayCopyBits *)data; + + /* base */ { + out->base.surface_id = 0; + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint32(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + } + /* src_pos */ { + out->src_pos.x = consume_int32(&in); + out->src_pos.y = consume_int32(&in); + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_inval_list(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t resources__nw_size, resources__mem_size; + uint32_t resources__nelements; + SpiceResourceList *out; + uint32_t i; + + { /* resources */ + uint16_t count__value; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + count__value = read_uint16(pos); + resources__nelements = count__value; + + resources__nw_size = (9) * resources__nelements; + resources__mem_size = sizeof(SpiceResourceID) * resources__nelements; + } + + nw_size = 2 + resources__nw_size; + mem_size = sizeof(SpiceResourceList) + resources__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceResourceList); + in = start; + + out = (SpiceResourceList *)data; + + out->count = consume_uint16(&in); + for (i = 0; i < resources__nelements; i++) { + SpiceResourceID *out2; + out2 = (SpiceResourceID *)end; + end += sizeof(SpiceResourceID); + + out2->type = consume_uint8(&in); + out2->id = consume_uint64(&in); + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_inval_all_pixmaps(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t wait_list__nw_size, wait_list__mem_size; + uint32_t wait_list__nelements; + SpiceMsgWaitForChannels *out; + uint32_t i; + + { /* wait_list */ + uint8_t wait_count__value; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + wait_count__value = read_uint8(pos); + wait_list__nelements = wait_count__value; + + wait_list__nw_size = (10) * wait_list__nelements; + wait_list__mem_size = sizeof(SpiceWaitForChannel) * wait_list__nelements; + } + + nw_size = 1 + wait_list__nw_size; + mem_size = sizeof(SpiceMsgWaitForChannels) + wait_list__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgWaitForChannels); + in = start; + + out = (SpiceMsgWaitForChannels *)data; + + out->wait_count = consume_uint8(&in); + for (i = 0; i < wait_list__nelements; i++) { + SpiceWaitForChannel *out2; + out2 = (SpiceWaitForChannel *)end; + end += sizeof(SpiceWaitForChannel); + + out2->channel_type = consume_uint8(&in); + out2->channel_id = consume_uint8(&in); + out2->message_serial = consume_uint64(&in); + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_inval_palette(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgDisplayInvalOne *out; + + nw_size = 8; + mem_size = sizeof(SpiceMsgDisplayInvalOne); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayInvalOne); + in = start; + + out = (SpiceMsgDisplayInvalOne *)data; + + out->id = consume_uint64(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_stream_create(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[1]; + size_t clip__extra_size; + SpiceMsgDisplayStreamCreate *out; + uint32_t i; + + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 52); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start2 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + nw_size = 64; + mem_size = sizeof(SpiceMsgDisplayStreamCreate) + clip__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayStreamCreate); + in = start; + + out = (SpiceMsgDisplayStreamCreate *)data; + + out->surface_id = 0; + out->id = consume_uint32(&in); + out->flags = consume_uint32(&in); + out->codec_type = consume_uint32(&in); + out->stamp = consume_uint64(&in); + out->stream_width = consume_uint32(&in); + out->stream_height = consume_uint32(&in); + out->src_width = consume_uint32(&in); + out->src_height = consume_uint32(&in); + /* dest */ { + out->dest.top = consume_int32(&in); + out->dest.left = consume_int32(&in); + out->dest.bottom = consume_int32(&in); + out->dest.right = consume_int32(&in); + } + /* clip */ { + out->clip.type = consume_uint32(&in); + if (out->clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_stream_data(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t data__nw_size, data__mem_size; + uint32_t data__nelements; + SpiceMsgDisplayStreamData *out; + + { /* data */ + uint32_t data_size__value; + pos = start + 8; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + data_size__value = read_uint32(pos); + data__nelements = data_size__value; + + data__nw_size = data__nelements; + data__mem_size = sizeof(uint8_t) * data__nelements; + } + + nw_size = 16 + data__nw_size; + mem_size = sizeof(SpiceMsgDisplayStreamData) + data__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayStreamData); + in = start; + + out = (SpiceMsgDisplayStreamData *)data; + + out->id = consume_uint32(&in); + out->multi_media_time = consume_uint32(&in); + out->data_size = consume_uint32(&in); + consume_uint32(&in); + memcpy(out->data, in, data__nelements); + in += data__nelements; + end += data__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_stream_clip(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[1]; + size_t clip__extra_size; + SpiceMsgDisplayStreamClip *out; + uint32_t i; + + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 4); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start2 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + nw_size = 16; + mem_size = sizeof(SpiceMsgDisplayStreamClip) + clip__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayStreamClip); + in = start; + + out = (SpiceMsgDisplayStreamClip *)data; + + out->id = consume_uint32(&in); + /* clip */ { + out->clip.type = consume_uint32(&in); + if (out->clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_stream_destroy(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgDisplayStreamDestroy *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgDisplayStreamDestroy); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayStreamDestroy); + in = start; + + out = (SpiceMsgDisplayStreamDestroy *)data; + + out->id = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static intptr_t validate_SpicePalette(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) +{ + uint8_t *start = message_start + offset; + SPICE_GNUC_UNUSED uint8_t *pos; + size_t mem_size, nw_size; + size_t ents__nw_size, ents__mem_size; + uint32_t ents__nelements; + + if (offset == 0) { + return 0; + } + + if (SPICE_UNLIKELY(start >= message_end)) { + goto error; + } + + { /* ents */ + uint16_t num_ents__value; + pos = start + 8; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + num_ents__value = read_uint16(pos); + ents__nelements = num_ents__value; + + ents__nw_size = (4) * ents__nelements; + ents__mem_size = sizeof(uint32_t) * ents__nelements; + } + + nw_size = 10 + ents__nw_size; + mem_size = sizeof(SpicePalette) + ents__mem_size; + + /* Check if struct fits in reported side */ + if (SPICE_UNLIKELY(start + nw_size > message_end)) { + goto error; + } + return mem_size; + + error: + return -1; +} + +static intptr_t validate_SpiceImage(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) +{ + uint8_t *start = message_start + offset; + SPICE_GNUC_UNUSED uint8_t *pos; + size_t mem_size, nw_size; + SPICE_GNUC_UNUSED intptr_t ptr_size; + size_t u__nw_size, u__extra_size; + uint8_t descriptor_type__value; + + if (offset == 0) { + return 0; + } + + if (SPICE_UNLIKELY(start >= message_end)) { + goto error; + } + + { /* u */ + pos = start + 8; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + descriptor_type__value = read_uint8(pos); + if (descriptor_type__value == SPICE_IMAGE_TYPE_BITMAP) { + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); + size_t pal__extra_size; + uint8_t flags__value; + size_t data__extra_size; + uint32_t data__array__nelements; + { /* pal */ + pos = start2 + 1; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + flags__value = read_uint8(pos); + if ((flags__value & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { + pal__extra_size = 0; + } else if (1) { + uint64_t pal_palette__value; + pos = (start2 + 14); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + pal_palette__value = read_uint64(pos); + ptr_size = validate_SpicePalette(message_start, message_end, pal_palette__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pal__extra_size = ptr_size + /* for alignment */ 3; + } else { + pal__extra_size = 0; + } + + } + + { /* data */ + uint64_t data__value; + uint32_t data__array__nw_size; + uint32_t stride__value; + uint32_t y__value; + pos = (start2 + 22); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + data__value = read_uint64(pos); + if (SPICE_UNLIKELY(message_start + data__value >= message_end)) { + goto error; + } + pos = start2 + 10; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + stride__value = read_uint32(pos); + pos = start2 + 6; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + y__value = read_uint32(pos); + data__array__nelements = stride__value * y__value; + + data__array__nw_size = data__array__nelements; + if (SPICE_UNLIKELY(message_start + data__value + data__array__nw_size > message_end)) { + goto error; + } + data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); + } + + u__nw_size = 30; + u__extra_size = pal__extra_size + data__extra_size; + } else if (descriptor_type__value == SPICE_IMAGE_TYPE_QUIC) { + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); + size_t data__nw_size, data__extra_size; + uint32_t data__nelements; + { /* data */ + uint32_t data_size__value; + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + data_size__value = read_uint32(pos); + data__nelements = data_size__value; + + data__nw_size = data__nelements; + data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); + } + + u__nw_size = 4 + data__nw_size; + u__extra_size = data__extra_size; + } else if (descriptor_type__value == SPICE_IMAGE_TYPE_LZ_RGB || descriptor_type__value == SPICE_IMAGE_TYPE_GLZ_RGB) { + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); + size_t data__nw_size, data__extra_size; + uint32_t data__nelements; + { /* data */ + uint32_t data_size__value; + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + data_size__value = read_uint32(pos); + data__nelements = data_size__value; + + data__nw_size = data__nelements; + data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); + } + + u__nw_size = 4 + data__nw_size; + u__extra_size = data__extra_size; + } else if (descriptor_type__value == SPICE_IMAGE_TYPE_LZ_PLT) { + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); + size_t pal__extra_size; + uint8_t flags__value; + size_t data__nw_size, data__extra_size; + uint32_t data__nelements; + { /* pal */ + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + flags__value = read_uint8(pos); + if ((flags__value & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { + pal__extra_size = 0; + } else if (1) { + uint64_t pal_palette__value; + pos = (start2 + 5); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + pal_palette__value = read_uint64(pos); + if (SPICE_UNLIKELY(pal_palette__value == 0)) { + goto error; + } + ptr_size = validate_SpicePalette(message_start, message_end, pal_palette__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pal__extra_size = ptr_size + /* for alignment */ 3; + } else { + pal__extra_size = 0; + } + + } + + { /* data */ + uint32_t data_size__value; + pos = start2 + 1; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + data_size__value = read_uint32(pos); + data__nelements = data_size__value; + + data__nw_size = data__nelements; + data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); + } + + u__nw_size = 13 + data__nw_size; + u__extra_size = pal__extra_size + data__extra_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + nw_size = 18 + u__nw_size; + mem_size = sizeof(SpiceImage) + u__extra_size; + + /* Check if struct fits in reported side */ + if (SPICE_UNLIKELY(start + nw_size > message_end)) { + goto error; + } + return mem_size; + + error: + return -1; +} + +static uint8_t * parse_struct_SpicePalette(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) +{ + uint8_t *in = message_start + this_ptr_info->offset; + uint8_t *end; + SpicePalette *out; + uint32_t ents__nelements; + uint32_t i; + + end = struct_data + sizeof(SpicePalette); + out = (SpicePalette *)struct_data; + + out->unique = consume_uint64(&in); + out->num_ents = consume_uint16(&in); + ents__nelements = out->num_ents; + for (i = 0; i < ents__nelements; i++) { + out->ents[i] = consume_uint32(&in); + end += sizeof(uint32_t); + } + return end; +} + +static uint8_t * parse_struct_SpiceImage(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) +{ + uint8_t *in = message_start + this_ptr_info->offset; + uint8_t *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[2]; + SpiceImage *out; + uint32_t i; + + end = struct_data + sizeof(SpiceImage); + out = (SpiceImage *)struct_data; + + /* descriptor */ { + out->descriptor.id = consume_uint64(&in); + out->descriptor.type = consume_uint8(&in); + out->descriptor.flags = consume_uint8(&in); + out->descriptor.width = consume_uint32(&in); + out->descriptor.height = consume_uint32(&in); + } + if (out->descriptor.type == SPICE_IMAGE_TYPE_BITMAP) { + uint32_t data__array__nelements; + SpiceChunks *chunks; + out->u.bitmap.format = consume_uint8(&in); + out->u.bitmap.flags = consume_uint8(&in); + out->u.bitmap.x = consume_uint32(&in); + out->u.bitmap.y = consume_uint32(&in); + out->u.bitmap.stride = consume_uint32(&in); + if ((out->u.bitmap.flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { + out->u.bitmap.palette_id = consume_uint64(&in); + } else if (1) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpicePalette; + ptr_info[n_ptr].dest = (void **)&out->u.bitmap.palette; + n_ptr++; + } + data__array__nelements = out->u.bitmap.stride * out->u.bitmap.y; + /* Reuse data from network message as chunk */ + chunks = (SpiceChunks *)end; + end += sizeof(SpiceChunks) + sizeof(SpiceChunk); + out->u.bitmap.data = chunks; + chunks->data_size = data__array__nelements; + chunks->flags = 0; + chunks->num_chunks = 1; + chunks->chunk[0].len = data__array__nelements; + chunks->chunk[0].data = message_start + consume_uint64(&in); + } else if (out->descriptor.type == SPICE_IMAGE_TYPE_QUIC) { + uint32_t data__nelements; + SpiceChunks *chunks; + out->u.quic.data_size = consume_uint32(&in); + data__nelements = out->u.quic.data_size; + /* use array as chunk */ + chunks = (SpiceChunks *)end; + end += sizeof(SpiceChunks) + sizeof(SpiceChunk); + out->u.quic.data = chunks; + chunks->data_size = data__nelements; + chunks->flags = 0; + chunks->num_chunks = 1; + chunks->chunk[0].len = data__nelements; + chunks->chunk[0].data = in; + in += data__nelements; + } else if (out->descriptor.type == SPICE_IMAGE_TYPE_LZ_RGB || out->descriptor.type == SPICE_IMAGE_TYPE_GLZ_RGB) { + uint32_t data__nelements; + SpiceChunks *chunks; + out->u.lz_rgb.data_size = consume_uint32(&in); + data__nelements = out->u.lz_rgb.data_size; + /* use array as chunk */ + chunks = (SpiceChunks *)end; + end += sizeof(SpiceChunks) + sizeof(SpiceChunk); + out->u.lz_rgb.data = chunks; + chunks->data_size = data__nelements; + chunks->flags = 0; + chunks->num_chunks = 1; + chunks->chunk[0].len = data__nelements; + chunks->chunk[0].data = in; + in += data__nelements; + } else if (out->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) { + uint32_t data__nelements; + SpiceChunks *chunks; + out->u.lz_plt.flags = consume_uint8(&in); + out->u.lz_plt.data_size = consume_uint32(&in); + if ((out->u.lz_plt.flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { + out->u.lz_plt.palette_id = consume_uint64(&in); + } else if (1) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpicePalette; + ptr_info[n_ptr].dest = (void **)&out->u.lz_plt.palette; + n_ptr++; + } + data__nelements = out->u.lz_plt.data_size; + /* use array as chunk */ + chunks = (SpiceChunks *)end; + end += sizeof(SpiceChunks) + sizeof(SpiceChunk); + out->u.lz_plt.data = chunks; + chunks->data_size = data__nelements; + chunks->flags = 0; + chunks->num_chunks = 1; + chunks->chunk[0].len = data__nelements; + chunks->chunk[0].data = in; + in += data__nelements; + } + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + return end; + + error: + return NULL; +} + +static uint8_t * parse_msg_display_draw_fill(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[3]; + size_t base__extra_size; + size_t data__extra_size; + SpiceMsgDisplayDrawFill *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start3 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); + size_t brush__extra_size; + size_t mask__extra_size; + { /* brush */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_BRUSH_TYPE_SOLID) { + u__extra_size = 0; + } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 4); + size_t pat__extra_size; + { /* pat */ + uint64_t pat__value; + pos = (start4 + 0); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + pat__value = read_uint64(pos); + if (SPICE_UNLIKELY(pat__value == 0)) { + goto error; + } + ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pat__extra_size = ptr_size + /* for alignment */ 3; + } + + u__extra_size = pat__extra_size; + } else { + u__extra_size = 0; + } + + } + + brush__extra_size = u__extra_size; + } + + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 22); + size_t bitmap__extra_size; + { /* bitmap */ + uint64_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + bitmap__value = read_uint64(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__extra_size = brush__extra_size + mask__extra_size; + } + + nw_size = 67; + mem_size = sizeof(SpiceMsgDisplayDrawFill) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawFill); + in = start; + + out = (SpiceMsgDisplayDrawFill *)data; + + /* base */ { + out->base.surface_id = 0; + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint32(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + } + /* data */ { + /* brush */ { + uint8_t *in_save; + out->data.brush.type = consume_uint32(&in); + in_save = in; + if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { + out->data.brush.u.color = consume_uint32(&in); + } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; + n_ptr++; + /* pos */ { + out->data.brush.u.pattern.pos.x = consume_int32(&in); + out->data.brush.u.pattern.pos.y = consume_int32(&in); + } + } + in = in_save + 16; + } + out->data.rop_descriptor = consume_uint16(&in); + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_opaque(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[4]; + size_t base__extra_size; + size_t data__extra_size; + SpiceMsgDisplayDrawOpaque *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start3 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); + size_t src_bitmap__extra_size; + size_t brush__extra_size; + size_t mask__extra_size; + { /* src_bitmap */ + uint64_t src_bitmap__value; + pos = (start2 + 0); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + src_bitmap__value = read_uint64(pos); + ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + src_bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + { /* brush */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 24); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_BRUSH_TYPE_SOLID) { + u__extra_size = 0; + } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 4); + size_t pat__extra_size; + { /* pat */ + uint64_t pat__value; + pos = (start4 + 0); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + pat__value = read_uint64(pos); + if (SPICE_UNLIKELY(pat__value == 0)) { + goto error; + } + ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pat__extra_size = ptr_size + /* for alignment */ 3; + } + + u__extra_size = pat__extra_size; + } else { + u__extra_size = 0; + } + + } + + brush__extra_size = u__extra_size; + } + + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 47); + size_t bitmap__extra_size; + { /* bitmap */ + uint64_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + bitmap__value = read_uint64(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__extra_size = src_bitmap__extra_size + brush__extra_size + mask__extra_size; + } + + nw_size = 92; + mem_size = sizeof(SpiceMsgDisplayDrawOpaque) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawOpaque); + in = start; + + out = (SpiceMsgDisplayDrawOpaque *)data; + + /* base */ { + out->base.surface_id = 0; + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint32(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + } + /* data */ { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; + n_ptr++; + /* src_area */ { + out->data.src_area.top = consume_int32(&in); + out->data.src_area.left = consume_int32(&in); + out->data.src_area.bottom = consume_int32(&in); + out->data.src_area.right = consume_int32(&in); + } + /* brush */ { + uint8_t *in_save; + out->data.brush.type = consume_uint32(&in); + in_save = in; + if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { + out->data.brush.u.color = consume_uint32(&in); + } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; + n_ptr++; + /* pos */ { + out->data.brush.u.pattern.pos.x = consume_int32(&in); + out->data.brush.u.pattern.pos.y = consume_int32(&in); + } + } + in = in_save + 16; + } + out->data.rop_descriptor = consume_uint16(&in); + out->data.scale_mode = consume_uint8(&in); + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_copy(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[3]; + size_t base__extra_size; + size_t data__extra_size; + SpiceMsgDisplayDrawCopy *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start3 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); + size_t src_bitmap__extra_size; + size_t mask__extra_size; + { /* src_bitmap */ + uint64_t src_bitmap__value; + pos = (start2 + 0); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + src_bitmap__value = read_uint64(pos); + ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + src_bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 27); + size_t bitmap__extra_size; + { /* bitmap */ + uint64_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + bitmap__value = read_uint64(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__extra_size = src_bitmap__extra_size + mask__extra_size; + } + + nw_size = 72; + mem_size = sizeof(SpiceMsgDisplayDrawCopy) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawCopy); + in = start; + + out = (SpiceMsgDisplayDrawCopy *)data; + + /* base */ { + out->base.surface_id = 0; + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint32(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + } + /* data */ { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; + n_ptr++; + /* src_area */ { + out->data.src_area.top = consume_int32(&in); + out->data.src_area.left = consume_int32(&in); + out->data.src_area.bottom = consume_int32(&in); + out->data.src_area.right = consume_int32(&in); + } + out->data.rop_descriptor = consume_uint16(&in); + out->data.scale_mode = consume_uint8(&in); + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_blend(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[3]; + size_t base__extra_size; + size_t data__extra_size; + SpiceMsgDisplayDrawBlend *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start3 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); + size_t src_bitmap__extra_size; + size_t mask__extra_size; + { /* src_bitmap */ + uint64_t src_bitmap__value; + pos = (start2 + 0); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + src_bitmap__value = read_uint64(pos); + ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + src_bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 27); + size_t bitmap__extra_size; + { /* bitmap */ + uint64_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + bitmap__value = read_uint64(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__extra_size = src_bitmap__extra_size + mask__extra_size; + } + + nw_size = 72; + mem_size = sizeof(SpiceMsgDisplayDrawBlend) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawBlend); + in = start; + + out = (SpiceMsgDisplayDrawBlend *)data; + + /* base */ { + out->base.surface_id = 0; + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint32(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + } + /* data */ { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; + n_ptr++; + /* src_area */ { + out->data.src_area.top = consume_int32(&in); + out->data.src_area.left = consume_int32(&in); + out->data.src_area.bottom = consume_int32(&in); + out->data.src_area.right = consume_int32(&in); + } + out->data.rop_descriptor = consume_uint16(&in); + out->data.scale_mode = consume_uint8(&in); + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_blackness(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[2]; + size_t base__extra_size; + size_t data__extra_size; + SpiceMsgDisplayDrawBlackness *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start3 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); + size_t mask__extra_size; + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); + size_t bitmap__extra_size; + { /* bitmap */ + uint64_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + bitmap__value = read_uint64(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__extra_size = mask__extra_size; + } + + nw_size = 45; + mem_size = sizeof(SpiceMsgDisplayDrawBlackness) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawBlackness); + in = start; + + out = (SpiceMsgDisplayDrawBlackness *)data; + + /* base */ { + out->base.surface_id = 0; + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint32(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + } + /* data */ { + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_whiteness(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[2]; + size_t base__extra_size; + size_t data__extra_size; + SpiceMsgDisplayDrawWhiteness *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start3 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); + size_t mask__extra_size; + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); + size_t bitmap__extra_size; + { /* bitmap */ + uint64_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + bitmap__value = read_uint64(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__extra_size = mask__extra_size; + } + + nw_size = 45; + mem_size = sizeof(SpiceMsgDisplayDrawWhiteness) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawWhiteness); + in = start; + + out = (SpiceMsgDisplayDrawWhiteness *)data; + + /* base */ { + out->base.surface_id = 0; + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint32(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + } + /* data */ { + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_invers(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[2]; + size_t base__extra_size; + size_t data__extra_size; + SpiceMsgDisplayDrawInvers *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start3 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); + size_t mask__extra_size; + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); + size_t bitmap__extra_size; + { /* bitmap */ + uint64_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + bitmap__value = read_uint64(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__extra_size = mask__extra_size; + } + + nw_size = 45; + mem_size = sizeof(SpiceMsgDisplayDrawInvers) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawInvers); + in = start; + + out = (SpiceMsgDisplayDrawInvers *)data; + + /* base */ { + out->base.surface_id = 0; + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint32(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + } + /* data */ { + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_rop3(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[4]; + size_t base__extra_size; + size_t data__extra_size; + SpiceMsgDisplayDrawRop3 *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start3 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); + size_t src_bitmap__extra_size; + size_t brush__extra_size; + size_t mask__extra_size; + { /* src_bitmap */ + uint64_t src_bitmap__value; + pos = (start2 + 0); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + src_bitmap__value = read_uint64(pos); + ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + src_bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + { /* brush */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 24); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_BRUSH_TYPE_SOLID) { + u__extra_size = 0; + } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 4); + size_t pat__extra_size; + { /* pat */ + uint64_t pat__value; + pos = (start4 + 0); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + pat__value = read_uint64(pos); + if (SPICE_UNLIKELY(pat__value == 0)) { + goto error; + } + ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pat__extra_size = ptr_size + /* for alignment */ 3; + } + + u__extra_size = pat__extra_size; + } else { + u__extra_size = 0; + } + + } + + brush__extra_size = u__extra_size; + } + + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 46); + size_t bitmap__extra_size; + { /* bitmap */ + uint64_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + bitmap__value = read_uint64(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__extra_size = src_bitmap__extra_size + brush__extra_size + mask__extra_size; + } + + nw_size = 91; + mem_size = sizeof(SpiceMsgDisplayDrawRop3) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawRop3); + in = start; + + out = (SpiceMsgDisplayDrawRop3 *)data; + + /* base */ { + out->base.surface_id = 0; + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint32(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + } + /* data */ { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; + n_ptr++; + /* src_area */ { + out->data.src_area.top = consume_int32(&in); + out->data.src_area.left = consume_int32(&in); + out->data.src_area.bottom = consume_int32(&in); + out->data.src_area.right = consume_int32(&in); + } + /* brush */ { + uint8_t *in_save; + out->data.brush.type = consume_uint32(&in); + in_save = in; + if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { + out->data.brush.u.color = consume_uint32(&in); + } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; + n_ptr++; + /* pos */ { + out->data.brush.u.pattern.pos.x = consume_int32(&in); + out->data.brush.u.pattern.pos.y = consume_int32(&in); + } + } + in = in_save + 16; + } + out->data.rop3 = consume_uint8(&in); + out->data.scale_mode = consume_uint8(&in); + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static intptr_t validate_SpicePath(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) +{ + uint8_t *start = message_start + offset; + SPICE_GNUC_UNUSED uint8_t *pos; + size_t mem_size, nw_size; + size_t segments__nw_size, segments__mem_size; + uint32_t segments__nelements; + uint32_t segments__nbytes; + + if (offset == 0) { + return 0; + } + + if (SPICE_UNLIKELY(start >= message_end)) { + goto error; + } + + { /* segments */ + uint32_t segments_size__value; + uint8_t *start2 = (start + 4); + uint8_t *start2_array_end; + uint32_t segments__element__nw_size; + uint32_t segments__element__mem_size; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + segments_size__value = read_uint32(pos); + segments__nbytes = segments_size__value; + segments__nelements = 0; + + segments__nw_size = segments__nbytes; + segments__mem_size = 0; + start2_array_end = start2 + segments__nbytes; + while (start2 < start2_array_end) { + SPICE_GNUC_UNUSED uint8_t *start3 = start2; + size_t points__nw_size, points__mem_size; + uint32_t points__nelements; + segments__nelements += 1; + { /* points */ + uint32_t count__value; + pos = start3 + 4; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + count__value = read_uint32(pos); + points__nelements = count__value; + + points__nw_size = (8) * points__nelements; + points__mem_size = sizeof(SpicePointFix) * points__nelements; + } + + segments__element__nw_size = 8 + points__nw_size; + segments__element__mem_size = sizeof(SpicePathSeg) + points__mem_size; + segments__mem_size += sizeof(void *) + SPICE_ALIGN(segments__element__mem_size, 4); + start2 += segments__element__nw_size; + } + if (SPICE_UNLIKELY(start2 != start2_array_end)) { + goto error; + } + pos = start + 0; + write_uint32(pos, segments__nelements); + } + + nw_size = 4 + segments__nw_size; + mem_size = sizeof(SpicePath) + segments__mem_size; + + /* Check if struct fits in reported side */ + if (SPICE_UNLIKELY(start + nw_size > message_end)) { + goto error; + } + return mem_size; + + error: + return -1; +} + +static uint8_t * parse_struct_SpicePath(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) +{ + uint8_t *in = message_start + this_ptr_info->offset; + uint8_t *end; + SpicePath *out; + uint32_t segments__nelements; + uint32_t i; + void * *ptr_array; + int ptr_array_index; + uint32_t j; + + end = struct_data + sizeof(SpicePath); + out = (SpicePath *)struct_data; + + out->num_segments = consume_uint32(&in); + segments__nelements = out->num_segments; + ptr_array_index = 0; + ptr_array = (void **)out->segments; + end += sizeof(void *) * segments__nelements; + for (i = 0; i < segments__nelements; i++) { + SpicePathSeg *out2; + uint32_t points__nelements; + ptr_array[ptr_array_index++] = end; + out2 = (SpicePathSeg *)end; + end += sizeof(SpicePathSeg); + + out2->flags = consume_uint32(&in); + out2->count = consume_uint32(&in); + points__nelements = out2->count; + for (j = 0; j < points__nelements; j++) { + SpicePointFix *out3; + out3 = (SpicePointFix *)end; + end += sizeof(SpicePointFix); + + out3->x = consume_int32(&in); + out3->y = consume_int32(&in); + } + /* Align ptr_array element to 4 bytes */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + } + return end; +} + +static uint8_t * parse_array_int32(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) +{ + uint8_t *in = message_start + this_ptr_info->offset; + uint8_t *end; + uint32_t i; + + end = struct_data; + for (i = 0; i < this_ptr_info->nelements; i++) { + *(SPICE_FIXED28_4 *)end = consume_int32(&in); + end += sizeof(SPICE_FIXED28_4); + } + return end; +} + +static uint8_t * parse_msg_display_draw_stroke(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[4]; + size_t base__extra_size; + size_t data__extra_size; + SpiceMsgDisplayDrawStroke *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start3 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); + size_t path__extra_size; + size_t attr__extra_size; + size_t brush__extra_size; + { /* path */ + uint64_t path__value; + pos = (start2 + 0); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + path__value = read_uint64(pos); + ptr_size = validate_SpicePath(message_start, message_end, path__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + path__extra_size = ptr_size + /* for alignment */ 3; + } + + { /* attr */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 8); + size_t style__extra_size; + uint32_t style__array__nelements; + { /* style */ + uint64_t style__value; + uint32_t style__array__nw_size; + uint32_t style__array__mem_size; + uint8_t style_nseg__value; + pos = (start3 + 12); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + style__value = read_uint64(pos); + if (SPICE_UNLIKELY(message_start + style__value >= message_end)) { + goto error; + } + pos = start3 + 3; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + style_nseg__value = read_uint8(pos); + style__array__nelements = style_nseg__value; + + style__array__nw_size = (4) * style__array__nelements; + style__array__mem_size = sizeof(SPICE_FIXED28_4) * style__array__nelements; + if (SPICE_UNLIKELY(message_start + style__value + style__array__nw_size > message_end)) { + goto error; + } + style__extra_size = style__array__mem_size + /* for alignment */ 3; + } + + attr__extra_size = style__extra_size; + } + + { /* brush */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 28); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_BRUSH_TYPE_SOLID) { + u__extra_size = 0; + } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 4); + size_t pat__extra_size; + { /* pat */ + uint64_t pat__value; + pos = (start4 + 0); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + pat__value = read_uint64(pos); + if (SPICE_UNLIKELY(pat__value == 0)) { + goto error; + } + ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pat__extra_size = ptr_size + /* for alignment */ 3; + } + + u__extra_size = pat__extra_size; + } else { + u__extra_size = 0; + } + + } + + brush__extra_size = u__extra_size; + } + + data__extra_size = path__extra_size + attr__extra_size + brush__extra_size; + } + + nw_size = 80; + mem_size = sizeof(SpiceMsgDisplayDrawStroke) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawStroke); + in = start; + + out = (SpiceMsgDisplayDrawStroke *)data; + + /* base */ { + out->base.surface_id = 0; + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint32(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + } + /* data */ { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpicePath; + ptr_info[n_ptr].dest = (void **)&out->data.path; + n_ptr++; + /* attr */ { + uint32_t style__array__nelements; + out->data.attr.flags = consume_uint8(&in); + consume_uint8(&in); + consume_uint8(&in); + out->data.attr.style_nseg = consume_uint8(&in); + consume_int32(&in); + consume_int32(&in); + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_array_int32; + ptr_info[n_ptr].dest = (void **)&out->data.attr.style; + style__array__nelements = out->data.attr.style_nseg; + ptr_info[n_ptr].nelements = style__array__nelements; + n_ptr++; + } + /* brush */ { + uint8_t *in_save; + out->data.brush.type = consume_uint32(&in); + in_save = in; + if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { + out->data.brush.u.color = consume_uint32(&in); + } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; + n_ptr++; + /* pos */ { + out->data.brush.u.pattern.pos.x = consume_int32(&in); + out->data.brush.u.pattern.pos.y = consume_int32(&in); + } + } + in = in_save + 16; + } + out->data.fore_mode = consume_uint16(&in); + out->data.back_mode = consume_uint16(&in); + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static intptr_t validate_SpiceString(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) +{ + uint8_t *start = message_start + offset; + SPICE_GNUC_UNUSED uint8_t *pos; + size_t mem_size, nw_size; + size_t u__nw_size, u__extra_size; + uint16_t flags__value; + uint32_t i; + + if (offset == 0) { + return 0; + } + + if (SPICE_UNLIKELY(start >= message_end)) { + goto error; + } + + { /* u */ + uint32_t u__mem_size; + uint32_t u__nelements; + pos = start + 2; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + flags__value = read_uint16(pos); + if ((flags__value & SPICE_STRING_FLAGS_RASTER_A1)) { + uint16_t length__value; + uint8_t *start2 = (start + 4); + uint32_t u__element__nw_size; + uint32_t u__element__mem_size; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + length__value = read_uint16(pos); + u__nelements = length__value; + + u__nw_size = 0; + u__mem_size = 0; + for (i = 0; i < u__nelements; i++) { + SPICE_GNUC_UNUSED uint8_t *start3 = start2; + size_t data__nw_size, data__mem_size; + uint32_t data__nelements; + { /* data */ + uint16_t width__value; + uint16_t height__value; + pos = start3 + 16; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + width__value = read_uint16(pos); + pos = start3 + 18; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + height__value = read_uint16(pos); + data__nelements = ((width__value + 7) / 8 ) * height__value; + + data__nw_size = data__nelements; + data__mem_size = sizeof(uint8_t) * data__nelements; + } + + u__element__nw_size = 20 + data__nw_size; + u__element__mem_size = sizeof(SpiceRasterGlyph) + data__mem_size; + u__nw_size += u__element__nw_size; + u__mem_size += sizeof(void *) + SPICE_ALIGN(u__element__mem_size, 4); + start2 += u__element__nw_size; + } + u__extra_size = u__mem_size; + } else if ((flags__value & SPICE_STRING_FLAGS_RASTER_A4)) { + uint16_t length__value; + uint8_t *start2 = (start + 4); + uint32_t u__element__nw_size; + uint32_t u__element__mem_size; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + length__value = read_uint16(pos); + u__nelements = length__value; + + u__nw_size = 0; + u__mem_size = 0; + for (i = 0; i < u__nelements; i++) { + SPICE_GNUC_UNUSED uint8_t *start3 = start2; + size_t data__nw_size, data__mem_size; + uint32_t data__nelements; + { /* data */ + uint16_t width__value; + uint16_t height__value; + pos = start3 + 16; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + width__value = read_uint16(pos); + pos = start3 + 18; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + height__value = read_uint16(pos); + data__nelements = ((4 * width__value + 7) / 8 ) * height__value; + + data__nw_size = data__nelements; + data__mem_size = sizeof(uint8_t) * data__nelements; + } + + u__element__nw_size = 20 + data__nw_size; + u__element__mem_size = sizeof(SpiceRasterGlyph) + data__mem_size; + u__nw_size += u__element__nw_size; + u__mem_size += sizeof(void *) + SPICE_ALIGN(u__element__mem_size, 4); + start2 += u__element__nw_size; + } + u__extra_size = u__mem_size; + } else if ((flags__value & SPICE_STRING_FLAGS_RASTER_A8)) { + uint16_t length__value; + uint8_t *start2 = (start + 4); + uint32_t u__element__nw_size; + uint32_t u__element__mem_size; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + length__value = read_uint16(pos); + u__nelements = length__value; + + u__nw_size = 0; + u__mem_size = 0; + for (i = 0; i < u__nelements; i++) { + SPICE_GNUC_UNUSED uint8_t *start3 = start2; + size_t data__nw_size, data__mem_size; + uint32_t data__nelements; + { /* data */ + uint16_t width__value; + uint16_t height__value; + pos = start3 + 16; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + width__value = read_uint16(pos); + pos = start3 + 18; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + height__value = read_uint16(pos); + data__nelements = width__value * height__value; + + data__nw_size = data__nelements; + data__mem_size = sizeof(uint8_t) * data__nelements; + } + + u__element__nw_size = 20 + data__nw_size; + u__element__mem_size = sizeof(SpiceRasterGlyph) + data__mem_size; + u__nw_size += u__element__nw_size; + u__mem_size += sizeof(void *) + SPICE_ALIGN(u__element__mem_size, 4); + start2 += u__element__nw_size; + } + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + nw_size = 4 + u__nw_size; + mem_size = sizeof(SpiceString) + u__extra_size; + + /* Check if struct fits in reported side */ + if (SPICE_UNLIKELY(start + nw_size > message_end)) { + goto error; + } + return mem_size; + + error: + return -1; +} + +static uint8_t * parse_struct_SpiceString(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) +{ + uint8_t *in = message_start + this_ptr_info->offset; + uint8_t *end; + SpiceString *out; + uint32_t i; + + end = struct_data + sizeof(SpiceString); + out = (SpiceString *)struct_data; + + out->length = consume_uint16(&in); + out->flags = consume_uint16(&in); + if ((out->flags & SPICE_STRING_FLAGS_RASTER_A1)) { + uint32_t glyphs__nelements; + void * *ptr_array; + int ptr_array_index; + glyphs__nelements = out->length; + ptr_array_index = 0; + ptr_array = (void **)out->glyphs; + end += sizeof(void *) * glyphs__nelements; + for (i = 0; i < glyphs__nelements; i++) { + SpiceRasterGlyph *out2; + uint32_t data__nelements; + ptr_array[ptr_array_index++] = end; + out2 = (SpiceRasterGlyph *)end; + end += sizeof(SpiceRasterGlyph); + + /* render_pos */ { + out2->render_pos.x = consume_int32(&in); + out2->render_pos.y = consume_int32(&in); + } + /* glyph_origin */ { + out2->glyph_origin.x = consume_int32(&in); + out2->glyph_origin.y = consume_int32(&in); + } + out2->width = consume_uint16(&in); + out2->height = consume_uint16(&in); + data__nelements = ((out2->width + 7) / 8 ) * out2->height; + memcpy(out2->data, in, data__nelements); + in += data__nelements; + end += data__nelements; + /* Align ptr_array element to 4 bytes */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + } + } else if ((out->flags & SPICE_STRING_FLAGS_RASTER_A4)) { + uint32_t glyphs__nelements; + void * *ptr_array; + int ptr_array_index; + glyphs__nelements = out->length; + ptr_array_index = 0; + ptr_array = (void **)out->glyphs; + end += sizeof(void *) * glyphs__nelements; + for (i = 0; i < glyphs__nelements; i++) { + SpiceRasterGlyph *out2; + uint32_t data__nelements; + ptr_array[ptr_array_index++] = end; + out2 = (SpiceRasterGlyph *)end; + end += sizeof(SpiceRasterGlyph); + + /* render_pos */ { + out2->render_pos.x = consume_int32(&in); + out2->render_pos.y = consume_int32(&in); + } + /* glyph_origin */ { + out2->glyph_origin.x = consume_int32(&in); + out2->glyph_origin.y = consume_int32(&in); + } + out2->width = consume_uint16(&in); + out2->height = consume_uint16(&in); + data__nelements = ((4 * out2->width + 7) / 8 ) * out2->height; + memcpy(out2->data, in, data__nelements); + in += data__nelements; + end += data__nelements; + /* Align ptr_array element to 4 bytes */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + } + } else if ((out->flags & SPICE_STRING_FLAGS_RASTER_A8)) { + uint32_t glyphs__nelements; + void * *ptr_array; + int ptr_array_index; + glyphs__nelements = out->length; + ptr_array_index = 0; + ptr_array = (void **)out->glyphs; + end += sizeof(void *) * glyphs__nelements; + for (i = 0; i < glyphs__nelements; i++) { + SpiceRasterGlyph *out2; + uint32_t data__nelements; + ptr_array[ptr_array_index++] = end; + out2 = (SpiceRasterGlyph *)end; + end += sizeof(SpiceRasterGlyph); + + /* render_pos */ { + out2->render_pos.x = consume_int32(&in); + out2->render_pos.y = consume_int32(&in); + } + /* glyph_origin */ { + out2->glyph_origin.x = consume_int32(&in); + out2->glyph_origin.y = consume_int32(&in); + } + out2->width = consume_uint16(&in); + out2->height = consume_uint16(&in); + data__nelements = out2->width * out2->height; + memcpy(out2->data, in, data__nelements); + in += data__nelements; + end += data__nelements; + /* Align ptr_array element to 4 bytes */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + } + } + return end; +} + +static uint8_t * parse_msg_display_draw_text(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[4]; + size_t base__extra_size; + size_t data__extra_size; + SpiceMsgDisplayDrawText *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start3 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); + size_t str__extra_size; + size_t fore_brush__extra_size; + size_t back_brush__extra_size; + { /* str */ + uint64_t str__value; + pos = (start2 + 0); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + str__value = read_uint64(pos); + ptr_size = validate_SpiceString(message_start, message_end, str__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + str__extra_size = ptr_size + /* for alignment */ 3; + } + + { /* fore_brush */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 24); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_BRUSH_TYPE_SOLID) { + u__extra_size = 0; + } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 4); + size_t pat__extra_size; + { /* pat */ + uint64_t pat__value; + pos = (start4 + 0); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + pat__value = read_uint64(pos); + if (SPICE_UNLIKELY(pat__value == 0)) { + goto error; + } + ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pat__extra_size = ptr_size + /* for alignment */ 3; + } + + u__extra_size = pat__extra_size; + } else { + u__extra_size = 0; + } + + } + + fore_brush__extra_size = u__extra_size; + } + + { /* back_brush */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 44); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_BRUSH_TYPE_SOLID) { + u__extra_size = 0; + } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 4); + size_t pat__extra_size; + { /* pat */ + uint64_t pat__value; + pos = (start4 + 0); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + pat__value = read_uint64(pos); + if (SPICE_UNLIKELY(pat__value == 0)) { + goto error; + } + ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pat__extra_size = ptr_size + /* for alignment */ 3; + } + + u__extra_size = pat__extra_size; + } else { + u__extra_size = 0; + } + + } + + back_brush__extra_size = u__extra_size; + } + + data__extra_size = str__extra_size + fore_brush__extra_size + back_brush__extra_size; + } + + nw_size = 96; + mem_size = sizeof(SpiceMsgDisplayDrawText) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawText); + in = start; + + out = (SpiceMsgDisplayDrawText *)data; + + /* base */ { + out->base.surface_id = 0; + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint32(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + } + /* data */ { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceString; + ptr_info[n_ptr].dest = (void **)&out->data.str; + n_ptr++; + /* back_area */ { + out->data.back_area.top = consume_int32(&in); + out->data.back_area.left = consume_int32(&in); + out->data.back_area.bottom = consume_int32(&in); + out->data.back_area.right = consume_int32(&in); + } + /* fore_brush */ { + uint8_t *in_save; + out->data.fore_brush.type = consume_uint32(&in); + in_save = in; + if (out->data.fore_brush.type == SPICE_BRUSH_TYPE_SOLID) { + out->data.fore_brush.u.color = consume_uint32(&in); + } else if (out->data.fore_brush.type == SPICE_BRUSH_TYPE_PATTERN) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.fore_brush.u.pattern.pat; + n_ptr++; + /* pos */ { + out->data.fore_brush.u.pattern.pos.x = consume_int32(&in); + out->data.fore_brush.u.pattern.pos.y = consume_int32(&in); + } + } + in = in_save + 16; + } + /* back_brush */ { + uint8_t *in_save; + out->data.back_brush.type = consume_uint32(&in); + in_save = in; + if (out->data.back_brush.type == SPICE_BRUSH_TYPE_SOLID) { + out->data.back_brush.u.color = consume_uint32(&in); + } else if (out->data.back_brush.type == SPICE_BRUSH_TYPE_PATTERN) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.back_brush.u.pattern.pat; + n_ptr++; + /* pos */ { + out->data.back_brush.u.pattern.pos.x = consume_int32(&in); + out->data.back_brush.u.pattern.pos.y = consume_int32(&in); + } + } + in = in_save + 16; + } + out->data.fore_mode = consume_uint16(&in); + out->data.back_mode = consume_uint16(&in); + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_transparent(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[2]; + size_t base__extra_size; + size_t data__extra_size; + SpiceMsgDisplayDrawTransparent *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start3 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); + size_t src_bitmap__extra_size; + { /* src_bitmap */ + uint64_t src_bitmap__value; + pos = (start2 + 0); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + src_bitmap__value = read_uint64(pos); + ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + src_bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + data__extra_size = src_bitmap__extra_size; + } + + nw_size = 60; + mem_size = sizeof(SpiceMsgDisplayDrawTransparent) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawTransparent); + in = start; + + out = (SpiceMsgDisplayDrawTransparent *)data; + + /* base */ { + out->base.surface_id = 0; + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint32(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + } + /* data */ { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; + n_ptr++; + /* src_area */ { + out->data.src_area.top = consume_int32(&in); + out->data.src_area.left = consume_int32(&in); + out->data.src_area.bottom = consume_int32(&in); + out->data.src_area.right = consume_int32(&in); + } + out->data.src_color = consume_uint32(&in); + out->data.true_color = consume_uint32(&in); + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_alpha_blend(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[2]; + size_t base__extra_size; + size_t data__extra_size; + SpiceMsgDisplayDrawAlphaBlend *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 16); + size_t u__extra_size; + uint32_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + type__value = read_uint32(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + uint64_t u_rects__value; + pos = (start3 + 4); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + u_rects__value = read_uint64(pos); + ptr_size = validate_SpiceClipRects(message_start, message_end, u_rects__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + u__extra_size = ptr_size + /* for alignment */ 3; + } else if (1) { + u__extra_size = 0; + } else { + u__extra_size = 0; + } + + } + + clip__extra_size = u__extra_size; + } + + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 28); + size_t src_bitmap__extra_size; + { /* src_bitmap */ + uint64_t src_bitmap__value; + pos = (start2 + 1); + if (SPICE_UNLIKELY(pos + 8 > message_end)) { + goto error; + } + src_bitmap__value = read_uint64(pos); + ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + src_bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + data__extra_size = src_bitmap__extra_size; + } + + nw_size = 53; + mem_size = sizeof(SpiceMsgDisplayDrawAlphaBlend) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawAlphaBlend); + in = start; + + out = (SpiceMsgDisplayDrawAlphaBlend *)data; + + /* base */ { + out->base.surface_id = 0; + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint32(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + } else if (1) { + consume_uint64(&in); + } + } + } + /* data */ { + out->data.alpha_flags = 0; + out->data.alpha = consume_uint8(&in); + ptr_info[n_ptr].offset = consume_uint64(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; + n_ptr++; + /* src_area */ { + out->data.src_area.top = consume_int32(&in); + out->data.src_area.left = consume_int32(&in); + out->data.src_area.bottom = consume_int32(&in); + out->data.src_area.right = consume_int32(&in); + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_DisplayChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[7] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify + }; + static parse_msg_func_t funcs2[8] = { + parse_msg_display_mode, + parse_SpiceMsgEmpty, + parse_SpiceMsgEmpty, + parse_msg_display_copy_bits, + parse_msg_display_inval_list, + parse_msg_display_inval_all_pixmaps, + parse_msg_display_inval_palette, + parse_SpiceMsgEmpty + }; + static parse_msg_func_t funcs3[5] = { + parse_msg_display_stream_create, + parse_msg_display_stream_data, + parse_msg_display_stream_clip, + parse_msg_display_stream_destroy, + parse_SpiceMsgEmpty + }; + static parse_msg_func_t funcs4[12] = { + parse_msg_display_draw_fill, + parse_msg_display_draw_opaque, + parse_msg_display_draw_copy, + parse_msg_display_draw_blend, + parse_msg_display_draw_blackness, + parse_msg_display_draw_whiteness, + parse_msg_display_draw_invers, + parse_msg_display_draw_rop3, + parse_msg_display_draw_stroke, + parse_msg_display_draw_text, + parse_msg_display_draw_transparent, + parse_msg_display_draw_alpha_blend + }; + if (message_type >= 1 && message_type < 8) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 109) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 122 && message_type < 127) { + return funcs3[message_type-122](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 302 && message_type < 314) { + return funcs4[message_type-302](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msg_inputs_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgInputsInit *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgInputsInit); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgInputsInit); + in = start; + + out = (SpiceMsgInputsInit *)data; + + out->keyboard_modifiers = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_inputs_key_modifiers(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgInputsKeyModifiers *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgInputsKeyModifiers); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgInputsKeyModifiers); + in = start; + + out = (SpiceMsgInputsKeyModifiers *)data; + + out->modifiers = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_InputsChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[7] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify + }; + static parse_msg_func_t funcs2[2] = { + parse_msg_inputs_init, + parse_msg_inputs_key_modifiers + }; + static parse_msg_func_t funcs3[1] = { + parse_SpiceMsgEmpty + }; + if (message_type >= 1 && message_type < 8) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 103) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 111 && message_type < 112) { + return funcs3[message_type-111](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msg_cursor_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t cursor__nw_size; + SpiceMsgCursorInit *out; + + { /* cursor */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 9); + size_t data__nw_size; + uint32_t data__nelements; + { /* data */ + data__nelements = message_end - (start2 + 22); + + data__nw_size = data__nelements; + } + + cursor__nw_size = 22 + data__nw_size; + } + + nw_size = 9 + cursor__nw_size; + mem_size = sizeof(SpiceMsgCursorInit); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgCursorInit); + in = start; + + out = (SpiceMsgCursorInit *)data; + + /* position */ { + out->position.x = consume_int16(&in); + out->position.y = consume_int16(&in); + } + out->trail_length = consume_uint16(&in); + out->trail_frequency = consume_uint16(&in); + out->visible = consume_uint8(&in); + /* cursor */ { + uint32_t data__nelements; + out->cursor.flags = consume_uint32(&in); + /* header */ { + out->cursor.header.unique = consume_uint64(&in); + out->cursor.header.type = consume_uint16(&in); + out->cursor.header.width = consume_uint16(&in); + out->cursor.header.height = consume_uint16(&in); + out->cursor.header.hot_spot_x = consume_uint16(&in); + out->cursor.header.hot_spot_y = consume_uint16(&in); + } + data__nelements = (message_end - in) / (1); + /* use array as pointer */ + out->cursor.data = (uint8_t *)in; + out->cursor.data_size = data__nelements; + in += data__nelements; + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_cursor_set(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t cursor__nw_size; + SpiceMsgCursorSet *out; + + { /* cursor */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 5); + size_t data__nw_size; + uint32_t data__nelements; + { /* data */ + data__nelements = message_end - (start2 + 22); + + data__nw_size = data__nelements; + } + + cursor__nw_size = 22 + data__nw_size; + } + + nw_size = 5 + cursor__nw_size; + mem_size = sizeof(SpiceMsgCursorSet); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgCursorSet); + in = start; + + out = (SpiceMsgCursorSet *)data; + + /* position */ { + out->position.x = consume_int16(&in); + out->position.y = consume_int16(&in); + } + out->visible = consume_uint8(&in); + /* cursor */ { + uint32_t data__nelements; + out->cursor.flags = consume_uint32(&in); + /* header */ { + out->cursor.header.unique = consume_uint64(&in); + out->cursor.header.type = consume_uint16(&in); + out->cursor.header.width = consume_uint16(&in); + out->cursor.header.height = consume_uint16(&in); + out->cursor.header.hot_spot_x = consume_uint16(&in); + out->cursor.header.hot_spot_y = consume_uint16(&in); + } + data__nelements = (message_end - in) / (1); + /* use array as pointer */ + out->cursor.data = (uint8_t *)in; + out->cursor.data_size = data__nelements; + in += data__nelements; + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_cursor_move(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgCursorMove *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgCursorMove); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgCursorMove); + in = start; + + out = (SpiceMsgCursorMove *)data; + + /* position */ { + out->position.x = consume_int16(&in); + out->position.y = consume_int16(&in); + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_cursor_trail(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgCursorTrail *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgCursorTrail); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgCursorTrail); + in = start; + + out = (SpiceMsgCursorTrail *)data; + + out->length = consume_uint16(&in); + out->frequency = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_cursor_inval_one(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgDisplayInvalOne *out; + + nw_size = 8; + mem_size = sizeof(SpiceMsgDisplayInvalOne); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayInvalOne); + in = start; + + out = (SpiceMsgDisplayInvalOne *)data; + + out->id = consume_uint64(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_CursorChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[7] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify + }; + static parse_msg_func_t funcs2[8] = { + parse_msg_cursor_init, + parse_SpiceMsgEmpty, + parse_msg_cursor_set, + parse_msg_cursor_move, + parse_SpiceMsgEmpty, + parse_msg_cursor_trail, + parse_msg_cursor_inval_one, + parse_SpiceMsgEmpty + }; + if (message_type >= 1 && message_type < 8) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 109) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msg_playback_data(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t data__nw_size; + uint32_t data__nelements; + SpiceMsgPlaybackPacket *out; + + { /* data */ + data__nelements = message_end - (start + 4); + + data__nw_size = data__nelements; + } + + nw_size = 4 + data__nw_size; + mem_size = sizeof(SpiceMsgPlaybackPacket); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgPlaybackPacket); + in = start; + + out = (SpiceMsgPlaybackPacket *)data; + + out->time = consume_uint32(&in); + /* use array as pointer */ + out->data = (uint8_t *)in; + out->data_size = data__nelements; + in += data__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_playback_mode(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t data__nw_size; + uint32_t data__nelements; + SpiceMsgPlaybackMode *out; + + { /* data */ + data__nelements = message_end - (start + 8); + + data__nw_size = data__nelements; + } + + nw_size = 8 + data__nw_size; + mem_size = sizeof(SpiceMsgPlaybackMode); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgPlaybackMode); + in = start; + + out = (SpiceMsgPlaybackMode *)data; + + out->time = consume_uint32(&in); + out->mode = consume_uint32(&in); + /* use array as pointer */ + out->data = (uint8_t *)in; + out->data_size = data__nelements; + in += data__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_playback_start(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgPlaybackStart *out; + + nw_size = 16; + mem_size = sizeof(SpiceMsgPlaybackStart); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgPlaybackStart); + in = start; + + out = (SpiceMsgPlaybackStart *)data; + + out->channels = consume_uint32(&in); + out->format = consume_uint32(&in); + out->frequency = consume_uint32(&in); + out->time = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_PlaybackChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[7] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify + }; + static parse_msg_func_t funcs2[4] = { + parse_msg_playback_data, + parse_msg_playback_mode, + parse_msg_playback_start, + parse_SpiceMsgEmpty + }; + if (message_type >= 1 && message_type < 8) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 105) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msg_record_start(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgRecordStart *out; + + nw_size = 12; + mem_size = sizeof(SpiceMsgRecordStart); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgRecordStart); + in = start; + + out = (SpiceMsgRecordStart *)data; + + out->channels = consume_uint32(&in); + out->format = consume_uint32(&in); + out->frequency = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_RecordChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[7] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify + }; + static parse_msg_func_t funcs2[2] = { + parse_msg_record_start, + parse_SpiceMsgEmpty + }; + if (message_type >= 1 && message_type < 8) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 103) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + +spice_parse_channel_func_t spice_get_server_channel_parser1(uint32_t channel, unsigned int *max_message_type) +{ + static struct {spice_parse_channel_func_t func; unsigned int max_messages; } channels[7] = { + { NULL, 0 }, + { parse_MainChannel_msg, 111}, + { parse_DisplayChannel_msg, 313}, + { parse_InputsChannel_msg, 111}, + { parse_CursorChannel_msg, 108}, + { parse_PlaybackChannel_msg, 104}, + { parse_RecordChannel_msg, 102} + }; + if (channel < 7) { + if (max_message_type != NULL) { + *max_message_type = channels[channel].max_messages; + } + return channels[channel].func; + } + return NULL; +} + +uint8_t * spice_parse_msg1(uint8_t *message_start, uint8_t *message_end, uint32_t channel, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + spice_parse_channel_func_t func; + func = spice_get_server_channel_parser1(channel, NULL); + if (func != NULL) { + return func(message_start, message_end, message_type, minor, size_out, free_message); + } + return NULL; +} diff -Nru spice-gtk-0.9/spice-common/common/generated_client_demarshallers.c spice-gtk-0.12/spice-common/common/generated_client_demarshallers.c --- spice-gtk-0.9/spice-common/common/generated_client_demarshallers.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/generated_client_demarshallers.c 2012-04-24 11:24:34.000000000 +0000 @@ -0,0 +1,7116 @@ +/* this is a file autogenerated by spice_codegen.py */ +#ifdef HAVE_CONFIG_H +#include +#endif +#include "messages.h" +#include +#include +#include +#include +#include +#include +#include "mem.h" + +#ifdef _MSC_VER +#pragma warning(disable:4101) +#endif + + + +#ifdef WORDS_BIGENDIAN +#define read_int8(ptr) (*((int8_t *)(ptr))) +#define write_int8(ptr, val) *(int8_t *)(ptr) = val +#define read_uint8(ptr) (*((uint8_t *)(ptr))) +#define write_uint8(ptr, val) *(uint8_t *)(ptr) = val +#define read_int16(ptr) ((int16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr))) +#define write_int16(ptr, val) *(uint16_t *)(ptr) = SPICE_BYTESWAP16((uint16_t)val) +#define read_uint16(ptr) ((uint16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr))) +#define write_uint16(ptr, val) *(uint16_t *)(ptr) = SPICE_BYTESWAP16((uint16_t)val) +#define read_int32(ptr) ((int32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr))) +#define write_int32(ptr, val) *(uint32_t *)(ptr) = SPICE_BYTESWAP32((uint32_t)val) +#define read_uint32(ptr) ((uint32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr))) +#define write_uint32(ptr, val) *(uint32_t *)(ptr) = SPICE_BYTESWAP32((uint32_t)val) +#define read_int64(ptr) ((int64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))) +#define write_int64(ptr, val) *(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val) +#define read_uint64(ptr) ((uint64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))) +#define write_uint64(ptr, val) *(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val) +#else +#define read_int8(ptr) (*((int8_t *)(ptr))) +#define write_int8(ptr, val) (*((int8_t *)(ptr))) = val +#define read_uint8(ptr) (*((uint8_t *)(ptr))) +#define write_uint8(ptr, val) (*((uint8_t *)(ptr))) = val +#define read_int16(ptr) (*((int16_t *)(ptr))) +#define write_int16(ptr, val) (*((int16_t *)(ptr))) = val +#define read_uint16(ptr) (*((uint16_t *)(ptr))) +#define write_uint16(ptr, val) (*((uint16_t *)(ptr))) = val +#define read_int32(ptr) (*((int32_t *)(ptr))) +#define write_int32(ptr, val) (*((int32_t *)(ptr))) = val +#define read_uint32(ptr) (*((uint32_t *)(ptr))) +#define write_uint32(ptr, val) (*((uint32_t *)(ptr))) = val +#define read_int64(ptr) (*((int64_t *)(ptr))) +#define write_int64(ptr, val) (*((int64_t *)(ptr))) = val +#define read_uint64(ptr) (*((uint64_t *)(ptr))) +#define write_uint64(ptr, val) (*((uint64_t *)(ptr))) = val +#endif + +static int8_t SPICE_GNUC_UNUSED consume_int8(uint8_t **ptr) +{ + int8_t val; + val = read_int8(*ptr); + *ptr += 1; + return val; +} + +static uint8_t SPICE_GNUC_UNUSED consume_uint8(uint8_t **ptr) +{ + uint8_t val; + val = read_uint8(*ptr); + *ptr += 1; + return val; +} + +static int16_t SPICE_GNUC_UNUSED consume_int16(uint8_t **ptr) +{ + int16_t val; + val = read_int16(*ptr); + *ptr += 2; + return val; +} + +static uint16_t SPICE_GNUC_UNUSED consume_uint16(uint8_t **ptr) +{ + uint16_t val; + val = read_uint16(*ptr); + *ptr += 2; + return val; +} + +static int32_t SPICE_GNUC_UNUSED consume_int32(uint8_t **ptr) +{ + int32_t val; + val = read_int32(*ptr); + *ptr += 4; + return val; +} + +static uint32_t SPICE_GNUC_UNUSED consume_uint32(uint8_t **ptr) +{ + uint32_t val; + val = read_uint32(*ptr); + *ptr += 4; + return val; +} + +static int64_t SPICE_GNUC_UNUSED consume_int64(uint8_t **ptr) +{ + int64_t val; + val = read_int64(*ptr); + *ptr += 8; + return val; +} + +static uint64_t SPICE_GNUC_UNUSED consume_uint64(uint8_t **ptr) +{ + uint64_t val; + val = read_uint64(*ptr); + *ptr += 8; + return val; +} + +typedef struct PointerInfo PointerInfo; +typedef void (*message_destructor_t)(uint8_t *message); +typedef uint8_t * (*parse_func_t)(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *ptr_info, int minor); +typedef uint8_t * (*parse_msg_func_t)(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size_out, message_destructor_t *free_message); +typedef uint8_t * (*spice_parse_channel_func_t)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message); + +struct PointerInfo { + uint64_t offset; + parse_func_t parse; + void * *dest; + uint32_t nelements; +}; + +static uint8_t * parse_msg_migrate(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgMigrate *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgMigrate); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMigrate); + in = start; + + out = (SpiceMsgMigrate *)data; + + out->flags = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static void nofree(uint8_t *data) +{ +} + +static uint8_t * parse_SpiceMsgData(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t data__nw_size; + uint32_t data__nelements; + + { /* data */ + data__nelements = message_end - (start + 0); + + data__nw_size = data__nelements; + } + + nw_size = 0 + data__nw_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = message_start; + *size = message_end - message_start; + *free_message = nofree; + return data; + +} + +static uint8_t * parse_msg_set_ack(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgSetAck *out; + + nw_size = 8; + mem_size = sizeof(SpiceMsgSetAck); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgSetAck); + in = start; + + out = (SpiceMsgSetAck *)data; + + out->generation = consume_uint32(&in); + out->window = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_ping(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t data__nw_size; + uint32_t data__nelements; + SpiceMsgPing *out; + + { /* data */ + data__nelements = message_end - (start + 12); + + data__nw_size = data__nelements; + } + + nw_size = 12 + data__nw_size; + mem_size = sizeof(SpiceMsgPing); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgPing); + in = start; + + out = (SpiceMsgPing *)data; + + out->id = consume_uint32(&in); + out->timestamp = consume_uint64(&in); + /* use array as pointer */ + out->data = (uint8_t *)in; + out->data_len = data__nelements; + in += data__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_wait_for_channels(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t wait_list__nw_size, wait_list__mem_size; + uint32_t wait_list__nelements; + SpiceMsgWaitForChannels *out; + uint32_t i; + + { /* wait_list */ + uint8_t wait_count__value; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + wait_count__value = read_uint8(pos); + wait_list__nelements = wait_count__value; + + wait_list__nw_size = (10) * wait_list__nelements; + wait_list__mem_size = sizeof(SpiceWaitForChannel) * wait_list__nelements; + } + + nw_size = 1 + wait_list__nw_size; + mem_size = sizeof(SpiceMsgWaitForChannels) + wait_list__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgWaitForChannels); + in = start; + + out = (SpiceMsgWaitForChannels *)data; + + out->wait_count = consume_uint8(&in); + for (i = 0; i < wait_list__nelements; i++) { + SpiceWaitForChannel *out2; + out2 = (SpiceWaitForChannel *)end; + end += sizeof(SpiceWaitForChannel); + + out2->channel_type = consume_uint8(&in); + out2->channel_id = consume_uint8(&in); + out2->message_serial = consume_uint64(&in); + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_disconnecting(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgDisconnect *out; + + nw_size = 12; + mem_size = sizeof(SpiceMsgDisconnect); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisconnect); + in = start; + + out = (SpiceMsgDisconnect *)data; + + out->time_stamp = consume_uint64(&in); + out->reason = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_notify(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t message__nw_size, message__mem_size; + uint32_t message__nelements; + SpiceMsgNotify *out; + + { /* message */ + uint32_t message_len__value; + pos = start + 20; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + message_len__value = read_uint32(pos); + message__nelements = message_len__value; + + message__nw_size = message__nelements; + message__mem_size = sizeof(uint8_t) * message__nelements; + } + + nw_size = 24 + message__nw_size; + mem_size = sizeof(SpiceMsgNotify) + message__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgNotify); + in = start; + + out = (SpiceMsgNotify *)data; + + out->time_stamp = consume_uint64(&in); + out->severity = consume_uint32(&in); + out->visibilty = consume_uint32(&in); + out->what = consume_uint32(&in); + out->message_len = consume_uint32(&in); + memcpy(out->message, in, message__nelements); + in += message__nelements; + end += message__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_array_uint8(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) +{ + uint8_t *in = message_start + this_ptr_info->offset; + uint8_t *end; + + end = struct_data; + memcpy(end, in, this_ptr_info->nelements); + in += this_ptr_info->nelements; + end += this_ptr_info->nelements; + return end; +} + +static uint8_t * parse_msg_main_migrate_begin(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[2]; + size_t host_data__extra_size; + uint32_t host_data__array__nelements; + size_t cert_subject_data__extra_size; + uint32_t cert_subject_data__array__nelements; + SpiceMsgMainMigrationBegin *out; + uint32_t i; + + { /* host_data */ + uint32_t host_data__value; + uint32_t host_data__array__nw_size; + uint32_t host_data__array__mem_size; + uint32_t host_size__value; + pos = (start + 8); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + host_data__value = read_uint32(pos); + if (SPICE_UNLIKELY(host_data__value == 0)) { + goto error; + } + if (SPICE_UNLIKELY(message_start + host_data__value >= message_end)) { + goto error; + } + pos = start + 4; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + host_size__value = read_uint32(pos); + host_data__array__nelements = host_size__value; + + host_data__array__nw_size = host_data__array__nelements; + host_data__array__mem_size = sizeof(uint8_t) * host_data__array__nelements; + if (SPICE_UNLIKELY(message_start + host_data__value + host_data__array__nw_size > message_end)) { + goto error; + } + host_data__extra_size = host_data__array__mem_size + /* for alignment */ 3; + } + + { /* cert_subject_data */ + uint32_t cert_subject_data__value; + uint32_t cert_subject_data__array__nw_size; + uint32_t cert_subject_data__array__mem_size; + uint32_t cert_subject_size__value; + pos = (start + 16); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + cert_subject_data__value = read_uint32(pos); + if (SPICE_UNLIKELY(message_start + cert_subject_data__value >= message_end)) { + goto error; + } + pos = start + 12; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + cert_subject_size__value = read_uint32(pos); + cert_subject_data__array__nelements = cert_subject_size__value; + + cert_subject_data__array__nw_size = cert_subject_data__array__nelements; + cert_subject_data__array__mem_size = sizeof(uint8_t) * cert_subject_data__array__nelements; + if (SPICE_UNLIKELY(message_start + cert_subject_data__value + cert_subject_data__array__nw_size > message_end)) { + goto error; + } + cert_subject_data__extra_size = cert_subject_data__array__mem_size + /* for alignment */ 3; + } + + nw_size = 20; + mem_size = sizeof(SpiceMsgMainMigrationBegin) + host_data__extra_size + cert_subject_data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainMigrationBegin); + in = start; + + out = (SpiceMsgMainMigrationBegin *)data; + + out->port = consume_uint16(&in); + out->sport = consume_uint16(&in); + out->host_size = consume_uint32(&in); + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_array_uint8; + ptr_info[n_ptr].dest = (void **)&out->host_data; + ptr_info[n_ptr].nelements = host_data__array__nelements; + n_ptr++; + out->cert_subject_size = consume_uint32(&in); + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_array_uint8; + ptr_info[n_ptr].dest = (void **)&out->cert_subject_data; + ptr_info[n_ptr].nelements = cert_subject_data__array__nelements; + n_ptr++; + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_SpiceMsgEmpty(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + + nw_size = 0; + mem_size = sizeof(SpiceMsgEmpty); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgEmpty); + in = start; + + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgMainInit *out; + + nw_size = 32; + mem_size = sizeof(SpiceMsgMainInit); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainInit); + in = start; + + out = (SpiceMsgMainInit *)data; + + out->session_id = consume_uint32(&in); + out->display_channels_hint = consume_uint32(&in); + out->supported_mouse_modes = consume_uint32(&in); + out->current_mouse_mode = consume_uint32(&in); + out->agent_connected = consume_uint32(&in); + out->agent_tokens = consume_uint32(&in); + out->multi_media_time = consume_uint32(&in); + out->ram_hint = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_channels_list(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t channels__nw_size, channels__mem_size; + uint32_t channels__nelements; + SpiceMsgChannels *out; + uint32_t i; + + { /* channels */ + uint32_t num_of_channels__value; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_of_channels__value = read_uint32(pos); + channels__nelements = num_of_channels__value; + + channels__nw_size = (2) * channels__nelements; + channels__mem_size = sizeof(SpiceChannelId) * channels__nelements; + } + + nw_size = 4 + channels__nw_size; + mem_size = sizeof(SpiceMsgChannels) + channels__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgChannels); + in = start; + + out = (SpiceMsgChannels *)data; + + out->num_of_channels = consume_uint32(&in); + for (i = 0; i < channels__nelements; i++) { + SpiceChannelId *out2; + out2 = (SpiceChannelId *)end; + end += sizeof(SpiceChannelId); + + out2->type = consume_uint8(&in); + out2->id = consume_uint8(&in); + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_mouse_mode(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgMainMouseMode *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgMainMouseMode); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainMouseMode); + in = start; + + out = (SpiceMsgMainMouseMode *)data; + + out->supported_modes = consume_uint16(&in); + out->current_mode = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_multi_media_time(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgMainMultiMediaTime *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgMainMultiMediaTime); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainMultiMediaTime); + in = start; + + out = (SpiceMsgMainMultiMediaTime *)data; + + out->time = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_agent_disconnected(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgMainAgentDisconnect *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgMainAgentDisconnect); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainAgentDisconnect); + in = start; + + out = (SpiceMsgMainAgentDisconnect *)data; + + out->error_code = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_agent_token(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgMainAgentTokens *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgMainAgentTokens); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainAgentTokens); + in = start; + + out = (SpiceMsgMainAgentTokens *)data; + + out->num_tokens = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_migrate_switch_host(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[2]; + size_t host_data__extra_size; + uint32_t host_data__array__nelements; + size_t cert_subject_data__extra_size; + uint32_t cert_subject_data__array__nelements; + SpiceMsgMainMigrationSwitchHost *out; + uint32_t i; + + { /* host_data */ + uint32_t host_data__value; + uint32_t host_data__array__nw_size; + uint32_t host_data__array__mem_size; + uint32_t host_size__value; + pos = (start + 8); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + host_data__value = read_uint32(pos); + if (SPICE_UNLIKELY(message_start + host_data__value >= message_end)) { + goto error; + } + pos = start + 4; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + host_size__value = read_uint32(pos); + host_data__array__nelements = host_size__value; + + host_data__array__nw_size = host_data__array__nelements; + host_data__array__mem_size = sizeof(uint8_t) * host_data__array__nelements; + if (SPICE_UNLIKELY(message_start + host_data__value + host_data__array__nw_size > message_end)) { + goto error; + } + host_data__extra_size = host_data__array__mem_size + /* for alignment */ 3; + } + + { /* cert_subject_data */ + uint32_t cert_subject_data__value; + uint32_t cert_subject_data__array__nw_size; + uint32_t cert_subject_data__array__mem_size; + uint32_t cert_subject_size__value; + pos = (start + 16); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + cert_subject_data__value = read_uint32(pos); + if (SPICE_UNLIKELY(message_start + cert_subject_data__value >= message_end)) { + goto error; + } + pos = start + 12; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + cert_subject_size__value = read_uint32(pos); + cert_subject_data__array__nelements = cert_subject_size__value; + + cert_subject_data__array__nw_size = cert_subject_data__array__nelements; + cert_subject_data__array__mem_size = sizeof(uint8_t) * cert_subject_data__array__nelements; + if (SPICE_UNLIKELY(message_start + cert_subject_data__value + cert_subject_data__array__nw_size > message_end)) { + goto error; + } + cert_subject_data__extra_size = cert_subject_data__array__mem_size + /* for alignment */ 3; + } + + nw_size = 20; + mem_size = sizeof(SpiceMsgMainMigrationSwitchHost) + host_data__extra_size + cert_subject_data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainMigrationSwitchHost); + in = start; + + out = (SpiceMsgMainMigrationSwitchHost *)data; + + out->port = consume_uint16(&in); + out->sport = consume_uint16(&in); + out->host_size = consume_uint32(&in); + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_array_uint8; + ptr_info[n_ptr].dest = (void **)&out->host_data; + ptr_info[n_ptr].nelements = host_data__array__nelements; + n_ptr++; + out->cert_subject_size = consume_uint32(&in); + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_array_uint8; + ptr_info[n_ptr].dest = (void **)&out->cert_subject_data; + ptr_info[n_ptr].nelements = cert_subject_data__array__nelements; + n_ptr++; + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_name(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t name__nw_size, name__mem_size; + uint32_t name__nelements; + SpiceMsgMainName *out; + + { /* name */ + uint32_t name_len__value; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + name_len__value = read_uint32(pos); + name__nelements = name_len__value; + + name__nw_size = name__nelements; + name__mem_size = sizeof(uint8_t) * name__nelements; + } + + nw_size = 4 + name__nw_size; + mem_size = sizeof(SpiceMsgMainName) + name__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainName); + in = start; + + out = (SpiceMsgMainName *)data; + + out->name_len = consume_uint32(&in); + memcpy(out->name, in, name__nelements); + in += name__nelements; + end += name__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_main_uuid(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgMainUuid *out; + uint32_t uuid__nelements; + + nw_size = 16; + mem_size = sizeof(SpiceMsgMainUuid); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgMainUuid); + in = start; + + out = (SpiceMsgMainUuid *)data; + + uuid__nelements = 16; + memcpy(out->uuid, in, uuid__nelements); + in += uuid__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_MainChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[8] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify, + parse_SpiceMsgData + }; + static parse_msg_func_t funcs2[14] = { + parse_msg_main_migrate_begin, + parse_SpiceMsgEmpty, + parse_msg_main_init, + parse_msg_main_channels_list, + parse_msg_main_mouse_mode, + parse_msg_main_multi_media_time, + parse_SpiceMsgEmpty, + parse_msg_main_agent_disconnected, + parse_SpiceMsgData, + parse_msg_main_agent_token, + parse_msg_main_migrate_switch_host, + parse_SpiceMsgEmpty, + parse_msg_main_name, + parse_msg_main_uuid + }; + if (message_type >= 1 && message_type < 9) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 115) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msg_display_mode(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgDisplayMode *out; + + nw_size = 12; + mem_size = sizeof(SpiceMsgDisplayMode); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayMode); + in = start; + + out = (SpiceMsgDisplayMode *)data; + + out->x_res = consume_uint32(&in); + out->y_res = consume_uint32(&in); + out->bits = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_struct_SpiceClipRects(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) +{ + uint8_t *in = message_start + this_ptr_info->offset; + uint8_t *end; + SpiceClipRects *out; + uint32_t rects__nelements; + uint32_t i; + + end = struct_data + sizeof(SpiceClipRects); + out = (SpiceClipRects *)struct_data; + + out->num_rects = consume_uint32(&in); + rects__nelements = out->num_rects; + for (i = 0; i < rects__nelements; i++) { + SpiceRect *out2; + out2 = (SpiceRect *)end; + end += sizeof(SpiceRect); + + out2->top = consume_int32(&in); + out2->left = consume_int32(&in); + out2->bottom = consume_int32(&in); + out2->right = consume_int32(&in); + } + return end; +} + +static uint8_t * parse_msg_display_copy_bits(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[1]; + size_t base__nw_size, base__extra_size; + uint32_t rects__saved_size = 0; + SpiceMsgDisplayCopyBits *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__nw_size, clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start4 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + base__nw_size = 20 + clip__nw_size; + base__extra_size = clip__extra_size; + } + + nw_size = 8 + base__nw_size; + mem_size = sizeof(SpiceMsgDisplayCopyBits) + base__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayCopyBits); + in = start; + + out = (SpiceMsgDisplayCopyBits *)data; + + /* base */ { + out->base.surface_id = consume_uint32(&in); + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint8(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + } + /* src_pos */ { + out->src_pos.x = consume_int32(&in); + out->src_pos.y = consume_int32(&in); + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_inval_list(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t resources__nw_size, resources__mem_size; + uint32_t resources__nelements; + SpiceResourceList *out; + uint32_t i; + + { /* resources */ + uint16_t count__value; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + count__value = read_uint16(pos); + resources__nelements = count__value; + + resources__nw_size = (9) * resources__nelements; + resources__mem_size = sizeof(SpiceResourceID) * resources__nelements; + } + + nw_size = 2 + resources__nw_size; + mem_size = sizeof(SpiceResourceList) + resources__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceResourceList); + in = start; + + out = (SpiceResourceList *)data; + + out->count = consume_uint16(&in); + for (i = 0; i < resources__nelements; i++) { + SpiceResourceID *out2; + out2 = (SpiceResourceID *)end; + end += sizeof(SpiceResourceID); + + out2->type = consume_uint8(&in); + out2->id = consume_uint64(&in); + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_inval_all_pixmaps(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t wait_list__nw_size, wait_list__mem_size; + uint32_t wait_list__nelements; + SpiceMsgWaitForChannels *out; + uint32_t i; + + { /* wait_list */ + uint8_t wait_count__value; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + wait_count__value = read_uint8(pos); + wait_list__nelements = wait_count__value; + + wait_list__nw_size = (10) * wait_list__nelements; + wait_list__mem_size = sizeof(SpiceWaitForChannel) * wait_list__nelements; + } + + nw_size = 1 + wait_list__nw_size; + mem_size = sizeof(SpiceMsgWaitForChannels) + wait_list__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgWaitForChannels); + in = start; + + out = (SpiceMsgWaitForChannels *)data; + + out->wait_count = consume_uint8(&in); + for (i = 0; i < wait_list__nelements; i++) { + SpiceWaitForChannel *out2; + out2 = (SpiceWaitForChannel *)end; + end += sizeof(SpiceWaitForChannel); + + out2->channel_type = consume_uint8(&in); + out2->channel_id = consume_uint8(&in); + out2->message_serial = consume_uint64(&in); + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_inval_palette(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgDisplayInvalOne *out; + + nw_size = 8; + mem_size = sizeof(SpiceMsgDisplayInvalOne); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayInvalOne); + in = start; + + out = (SpiceMsgDisplayInvalOne *)data; + + out->id = consume_uint64(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_stream_create(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[1]; + size_t clip__nw_size, clip__extra_size; + uint32_t rects__saved_size = 0; + SpiceMsgDisplayStreamCreate *out; + uint32_t i; + + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 50); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + nw_size = 50 + clip__nw_size; + mem_size = sizeof(SpiceMsgDisplayStreamCreate) + clip__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayStreamCreate); + in = start; + + out = (SpiceMsgDisplayStreamCreate *)data; + + out->surface_id = consume_uint32(&in); + out->id = consume_uint32(&in); + out->flags = consume_uint8(&in); + out->codec_type = consume_uint8(&in); + out->stamp = consume_uint64(&in); + out->stream_width = consume_uint32(&in); + out->stream_height = consume_uint32(&in); + out->src_width = consume_uint32(&in); + out->src_height = consume_uint32(&in); + /* dest */ { + out->dest.top = consume_int32(&in); + out->dest.left = consume_int32(&in); + out->dest.bottom = consume_int32(&in); + out->dest.right = consume_int32(&in); + } + /* clip */ { + out->clip.type = consume_uint8(&in); + if (out->clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_stream_data(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t data__nw_size, data__mem_size; + uint32_t data__nelements; + SpiceMsgDisplayStreamData *out; + + { /* data */ + uint32_t data_size__value; + pos = start + 8; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + data_size__value = read_uint32(pos); + data__nelements = data_size__value; + + data__nw_size = data__nelements; + data__mem_size = sizeof(uint8_t) * data__nelements; + } + + nw_size = 12 + data__nw_size; + mem_size = sizeof(SpiceMsgDisplayStreamData) + data__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayStreamData); + in = start; + + out = (SpiceMsgDisplayStreamData *)data; + + out->id = consume_uint32(&in); + out->multi_media_time = consume_uint32(&in); + out->data_size = consume_uint32(&in); + memcpy(out->data, in, data__nelements); + in += data__nelements; + end += data__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_stream_clip(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[1]; + size_t clip__nw_size, clip__extra_size; + uint32_t rects__saved_size = 0; + SpiceMsgDisplayStreamClip *out; + uint32_t i; + + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 4); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + nw_size = 4 + clip__nw_size; + mem_size = sizeof(SpiceMsgDisplayStreamClip) + clip__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayStreamClip); + in = start; + + out = (SpiceMsgDisplayStreamClip *)data; + + out->id = consume_uint32(&in); + /* clip */ { + out->clip.type = consume_uint8(&in); + if (out->clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_stream_destroy(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgDisplayStreamDestroy *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgDisplayStreamDestroy); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayStreamDestroy); + in = start; + + out = (SpiceMsgDisplayStreamDestroy *)data; + + out->id = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static intptr_t validate_SpicePalette(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) +{ + uint8_t *start = message_start + offset; + SPICE_GNUC_UNUSED uint8_t *pos; + size_t mem_size, nw_size; + size_t ents__nw_size, ents__mem_size; + uint32_t ents__nelements; + + if (offset == 0) { + return 0; + } + + if (SPICE_UNLIKELY(start >= message_end)) { + goto error; + } + + { /* ents */ + uint16_t num_ents__value; + pos = start + 8; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + num_ents__value = read_uint16(pos); + ents__nelements = num_ents__value; + + ents__nw_size = (4) * ents__nelements; + ents__mem_size = sizeof(uint32_t) * ents__nelements; + } + + nw_size = 10 + ents__nw_size; + mem_size = sizeof(SpicePalette) + ents__mem_size; + + /* Check if struct fits in reported side */ + if (SPICE_UNLIKELY(start + nw_size > message_end)) { + goto error; + } + return mem_size; + + error: + return -1; +} + +static intptr_t validate_SpiceImage(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) +{ + uint8_t *start = message_start + offset; + SPICE_GNUC_UNUSED uint8_t *pos; + size_t mem_size, nw_size; + SPICE_GNUC_UNUSED intptr_t ptr_size; + size_t u__nw_size, u__extra_size; + uint8_t descriptor_type__value; + + if (offset == 0) { + return 0; + } + + if (SPICE_UNLIKELY(start >= message_end)) { + goto error; + } + + { /* u */ + pos = start + 8; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + descriptor_type__value = read_uint8(pos); + if (descriptor_type__value == SPICE_IMAGE_TYPE_BITMAP) { + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); + size_t pal__nw_size, pal__extra_size; + uint8_t flags__value; + size_t data__nw_size, data__extra_size; + uint32_t data__nelements; + { /* pal */ + pos = start2 + 1; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + flags__value = read_uint8(pos); + if ((flags__value & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { + pal__nw_size = 8; + pal__extra_size = 0; + } else if (1) { + uint32_t pal_palette__value; + pal__nw_size = 4; + pos = (start2 + 14); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + pal_palette__value = read_uint32(pos); + ptr_size = validate_SpicePalette(message_start, message_end, pal_palette__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pal__extra_size = ptr_size + /* for alignment */ 3; + } else { + pal__nw_size = 0; + pal__extra_size = 0; + } + + } + + { /* data */ + uint32_t stride__value; + uint32_t y__value; + pos = start2 + 10; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + stride__value = read_uint32(pos); + pos = start2 + 6; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + y__value = read_uint32(pos); + data__nelements = stride__value * y__value; + + data__nw_size = data__nelements; + data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); + } + + u__nw_size = 14 + pal__nw_size + data__nw_size; + u__extra_size = pal__extra_size + data__extra_size; + } else if (descriptor_type__value == SPICE_IMAGE_TYPE_QUIC) { + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); + size_t data__nw_size, data__extra_size; + uint32_t data__nelements; + { /* data */ + uint32_t data_size__value; + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + data_size__value = read_uint32(pos); + data__nelements = data_size__value; + + data__nw_size = data__nelements; + data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); + } + + u__nw_size = 4 + data__nw_size; + u__extra_size = data__extra_size; + } else if (descriptor_type__value == SPICE_IMAGE_TYPE_LZ_RGB || descriptor_type__value == SPICE_IMAGE_TYPE_GLZ_RGB) { + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); + size_t data__nw_size, data__extra_size; + uint32_t data__nelements; + { /* data */ + uint32_t data_size__value; + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + data_size__value = read_uint32(pos); + data__nelements = data_size__value; + + data__nw_size = data__nelements; + data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); + } + + u__nw_size = 4 + data__nw_size; + u__extra_size = data__extra_size; + } else if (descriptor_type__value == SPICE_IMAGE_TYPE_JPEG) { + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); + size_t data__nw_size, data__extra_size; + uint32_t data__nelements; + { /* data */ + uint32_t data_size__value; + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + data_size__value = read_uint32(pos); + data__nelements = data_size__value; + + data__nw_size = data__nelements; + data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); + } + + u__nw_size = 4 + data__nw_size; + u__extra_size = data__extra_size; + } else if (descriptor_type__value == SPICE_IMAGE_TYPE_LZ_PLT) { + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); + size_t pal__nw_size, pal__extra_size; + uint8_t flags__value; + size_t data__nw_size, data__extra_size; + uint32_t data__nelements; + { /* pal */ + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + flags__value = read_uint8(pos); + if ((flags__value & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { + pal__nw_size = 8; + pal__extra_size = 0; + } else if (1) { + uint32_t pal_palette__value; + pal__nw_size = 4; + pos = (start2 + 5); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + pal_palette__value = read_uint32(pos); + if (SPICE_UNLIKELY(pal_palette__value == 0)) { + goto error; + } + ptr_size = validate_SpicePalette(message_start, message_end, pal_palette__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pal__extra_size = ptr_size + /* for alignment */ 3; + } else { + pal__nw_size = 0; + pal__extra_size = 0; + } + + } + + { /* data */ + uint32_t data_size__value; + pos = start2 + 1; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + data_size__value = read_uint32(pos); + data__nelements = data_size__value; + + data__nw_size = data__nelements; + data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); + } + + u__nw_size = 5 + pal__nw_size + data__nw_size; + u__extra_size = pal__extra_size + data__extra_size; + } else if (descriptor_type__value == SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB) { + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); + size_t data__nw_size, data__extra_size; + uint32_t data__nelements; + { /* data */ + uint32_t data_size__value; + pos = start2 + 4; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + data_size__value = read_uint32(pos); + data__nelements = data_size__value; + + data__nw_size = data__nelements; + data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); + } + + u__nw_size = 8 + data__nw_size; + u__extra_size = data__extra_size; + } else if (descriptor_type__value == SPICE_IMAGE_TYPE_JPEG_ALPHA) { + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); + size_t data__nw_size, data__extra_size; + uint32_t data__nelements; + { /* data */ + uint32_t data_size__value; + pos = start2 + 5; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + data_size__value = read_uint32(pos); + data__nelements = data_size__value; + + data__nw_size = data__nelements; + data__extra_size = sizeof(SpiceChunks) + sizeof(SpiceChunk); + } + + u__nw_size = 9 + data__nw_size; + u__extra_size = data__extra_size; + } else if (descriptor_type__value == SPICE_IMAGE_TYPE_SURFACE) { + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 18); + u__nw_size = 4; + u__extra_size = 0; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + nw_size = 18 + u__nw_size; + mem_size = sizeof(SpiceImage) + u__extra_size; + + /* Check if struct fits in reported side */ + if (SPICE_UNLIKELY(start + nw_size > message_end)) { + goto error; + } + return mem_size; + + error: + return -1; +} + +static uint8_t * parse_struct_SpicePalette(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) +{ + uint8_t *in = message_start + this_ptr_info->offset; + uint8_t *end; + SpicePalette *out; + uint32_t ents__nelements; + uint32_t i; + + end = struct_data + sizeof(SpicePalette); + out = (SpicePalette *)struct_data; + + out->unique = consume_uint64(&in); + out->num_ents = consume_uint16(&in); + ents__nelements = out->num_ents; + for (i = 0; i < ents__nelements; i++) { + out->ents[i] = consume_uint32(&in); + end += sizeof(uint32_t); + } + return end; +} + +static uint8_t * parse_struct_SpiceImage(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) +{ + uint8_t *in = message_start + this_ptr_info->offset; + uint8_t *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[1]; + SpiceImage *out; + uint32_t i; + + end = struct_data + sizeof(SpiceImage); + out = (SpiceImage *)struct_data; + + /* descriptor */ { + out->descriptor.id = consume_uint64(&in); + out->descriptor.type = consume_uint8(&in); + out->descriptor.flags = consume_uint8(&in); + out->descriptor.width = consume_uint32(&in); + out->descriptor.height = consume_uint32(&in); + } + if (out->descriptor.type == SPICE_IMAGE_TYPE_BITMAP) { + uint32_t data__nelements; + SpiceChunks *chunks; + out->u.bitmap.format = consume_uint8(&in); + out->u.bitmap.flags = consume_uint8(&in); + out->u.bitmap.x = consume_uint32(&in); + out->u.bitmap.y = consume_uint32(&in); + out->u.bitmap.stride = consume_uint32(&in); + if ((out->u.bitmap.flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { + out->u.bitmap.palette_id = consume_uint64(&in); + } else if (1) { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpicePalette; + ptr_info[n_ptr].dest = (void **)&out->u.bitmap.palette; + n_ptr++; + } + data__nelements = out->u.bitmap.stride * out->u.bitmap.y; + /* use array as chunk */ + chunks = (SpiceChunks *)end; + end += sizeof(SpiceChunks) + sizeof(SpiceChunk); + out->u.bitmap.data = chunks; + chunks->data_size = data__nelements; + chunks->flags = 0; + chunks->num_chunks = 1; + chunks->chunk[0].len = data__nelements; + chunks->chunk[0].data = in; + in += data__nelements; + } else if (out->descriptor.type == SPICE_IMAGE_TYPE_QUIC) { + uint32_t data__nelements; + SpiceChunks *chunks; + out->u.quic.data_size = consume_uint32(&in); + data__nelements = out->u.quic.data_size; + /* use array as chunk */ + chunks = (SpiceChunks *)end; + end += sizeof(SpiceChunks) + sizeof(SpiceChunk); + out->u.quic.data = chunks; + chunks->data_size = data__nelements; + chunks->flags = 0; + chunks->num_chunks = 1; + chunks->chunk[0].len = data__nelements; + chunks->chunk[0].data = in; + in += data__nelements; + } else if (out->descriptor.type == SPICE_IMAGE_TYPE_LZ_RGB || out->descriptor.type == SPICE_IMAGE_TYPE_GLZ_RGB) { + uint32_t data__nelements; + SpiceChunks *chunks; + out->u.lz_rgb.data_size = consume_uint32(&in); + data__nelements = out->u.lz_rgb.data_size; + /* use array as chunk */ + chunks = (SpiceChunks *)end; + end += sizeof(SpiceChunks) + sizeof(SpiceChunk); + out->u.lz_rgb.data = chunks; + chunks->data_size = data__nelements; + chunks->flags = 0; + chunks->num_chunks = 1; + chunks->chunk[0].len = data__nelements; + chunks->chunk[0].data = in; + in += data__nelements; + } else if (out->descriptor.type == SPICE_IMAGE_TYPE_JPEG) { + uint32_t data__nelements; + SpiceChunks *chunks; + out->u.jpeg.data_size = consume_uint32(&in); + data__nelements = out->u.jpeg.data_size; + /* use array as chunk */ + chunks = (SpiceChunks *)end; + end += sizeof(SpiceChunks) + sizeof(SpiceChunk); + out->u.jpeg.data = chunks; + chunks->data_size = data__nelements; + chunks->flags = 0; + chunks->num_chunks = 1; + chunks->chunk[0].len = data__nelements; + chunks->chunk[0].data = in; + in += data__nelements; + } else if (out->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) { + uint32_t data__nelements; + SpiceChunks *chunks; + out->u.lz_plt.flags = consume_uint8(&in); + out->u.lz_plt.data_size = consume_uint32(&in); + if ((out->u.lz_plt.flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { + out->u.lz_plt.palette_id = consume_uint64(&in); + } else if (1) { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpicePalette; + ptr_info[n_ptr].dest = (void **)&out->u.lz_plt.palette; + n_ptr++; + } + data__nelements = out->u.lz_plt.data_size; + /* use array as chunk */ + chunks = (SpiceChunks *)end; + end += sizeof(SpiceChunks) + sizeof(SpiceChunk); + out->u.lz_plt.data = chunks; + chunks->data_size = data__nelements; + chunks->flags = 0; + chunks->num_chunks = 1; + chunks->chunk[0].len = data__nelements; + chunks->chunk[0].data = in; + in += data__nelements; + } else if (out->descriptor.type == SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB) { + uint32_t data__nelements; + SpiceChunks *chunks; + out->u.zlib_glz.glz_data_size = consume_uint32(&in); + out->u.zlib_glz.data_size = consume_uint32(&in); + data__nelements = out->u.zlib_glz.data_size; + /* use array as chunk */ + chunks = (SpiceChunks *)end; + end += sizeof(SpiceChunks) + sizeof(SpiceChunk); + out->u.zlib_glz.data = chunks; + chunks->data_size = data__nelements; + chunks->flags = 0; + chunks->num_chunks = 1; + chunks->chunk[0].len = data__nelements; + chunks->chunk[0].data = in; + in += data__nelements; + } else if (out->descriptor.type == SPICE_IMAGE_TYPE_JPEG_ALPHA) { + uint32_t data__nelements; + SpiceChunks *chunks; + out->u.jpeg_alpha.flags = consume_uint8(&in); + out->u.jpeg_alpha.jpeg_size = consume_uint32(&in); + out->u.jpeg_alpha.data_size = consume_uint32(&in); + data__nelements = out->u.jpeg_alpha.data_size; + /* use array as chunk */ + chunks = (SpiceChunks *)end; + end += sizeof(SpiceChunks) + sizeof(SpiceChunk); + out->u.jpeg_alpha.data = chunks; + chunks->data_size = data__nelements; + chunks->flags = 0; + chunks->num_chunks = 1; + chunks->chunk[0].len = data__nelements; + chunks->chunk[0].data = in; + in += data__nelements; + } else if (out->descriptor.type == SPICE_IMAGE_TYPE_SURFACE) { + out->u.surface.surface_id = consume_uint32(&in); + } + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + return end; + + error: + return NULL; +} + +static uint8_t * parse_msg_display_draw_fill(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[3]; + size_t base__nw_size, base__extra_size; + uint32_t rects__saved_size = 0; + size_t data__nw_size, data__extra_size; + SpiceMsgDisplayDrawFill *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__nw_size, clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start4 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + base__nw_size = 20 + clip__nw_size; + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); + size_t brush__nw_size, brush__extra_size; + size_t mask__extra_size; + { /* brush */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_BRUSH_TYPE_SOLID) { + u__nw_size = 4; + u__extra_size = 0; + } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t pat__extra_size; + { /* pat */ + uint32_t pat__value; + pos = (start4 + 0); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + pat__value = read_uint32(pos); + if (SPICE_UNLIKELY(pat__value == 0)) { + goto error; + } + ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pat__extra_size = ptr_size + /* for alignment */ 3; + } + + u__nw_size = 12; + u__extra_size = pat__extra_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + brush__nw_size = 1 + u__nw_size; + brush__extra_size = u__extra_size; + } + + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 2 + brush__nw_size); + size_t bitmap__extra_size; + { /* bitmap */ + uint32_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + bitmap__value = read_uint32(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__nw_size = 15 + brush__nw_size; + data__extra_size = brush__extra_size + mask__extra_size; + } + + nw_size = 0 + base__nw_size + data__nw_size; + mem_size = sizeof(SpiceMsgDisplayDrawFill) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawFill); + in = start; + + out = (SpiceMsgDisplayDrawFill *)data; + + /* base */ { + out->base.surface_id = consume_uint32(&in); + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint8(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + } + /* data */ { + /* brush */ { + out->data.brush.type = consume_uint8(&in); + if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { + out->data.brush.u.color = consume_uint32(&in); + } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; + n_ptr++; + /* pos */ { + out->data.brush.u.pattern.pos.x = consume_int32(&in); + out->data.brush.u.pattern.pos.y = consume_int32(&in); + } + } + } + out->data.rop_descriptor = consume_uint16(&in); + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_opaque(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[4]; + size_t base__nw_size, base__extra_size; + uint32_t rects__saved_size = 0; + size_t data__nw_size, data__extra_size; + SpiceMsgDisplayDrawOpaque *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__nw_size, clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start4 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + base__nw_size = 20 + clip__nw_size; + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); + size_t src_bitmap__extra_size; + size_t brush__nw_size, brush__extra_size; + size_t mask__extra_size; + { /* src_bitmap */ + uint32_t src_bitmap__value; + pos = (start2 + 0); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + src_bitmap__value = read_uint32(pos); + ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + src_bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + { /* brush */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_BRUSH_TYPE_SOLID) { + u__nw_size = 4; + u__extra_size = 0; + } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t pat__extra_size; + { /* pat */ + uint32_t pat__value; + pos = (start4 + 0); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + pat__value = read_uint32(pos); + if (SPICE_UNLIKELY(pat__value == 0)) { + goto error; + } + ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pat__extra_size = ptr_size + /* for alignment */ 3; + } + + u__nw_size = 12; + u__extra_size = pat__extra_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + brush__nw_size = 1 + u__nw_size; + brush__extra_size = u__extra_size; + } + + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 23 + brush__nw_size); + size_t bitmap__extra_size; + { /* bitmap */ + uint32_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + bitmap__value = read_uint32(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__nw_size = 36 + brush__nw_size; + data__extra_size = src_bitmap__extra_size + brush__extra_size + mask__extra_size; + } + + nw_size = 0 + base__nw_size + data__nw_size; + mem_size = sizeof(SpiceMsgDisplayDrawOpaque) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawOpaque); + in = start; + + out = (SpiceMsgDisplayDrawOpaque *)data; + + /* base */ { + out->base.surface_id = consume_uint32(&in); + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint8(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + } + /* data */ { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; + n_ptr++; + /* src_area */ { + out->data.src_area.top = consume_int32(&in); + out->data.src_area.left = consume_int32(&in); + out->data.src_area.bottom = consume_int32(&in); + out->data.src_area.right = consume_int32(&in); + } + /* brush */ { + out->data.brush.type = consume_uint8(&in); + if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { + out->data.brush.u.color = consume_uint32(&in); + } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; + n_ptr++; + /* pos */ { + out->data.brush.u.pattern.pos.x = consume_int32(&in); + out->data.brush.u.pattern.pos.y = consume_int32(&in); + } + } + } + out->data.rop_descriptor = consume_uint16(&in); + out->data.scale_mode = consume_uint8(&in); + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_copy(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[3]; + size_t base__nw_size, base__extra_size; + uint32_t rects__saved_size = 0; + size_t data__extra_size; + SpiceMsgDisplayDrawCopy *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__nw_size, clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start4 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + base__nw_size = 20 + clip__nw_size; + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); + size_t src_bitmap__extra_size; + size_t mask__extra_size; + { /* src_bitmap */ + uint32_t src_bitmap__value; + pos = (start2 + 0); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + src_bitmap__value = read_uint32(pos); + ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + src_bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 23); + size_t bitmap__extra_size; + { /* bitmap */ + uint32_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + bitmap__value = read_uint32(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__extra_size = src_bitmap__extra_size + mask__extra_size; + } + + nw_size = 36 + base__nw_size; + mem_size = sizeof(SpiceMsgDisplayDrawCopy) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawCopy); + in = start; + + out = (SpiceMsgDisplayDrawCopy *)data; + + /* base */ { + out->base.surface_id = consume_uint32(&in); + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint8(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + } + /* data */ { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; + n_ptr++; + /* src_area */ { + out->data.src_area.top = consume_int32(&in); + out->data.src_area.left = consume_int32(&in); + out->data.src_area.bottom = consume_int32(&in); + out->data.src_area.right = consume_int32(&in); + } + out->data.rop_descriptor = consume_uint16(&in); + out->data.scale_mode = consume_uint8(&in); + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_blend(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[3]; + size_t base__nw_size, base__extra_size; + uint32_t rects__saved_size = 0; + size_t data__extra_size; + SpiceMsgDisplayDrawBlend *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__nw_size, clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start4 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + base__nw_size = 20 + clip__nw_size; + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); + size_t src_bitmap__extra_size; + size_t mask__extra_size; + { /* src_bitmap */ + uint32_t src_bitmap__value; + pos = (start2 + 0); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + src_bitmap__value = read_uint32(pos); + ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + src_bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 23); + size_t bitmap__extra_size; + { /* bitmap */ + uint32_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + bitmap__value = read_uint32(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__extra_size = src_bitmap__extra_size + mask__extra_size; + } + + nw_size = 36 + base__nw_size; + mem_size = sizeof(SpiceMsgDisplayDrawBlend) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawBlend); + in = start; + + out = (SpiceMsgDisplayDrawBlend *)data; + + /* base */ { + out->base.surface_id = consume_uint32(&in); + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint8(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + } + /* data */ { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; + n_ptr++; + /* src_area */ { + out->data.src_area.top = consume_int32(&in); + out->data.src_area.left = consume_int32(&in); + out->data.src_area.bottom = consume_int32(&in); + out->data.src_area.right = consume_int32(&in); + } + out->data.rop_descriptor = consume_uint16(&in); + out->data.scale_mode = consume_uint8(&in); + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_blackness(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[2]; + size_t base__nw_size, base__extra_size; + uint32_t rects__saved_size = 0; + size_t data__extra_size; + SpiceMsgDisplayDrawBlackness *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__nw_size, clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start4 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + base__nw_size = 20 + clip__nw_size; + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); + size_t mask__extra_size; + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); + size_t bitmap__extra_size; + { /* bitmap */ + uint32_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + bitmap__value = read_uint32(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__extra_size = mask__extra_size; + } + + nw_size = 13 + base__nw_size; + mem_size = sizeof(SpiceMsgDisplayDrawBlackness) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawBlackness); + in = start; + + out = (SpiceMsgDisplayDrawBlackness *)data; + + /* base */ { + out->base.surface_id = consume_uint32(&in); + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint8(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + } + /* data */ { + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_whiteness(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[2]; + size_t base__nw_size, base__extra_size; + uint32_t rects__saved_size = 0; + size_t data__extra_size; + SpiceMsgDisplayDrawWhiteness *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__nw_size, clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start4 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + base__nw_size = 20 + clip__nw_size; + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); + size_t mask__extra_size; + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); + size_t bitmap__extra_size; + { /* bitmap */ + uint32_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + bitmap__value = read_uint32(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__extra_size = mask__extra_size; + } + + nw_size = 13 + base__nw_size; + mem_size = sizeof(SpiceMsgDisplayDrawWhiteness) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawWhiteness); + in = start; + + out = (SpiceMsgDisplayDrawWhiteness *)data; + + /* base */ { + out->base.surface_id = consume_uint32(&in); + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint8(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + } + /* data */ { + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_invers(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[2]; + size_t base__nw_size, base__extra_size; + uint32_t rects__saved_size = 0; + size_t data__extra_size; + SpiceMsgDisplayDrawInvers *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__nw_size, clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start4 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + base__nw_size = 20 + clip__nw_size; + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); + size_t mask__extra_size; + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 0); + size_t bitmap__extra_size; + { /* bitmap */ + uint32_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + bitmap__value = read_uint32(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__extra_size = mask__extra_size; + } + + nw_size = 13 + base__nw_size; + mem_size = sizeof(SpiceMsgDisplayDrawInvers) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawInvers); + in = start; + + out = (SpiceMsgDisplayDrawInvers *)data; + + /* base */ { + out->base.surface_id = consume_uint32(&in); + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint8(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + } + /* data */ { + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_rop3(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[4]; + size_t base__nw_size, base__extra_size; + uint32_t rects__saved_size = 0; + size_t data__nw_size, data__extra_size; + SpiceMsgDisplayDrawRop3 *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__nw_size, clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start4 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + base__nw_size = 20 + clip__nw_size; + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); + size_t src_bitmap__extra_size; + size_t brush__nw_size, brush__extra_size; + size_t mask__extra_size; + { /* src_bitmap */ + uint32_t src_bitmap__value; + pos = (start2 + 0); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + src_bitmap__value = read_uint32(pos); + ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + src_bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + { /* brush */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_BRUSH_TYPE_SOLID) { + u__nw_size = 4; + u__extra_size = 0; + } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t pat__extra_size; + { /* pat */ + uint32_t pat__value; + pos = (start4 + 0); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + pat__value = read_uint32(pos); + if (SPICE_UNLIKELY(pat__value == 0)) { + goto error; + } + ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pat__extra_size = ptr_size + /* for alignment */ 3; + } + + u__nw_size = 12; + u__extra_size = pat__extra_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + brush__nw_size = 1 + u__nw_size; + brush__extra_size = u__extra_size; + } + + { /* mask */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 22 + brush__nw_size); + size_t bitmap__extra_size; + { /* bitmap */ + uint32_t bitmap__value; + pos = (start3 + 9); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + bitmap__value = read_uint32(pos); + ptr_size = validate_SpiceImage(message_start, message_end, bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + mask__extra_size = bitmap__extra_size; + } + + data__nw_size = 35 + brush__nw_size; + data__extra_size = src_bitmap__extra_size + brush__extra_size + mask__extra_size; + } + + nw_size = 0 + base__nw_size + data__nw_size; + mem_size = sizeof(SpiceMsgDisplayDrawRop3) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawRop3); + in = start; + + out = (SpiceMsgDisplayDrawRop3 *)data; + + /* base */ { + out->base.surface_id = consume_uint32(&in); + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint8(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + } + /* data */ { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; + n_ptr++; + /* src_area */ { + out->data.src_area.top = consume_int32(&in); + out->data.src_area.left = consume_int32(&in); + out->data.src_area.bottom = consume_int32(&in); + out->data.src_area.right = consume_int32(&in); + } + /* brush */ { + out->data.brush.type = consume_uint8(&in); + if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { + out->data.brush.u.color = consume_uint32(&in); + } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; + n_ptr++; + /* pos */ { + out->data.brush.u.pattern.pos.x = consume_int32(&in); + out->data.brush.u.pattern.pos.y = consume_int32(&in); + } + } + } + out->data.rop3 = consume_uint8(&in); + out->data.scale_mode = consume_uint8(&in); + /* mask */ { + out->data.mask.flags = consume_uint8(&in); + /* pos */ { + out->data.mask.pos.x = consume_int32(&in); + out->data.mask.pos.y = consume_int32(&in); + } + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.mask.bitmap; + n_ptr++; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static intptr_t validate_SpicePath(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) +{ + uint8_t *start = message_start + offset; + SPICE_GNUC_UNUSED uint8_t *pos; + size_t mem_size, nw_size; + size_t segments__nw_size, segments__mem_size; + uint32_t segments__nelements; + uint32_t i; + + if (offset == 0) { + return 0; + } + + if (SPICE_UNLIKELY(start >= message_end)) { + goto error; + } + + { /* segments */ + uint32_t num_segments__value; + uint8_t *start2 = (start + 4); + uint32_t segments__element__nw_size; + uint32_t segments__element__mem_size; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_segments__value = read_uint32(pos); + segments__nelements = num_segments__value; + + segments__nw_size = 0; + segments__mem_size = 0; + for (i = 0; i < segments__nelements; i++) { + SPICE_GNUC_UNUSED uint8_t *start3 = start2; + size_t points__nw_size, points__mem_size; + uint32_t points__nelements; + { /* points */ + uint32_t count__value; + pos = start3 + 1; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + count__value = read_uint32(pos); + points__nelements = count__value; + + points__nw_size = (8) * points__nelements; + points__mem_size = sizeof(SpicePointFix) * points__nelements; + } + + segments__element__nw_size = 5 + points__nw_size; + segments__element__mem_size = sizeof(SpicePathSeg) + points__mem_size; + segments__nw_size += segments__element__nw_size; + segments__mem_size += sizeof(void *) + SPICE_ALIGN(segments__element__mem_size, 4); + start2 += segments__element__nw_size; + } + } + + nw_size = 4 + segments__nw_size; + mem_size = sizeof(SpicePath) + segments__mem_size; + + /* Check if struct fits in reported side */ + if (SPICE_UNLIKELY(start + nw_size > message_end)) { + goto error; + } + return mem_size; + + error: + return -1; +} + +static uint8_t * parse_struct_SpicePath(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) +{ + uint8_t *in = message_start + this_ptr_info->offset; + uint8_t *end; + SpicePath *out; + uint32_t segments__nelements; + uint32_t i; + void * *ptr_array; + int ptr_array_index; + uint32_t j; + + end = struct_data + sizeof(SpicePath); + out = (SpicePath *)struct_data; + + out->num_segments = consume_uint32(&in); + segments__nelements = out->num_segments; + ptr_array_index = 0; + ptr_array = (void **)out->segments; + end += sizeof(void *) * segments__nelements; + for (i = 0; i < segments__nelements; i++) { + SpicePathSeg *out2; + uint32_t points__nelements; + ptr_array[ptr_array_index++] = end; + out2 = (SpicePathSeg *)end; + end += sizeof(SpicePathSeg); + + out2->flags = consume_uint8(&in); + out2->count = consume_uint32(&in); + points__nelements = out2->count; + for (j = 0; j < points__nelements; j++) { + SpicePointFix *out3; + out3 = (SpicePointFix *)end; + end += sizeof(SpicePointFix); + + out3->x = consume_int32(&in); + out3->y = consume_int32(&in); + } + /* Align ptr_array element to 4 bytes */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + } + return end; +} + +static uint8_t * parse_array_int32(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) +{ + uint8_t *in = message_start + this_ptr_info->offset; + uint8_t *end; + uint32_t i; + + end = struct_data; + for (i = 0; i < this_ptr_info->nelements; i++) { + *(SPICE_FIXED28_4 *)end = consume_int32(&in); + end += sizeof(SPICE_FIXED28_4); + } + return end; +} + +static uint8_t * parse_msg_display_draw_stroke(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[4]; + size_t base__nw_size, base__extra_size; + uint32_t rects__saved_size = 0; + size_t data__nw_size, data__extra_size; + SpiceMsgDisplayDrawStroke *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__nw_size, clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start4 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + base__nw_size = 20 + clip__nw_size; + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); + size_t path__extra_size; + size_t attr__nw_size, attr__extra_size; + size_t brush__nw_size, brush__extra_size; + { /* path */ + uint32_t path__value; + pos = (start2 + 0); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + path__value = read_uint32(pos); + if (SPICE_UNLIKELY(path__value == 0)) { + goto error; + } + ptr_size = validate_SpicePath(message_start, message_end, path__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + path__extra_size = ptr_size + /* for alignment */ 3; + } + + { /* attr */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 4); + size_t u1__nw_size; + uint8_t flags__value; + size_t u2__nw_size, u2__extra_size; + { /* u1 */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + flags__value = read_uint8(pos); + if ((flags__value & SPICE_LINE_FLAGS_STYLED)) { + u1__nw_size = 1; + } else { + u1__nw_size = 0; + } + + } + + { /* u2 */ + uint32_t u2__array__nelements; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + flags__value = read_uint8(pos); + if ((flags__value & SPICE_LINE_FLAGS_STYLED)) { + uint32_t u2_style__value; + uint32_t u2__array__nw_size; + uint32_t u2__array__mem_size; + uint8_t style_nseg__value; + u2__nw_size = 4; + pos = (start3 + 1 + u1__nw_size); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + u2_style__value = read_uint32(pos); + if (SPICE_UNLIKELY(message_start + u2_style__value >= message_end)) { + goto error; + } + pos = start3 + 1; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + style_nseg__value = read_uint8(pos); + u2__array__nelements = style_nseg__value; + + u2__array__nw_size = (4) * u2__array__nelements; + u2__array__mem_size = sizeof(SPICE_FIXED28_4) * u2__array__nelements; + if (SPICE_UNLIKELY(message_start + u2_style__value + u2__array__nw_size > message_end)) { + goto error; + } + u2__extra_size = u2__array__mem_size + /* for alignment */ 3; + } else { + u2__nw_size = 0; + u2__extra_size = 0; + } + + } + + attr__nw_size = 1 + u1__nw_size + u2__nw_size; + attr__extra_size = u2__extra_size; + } + + { /* brush */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 4 + attr__nw_size); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_BRUSH_TYPE_SOLID) { + u__nw_size = 4; + u__extra_size = 0; + } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t pat__extra_size; + { /* pat */ + uint32_t pat__value; + pos = (start4 + 0); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + pat__value = read_uint32(pos); + if (SPICE_UNLIKELY(pat__value == 0)) { + goto error; + } + ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pat__extra_size = ptr_size + /* for alignment */ 3; + } + + u__nw_size = 12; + u__extra_size = pat__extra_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + brush__nw_size = 1 + u__nw_size; + brush__extra_size = u__extra_size; + } + + data__nw_size = 8 + attr__nw_size + brush__nw_size; + data__extra_size = path__extra_size + attr__extra_size + brush__extra_size; + } + + nw_size = 0 + base__nw_size + data__nw_size; + mem_size = sizeof(SpiceMsgDisplayDrawStroke) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawStroke); + in = start; + + out = (SpiceMsgDisplayDrawStroke *)data; + + /* base */ { + out->base.surface_id = consume_uint32(&in); + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint8(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + } + /* data */ { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpicePath; + ptr_info[n_ptr].dest = (void **)&out->data.path; + n_ptr++; + /* attr */ { + out->data.attr.flags = consume_uint8(&in); + if ((out->data.attr.flags & SPICE_LINE_FLAGS_STYLED)) { + out->data.attr.style_nseg = consume_uint8(&in); + } + if ((out->data.attr.flags & SPICE_LINE_FLAGS_STYLED)) { + uint32_t style__array__nelements; + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_array_int32; + ptr_info[n_ptr].dest = (void **)&out->data.attr.style; + style__array__nelements = out->data.attr.style_nseg; + ptr_info[n_ptr].nelements = style__array__nelements; + n_ptr++; + } + } + /* brush */ { + out->data.brush.type = consume_uint8(&in); + if (out->data.brush.type == SPICE_BRUSH_TYPE_SOLID) { + out->data.brush.u.color = consume_uint32(&in); + } else if (out->data.brush.type == SPICE_BRUSH_TYPE_PATTERN) { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.brush.u.pattern.pat; + n_ptr++; + /* pos */ { + out->data.brush.u.pattern.pos.x = consume_int32(&in); + out->data.brush.u.pattern.pos.y = consume_int32(&in); + } + } + } + out->data.fore_mode = consume_uint16(&in); + out->data.back_mode = consume_uint16(&in); + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static intptr_t validate_SpiceString(uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor) +{ + uint8_t *start = message_start + offset; + SPICE_GNUC_UNUSED uint8_t *pos; + size_t mem_size, nw_size; + size_t u__nw_size, u__extra_size; + uint8_t flags__value; + uint32_t i; + + if (offset == 0) { + return 0; + } + + if (SPICE_UNLIKELY(start >= message_end)) { + goto error; + } + + { /* u */ + uint32_t u__mem_size; + uint32_t u__nelements; + pos = start + 2; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + flags__value = read_uint8(pos); + if ((flags__value & SPICE_STRING_FLAGS_RASTER_A1)) { + uint16_t length__value; + uint8_t *start2 = (start + 3); + uint32_t u__element__nw_size; + uint32_t u__element__mem_size; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + length__value = read_uint16(pos); + u__nelements = length__value; + + u__nw_size = 0; + u__mem_size = 0; + for (i = 0; i < u__nelements; i++) { + SPICE_GNUC_UNUSED uint8_t *start3 = start2; + size_t data__nw_size, data__mem_size; + uint32_t data__nelements; + { /* data */ + uint16_t width__value; + uint16_t height__value; + pos = start3 + 16; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + width__value = read_uint16(pos); + pos = start3 + 18; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + height__value = read_uint16(pos); + data__nelements = ((width__value + 7) / 8 ) * height__value; + + data__nw_size = data__nelements; + data__mem_size = sizeof(uint8_t) * data__nelements; + } + + u__element__nw_size = 20 + data__nw_size; + u__element__mem_size = sizeof(SpiceRasterGlyph) + data__mem_size; + u__nw_size += u__element__nw_size; + u__mem_size += sizeof(void *) + SPICE_ALIGN(u__element__mem_size, 4); + start2 += u__element__nw_size; + } + u__extra_size = u__mem_size; + } else if ((flags__value & SPICE_STRING_FLAGS_RASTER_A4)) { + uint16_t length__value; + uint8_t *start2 = (start + 3); + uint32_t u__element__nw_size; + uint32_t u__element__mem_size; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + length__value = read_uint16(pos); + u__nelements = length__value; + + u__nw_size = 0; + u__mem_size = 0; + for (i = 0; i < u__nelements; i++) { + SPICE_GNUC_UNUSED uint8_t *start3 = start2; + size_t data__nw_size, data__mem_size; + uint32_t data__nelements; + { /* data */ + uint16_t width__value; + uint16_t height__value; + pos = start3 + 16; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + width__value = read_uint16(pos); + pos = start3 + 18; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + height__value = read_uint16(pos); + data__nelements = ((4 * width__value + 7) / 8 ) * height__value; + + data__nw_size = data__nelements; + data__mem_size = sizeof(uint8_t) * data__nelements; + } + + u__element__nw_size = 20 + data__nw_size; + u__element__mem_size = sizeof(SpiceRasterGlyph) + data__mem_size; + u__nw_size += u__element__nw_size; + u__mem_size += sizeof(void *) + SPICE_ALIGN(u__element__mem_size, 4); + start2 += u__element__nw_size; + } + u__extra_size = u__mem_size; + } else if ((flags__value & SPICE_STRING_FLAGS_RASTER_A8)) { + uint16_t length__value; + uint8_t *start2 = (start + 3); + uint32_t u__element__nw_size; + uint32_t u__element__mem_size; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + length__value = read_uint16(pos); + u__nelements = length__value; + + u__nw_size = 0; + u__mem_size = 0; + for (i = 0; i < u__nelements; i++) { + SPICE_GNUC_UNUSED uint8_t *start3 = start2; + size_t data__nw_size, data__mem_size; + uint32_t data__nelements; + { /* data */ + uint16_t width__value; + uint16_t height__value; + pos = start3 + 16; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + width__value = read_uint16(pos); + pos = start3 + 18; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + height__value = read_uint16(pos); + data__nelements = width__value * height__value; + + data__nw_size = data__nelements; + data__mem_size = sizeof(uint8_t) * data__nelements; + } + + u__element__nw_size = 20 + data__nw_size; + u__element__mem_size = sizeof(SpiceRasterGlyph) + data__mem_size; + u__nw_size += u__element__nw_size; + u__mem_size += sizeof(void *) + SPICE_ALIGN(u__element__mem_size, 4); + start2 += u__element__nw_size; + } + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + nw_size = 3 + u__nw_size; + mem_size = sizeof(SpiceString) + u__extra_size; + + /* Check if struct fits in reported side */ + if (SPICE_UNLIKELY(start + nw_size > message_end)) { + goto error; + } + return mem_size; + + error: + return -1; +} + +static uint8_t * parse_struct_SpiceString(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor) +{ + uint8_t *in = message_start + this_ptr_info->offset; + uint8_t *end; + SpiceString *out; + uint32_t i; + + end = struct_data + sizeof(SpiceString); + out = (SpiceString *)struct_data; + + out->length = consume_uint16(&in); + out->flags = consume_uint8(&in); + if ((out->flags & SPICE_STRING_FLAGS_RASTER_A1)) { + uint32_t glyphs__nelements; + void * *ptr_array; + int ptr_array_index; + glyphs__nelements = out->length; + ptr_array_index = 0; + ptr_array = (void **)out->glyphs; + end += sizeof(void *) * glyphs__nelements; + for (i = 0; i < glyphs__nelements; i++) { + SpiceRasterGlyph *out2; + uint32_t data__nelements; + ptr_array[ptr_array_index++] = end; + out2 = (SpiceRasterGlyph *)end; + end += sizeof(SpiceRasterGlyph); + + /* render_pos */ { + out2->render_pos.x = consume_int32(&in); + out2->render_pos.y = consume_int32(&in); + } + /* glyph_origin */ { + out2->glyph_origin.x = consume_int32(&in); + out2->glyph_origin.y = consume_int32(&in); + } + out2->width = consume_uint16(&in); + out2->height = consume_uint16(&in); + data__nelements = ((out2->width + 7) / 8 ) * out2->height; + memcpy(out2->data, in, data__nelements); + in += data__nelements; + end += data__nelements; + /* Align ptr_array element to 4 bytes */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + } + } else if ((out->flags & SPICE_STRING_FLAGS_RASTER_A4)) { + uint32_t glyphs__nelements; + void * *ptr_array; + int ptr_array_index; + glyphs__nelements = out->length; + ptr_array_index = 0; + ptr_array = (void **)out->glyphs; + end += sizeof(void *) * glyphs__nelements; + for (i = 0; i < glyphs__nelements; i++) { + SpiceRasterGlyph *out2; + uint32_t data__nelements; + ptr_array[ptr_array_index++] = end; + out2 = (SpiceRasterGlyph *)end; + end += sizeof(SpiceRasterGlyph); + + /* render_pos */ { + out2->render_pos.x = consume_int32(&in); + out2->render_pos.y = consume_int32(&in); + } + /* glyph_origin */ { + out2->glyph_origin.x = consume_int32(&in); + out2->glyph_origin.y = consume_int32(&in); + } + out2->width = consume_uint16(&in); + out2->height = consume_uint16(&in); + data__nelements = ((4 * out2->width + 7) / 8 ) * out2->height; + memcpy(out2->data, in, data__nelements); + in += data__nelements; + end += data__nelements; + /* Align ptr_array element to 4 bytes */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + } + } else if ((out->flags & SPICE_STRING_FLAGS_RASTER_A8)) { + uint32_t glyphs__nelements; + void * *ptr_array; + int ptr_array_index; + glyphs__nelements = out->length; + ptr_array_index = 0; + ptr_array = (void **)out->glyphs; + end += sizeof(void *) * glyphs__nelements; + for (i = 0; i < glyphs__nelements; i++) { + SpiceRasterGlyph *out2; + uint32_t data__nelements; + ptr_array[ptr_array_index++] = end; + out2 = (SpiceRasterGlyph *)end; + end += sizeof(SpiceRasterGlyph); + + /* render_pos */ { + out2->render_pos.x = consume_int32(&in); + out2->render_pos.y = consume_int32(&in); + } + /* glyph_origin */ { + out2->glyph_origin.x = consume_int32(&in); + out2->glyph_origin.y = consume_int32(&in); + } + out2->width = consume_uint16(&in); + out2->height = consume_uint16(&in); + data__nelements = out2->width * out2->height; + memcpy(out2->data, in, data__nelements); + in += data__nelements; + end += data__nelements; + /* Align ptr_array element to 4 bytes */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + } + } + return end; +} + +static uint8_t * parse_msg_display_draw_text(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[4]; + size_t base__nw_size, base__extra_size; + uint32_t rects__saved_size = 0; + size_t data__nw_size, data__extra_size; + SpiceMsgDisplayDrawText *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__nw_size, clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start4 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + base__nw_size = 20 + clip__nw_size; + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); + size_t str__extra_size; + size_t fore_brush__nw_size, fore_brush__extra_size; + size_t back_brush__nw_size, back_brush__extra_size; + { /* str */ + uint32_t str__value; + pos = (start2 + 0); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + str__value = read_uint32(pos); + if (SPICE_UNLIKELY(str__value == 0)) { + goto error; + } + ptr_size = validate_SpiceString(message_start, message_end, str__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + str__extra_size = ptr_size + /* for alignment */ 3; + } + + { /* fore_brush */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_BRUSH_TYPE_SOLID) { + u__nw_size = 4; + u__extra_size = 0; + } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t pat__extra_size; + { /* pat */ + uint32_t pat__value; + pos = (start4 + 0); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + pat__value = read_uint32(pos); + if (SPICE_UNLIKELY(pat__value == 0)) { + goto error; + } + ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pat__extra_size = ptr_size + /* for alignment */ 3; + } + + u__nw_size = 12; + u__extra_size = pat__extra_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + fore_brush__nw_size = 1 + u__nw_size; + fore_brush__extra_size = u__extra_size; + } + + { /* back_brush */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20 + fore_brush__nw_size); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_BRUSH_TYPE_SOLID) { + u__nw_size = 4; + u__extra_size = 0; + } else if (type__value == SPICE_BRUSH_TYPE_PATTERN) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t pat__extra_size; + { /* pat */ + uint32_t pat__value; + pos = (start4 + 0); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + pat__value = read_uint32(pos); + if (SPICE_UNLIKELY(pat__value == 0)) { + goto error; + } + ptr_size = validate_SpiceImage(message_start, message_end, pat__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + pat__extra_size = ptr_size + /* for alignment */ 3; + } + + u__nw_size = 12; + u__extra_size = pat__extra_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + back_brush__nw_size = 1 + u__nw_size; + back_brush__extra_size = u__extra_size; + } + + data__nw_size = 24 + fore_brush__nw_size + back_brush__nw_size; + data__extra_size = str__extra_size + fore_brush__extra_size + back_brush__extra_size; + } + + nw_size = 0 + base__nw_size + data__nw_size; + mem_size = sizeof(SpiceMsgDisplayDrawText) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawText); + in = start; + + out = (SpiceMsgDisplayDrawText *)data; + + /* base */ { + out->base.surface_id = consume_uint32(&in); + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint8(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + } + /* data */ { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceString; + ptr_info[n_ptr].dest = (void **)&out->data.str; + n_ptr++; + /* back_area */ { + out->data.back_area.top = consume_int32(&in); + out->data.back_area.left = consume_int32(&in); + out->data.back_area.bottom = consume_int32(&in); + out->data.back_area.right = consume_int32(&in); + } + /* fore_brush */ { + out->data.fore_brush.type = consume_uint8(&in); + if (out->data.fore_brush.type == SPICE_BRUSH_TYPE_SOLID) { + out->data.fore_brush.u.color = consume_uint32(&in); + } else if (out->data.fore_brush.type == SPICE_BRUSH_TYPE_PATTERN) { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.fore_brush.u.pattern.pat; + n_ptr++; + /* pos */ { + out->data.fore_brush.u.pattern.pos.x = consume_int32(&in); + out->data.fore_brush.u.pattern.pos.y = consume_int32(&in); + } + } + } + /* back_brush */ { + out->data.back_brush.type = consume_uint8(&in); + if (out->data.back_brush.type == SPICE_BRUSH_TYPE_SOLID) { + out->data.back_brush.u.color = consume_uint32(&in); + } else if (out->data.back_brush.type == SPICE_BRUSH_TYPE_PATTERN) { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.back_brush.u.pattern.pat; + n_ptr++; + /* pos */ { + out->data.back_brush.u.pattern.pos.x = consume_int32(&in); + out->data.back_brush.u.pattern.pos.y = consume_int32(&in); + } + } + } + out->data.fore_mode = consume_uint16(&in); + out->data.back_mode = consume_uint16(&in); + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_transparent(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[2]; + size_t base__nw_size, base__extra_size; + uint32_t rects__saved_size = 0; + size_t data__extra_size; + SpiceMsgDisplayDrawTransparent *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__nw_size, clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start4 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + base__nw_size = 20 + clip__nw_size; + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); + size_t src_bitmap__extra_size; + { /* src_bitmap */ + uint32_t src_bitmap__value; + pos = (start2 + 0); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + src_bitmap__value = read_uint32(pos); + ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + src_bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + data__extra_size = src_bitmap__extra_size; + } + + nw_size = 28 + base__nw_size; + mem_size = sizeof(SpiceMsgDisplayDrawTransparent) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawTransparent); + in = start; + + out = (SpiceMsgDisplayDrawTransparent *)data; + + /* base */ { + out->base.surface_id = consume_uint32(&in); + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint8(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + } + /* data */ { + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; + n_ptr++; + /* src_area */ { + out->data.src_area.top = consume_int32(&in); + out->data.src_area.left = consume_int32(&in); + out->data.src_area.bottom = consume_int32(&in); + out->data.src_area.right = consume_int32(&in); + } + out->data.src_color = consume_uint32(&in); + out->data.true_color = consume_uint32(&in); + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_draw_alpha_blend(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[2]; + size_t base__nw_size, base__extra_size; + uint32_t rects__saved_size = 0; + size_t data__extra_size; + SpiceMsgDisplayDrawAlphaBlend *out; + uint32_t i; + + { /* base */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0); + size_t clip__nw_size, clip__extra_size; + { /* clip */ + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 20); + size_t u__nw_size, u__extra_size; + uint8_t type__value; + { /* u */ + uint32_t u__mem_size; + pos = start3 + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + type__value = read_uint8(pos); + if (type__value == SPICE_CLIP_TYPE_RECTS) { + SPICE_GNUC_UNUSED uint8_t *start4 = (start3 + 1); + size_t rects__nw_size, rects__mem_size; + uint32_t rects__nelements; + { /* rects */ + uint32_t num_rects__value; + pos = start4 + 0; + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + num_rects__value = read_uint32(pos); + rects__nelements = num_rects__value; + + rects__nw_size = (16) * rects__nelements; + rects__mem_size = sizeof(SpiceRect) * rects__nelements; + } + + u__nw_size = 4 + rects__nw_size; + u__mem_size = sizeof(SpiceClipRects) + rects__mem_size; + rects__saved_size = u__nw_size; + u__extra_size = u__mem_size; + } else { + u__nw_size = 0; + u__extra_size = 0; + } + + } + + clip__nw_size = 1 + u__nw_size; + clip__extra_size = u__extra_size; + } + + base__nw_size = 20 + clip__nw_size; + base__extra_size = clip__extra_size; + } + + { /* data */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 0 + base__nw_size); + size_t src_bitmap__extra_size; + { /* src_bitmap */ + uint32_t src_bitmap__value; + pos = (start2 + 2); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + src_bitmap__value = read_uint32(pos); + ptr_size = validate_SpiceImage(message_start, message_end, src_bitmap__value, minor); + if (SPICE_UNLIKELY(ptr_size < 0)) { + goto error; + } + src_bitmap__extra_size = ptr_size + /* for alignment */ 3; + } + + data__extra_size = src_bitmap__extra_size; + } + + nw_size = 22 + base__nw_size; + mem_size = sizeof(SpiceMsgDisplayDrawAlphaBlend) + base__extra_size + data__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayDrawAlphaBlend); + in = start; + + out = (SpiceMsgDisplayDrawAlphaBlend *)data; + + /* base */ { + out->base.surface_id = consume_uint32(&in); + /* box */ { + out->base.box.top = consume_int32(&in); + out->base.box.left = consume_int32(&in); + out->base.box.bottom = consume_int32(&in); + out->base.box.right = consume_int32(&in); + } + /* clip */ { + out->base.clip.type = consume_uint8(&in); + if (out->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + ptr_info[n_ptr].offset = in - start; + ptr_info[n_ptr].parse = parse_struct_SpiceClipRects; + ptr_info[n_ptr].dest = (void **)&out->base.clip.rects; + n_ptr++; + in += rects__saved_size; + } + } + } + /* data */ { + out->data.alpha_flags = consume_uint8(&in); + out->data.alpha = consume_uint8(&in); + ptr_info[n_ptr].offset = consume_uint32(&in); + ptr_info[n_ptr].parse = parse_struct_SpiceImage; + ptr_info[n_ptr].dest = (void **)&out->data.src_bitmap; + n_ptr++; + /* src_area */ { + out->data.src_area.top = consume_int32(&in); + out->data.src_area.left = consume_int32(&in); + out->data.src_area.bottom = consume_int32(&in); + out->data.src_area.right = consume_int32(&in); + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_surface_create(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgSurfaceCreate *out; + + nw_size = 20; + mem_size = sizeof(SpiceMsgSurfaceCreate); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgSurfaceCreate); + in = start; + + out = (SpiceMsgSurfaceCreate *)data; + + out->surface_id = consume_uint32(&in); + out->width = consume_uint32(&in); + out->height = consume_uint32(&in); + out->format = consume_uint32(&in); + out->flags = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_display_surface_destroy(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgSurfaceDestroy *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgSurfaceDestroy); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgSurfaceDestroy); + in = start; + + out = (SpiceMsgSurfaceDestroy *)data; + + out->surface_id = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_DisplayChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[8] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify, + parse_SpiceMsgData + }; + static parse_msg_func_t funcs2[8] = { + parse_msg_display_mode, + parse_SpiceMsgEmpty, + parse_SpiceMsgEmpty, + parse_msg_display_copy_bits, + parse_msg_display_inval_list, + parse_msg_display_inval_all_pixmaps, + parse_msg_display_inval_palette, + parse_SpiceMsgEmpty + }; + static parse_msg_func_t funcs3[5] = { + parse_msg_display_stream_create, + parse_msg_display_stream_data, + parse_msg_display_stream_clip, + parse_msg_display_stream_destroy, + parse_SpiceMsgEmpty + }; + static parse_msg_func_t funcs4[14] = { + parse_msg_display_draw_fill, + parse_msg_display_draw_opaque, + parse_msg_display_draw_copy, + parse_msg_display_draw_blend, + parse_msg_display_draw_blackness, + parse_msg_display_draw_whiteness, + parse_msg_display_draw_invers, + parse_msg_display_draw_rop3, + parse_msg_display_draw_stroke, + parse_msg_display_draw_text, + parse_msg_display_draw_transparent, + parse_msg_display_draw_alpha_blend, + parse_msg_display_surface_create, + parse_msg_display_surface_destroy + }; + if (message_type >= 1 && message_type < 9) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 109) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 122 && message_type < 127) { + return funcs3[message_type-122](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 302 && message_type < 316) { + return funcs4[message_type-302](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msg_inputs_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgInputsInit *out; + + nw_size = 2; + mem_size = sizeof(SpiceMsgInputsInit); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgInputsInit); + in = start; + + out = (SpiceMsgInputsInit *)data; + + out->keyboard_modifiers = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_inputs_key_modifiers(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgInputsKeyModifiers *out; + + nw_size = 2; + mem_size = sizeof(SpiceMsgInputsKeyModifiers); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgInputsKeyModifiers); + in = start; + + out = (SpiceMsgInputsKeyModifiers *)data; + + out->modifiers = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_InputsChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[8] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify, + parse_SpiceMsgData + }; + static parse_msg_func_t funcs2[2] = { + parse_msg_inputs_init, + parse_msg_inputs_key_modifiers + }; + static parse_msg_func_t funcs3[1] = { + parse_SpiceMsgEmpty + }; + if (message_type >= 1 && message_type < 9) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 103) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 111 && message_type < 112) { + return funcs3[message_type-111](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msg_cursor_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t cursor__nw_size; + SpiceMsgCursorInit *out; + + { /* cursor */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 9); + size_t u__nw_size; + uint16_t flags__value; + size_t data__nw_size; + uint32_t data__nelements; + { /* u */ + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + flags__value = read_uint16(pos); + if (!(flags__value & SPICE_CURSOR_FLAGS_NONE)) { + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 2); + u__nw_size = 17; + } else { + u__nw_size = 0; + } + + } + + { /* data */ + data__nelements = message_end - (start2 + 2 + u__nw_size); + + data__nw_size = data__nelements; + } + + cursor__nw_size = 2 + u__nw_size + data__nw_size; + } + + nw_size = 9 + cursor__nw_size; + mem_size = sizeof(SpiceMsgCursorInit); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgCursorInit); + in = start; + + out = (SpiceMsgCursorInit *)data; + + /* position */ { + out->position.x = consume_int16(&in); + out->position.y = consume_int16(&in); + } + out->trail_length = consume_uint16(&in); + out->trail_frequency = consume_uint16(&in); + out->visible = consume_uint8(&in); + /* cursor */ { + uint32_t data__nelements; + out->cursor.flags = consume_uint16(&in); + if (!(out->cursor.flags & SPICE_CURSOR_FLAGS_NONE)) { + out->cursor.header.unique = consume_uint64(&in); + out->cursor.header.type = consume_uint8(&in); + out->cursor.header.width = consume_uint16(&in); + out->cursor.header.height = consume_uint16(&in); + out->cursor.header.hot_spot_x = consume_uint16(&in); + out->cursor.header.hot_spot_y = consume_uint16(&in); + } + data__nelements = (message_end - in) / (1); + /* use array as pointer */ + out->cursor.data = (uint8_t *)in; + out->cursor.data_size = data__nelements; + in += data__nelements; + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_cursor_set(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t cursor__nw_size; + SpiceMsgCursorSet *out; + + { /* cursor */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 5); + size_t u__nw_size; + uint16_t flags__value; + size_t data__nw_size; + uint32_t data__nelements; + { /* u */ + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + flags__value = read_uint16(pos); + if (!(flags__value & SPICE_CURSOR_FLAGS_NONE)) { + SPICE_GNUC_UNUSED uint8_t *start3 = (start2 + 2); + u__nw_size = 17; + } else { + u__nw_size = 0; + } + + } + + { /* data */ + data__nelements = message_end - (start2 + 2 + u__nw_size); + + data__nw_size = data__nelements; + } + + cursor__nw_size = 2 + u__nw_size + data__nw_size; + } + + nw_size = 5 + cursor__nw_size; + mem_size = sizeof(SpiceMsgCursorSet); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgCursorSet); + in = start; + + out = (SpiceMsgCursorSet *)data; + + /* position */ { + out->position.x = consume_int16(&in); + out->position.y = consume_int16(&in); + } + out->visible = consume_uint8(&in); + /* cursor */ { + uint32_t data__nelements; + out->cursor.flags = consume_uint16(&in); + if (!(out->cursor.flags & SPICE_CURSOR_FLAGS_NONE)) { + out->cursor.header.unique = consume_uint64(&in); + out->cursor.header.type = consume_uint8(&in); + out->cursor.header.width = consume_uint16(&in); + out->cursor.header.height = consume_uint16(&in); + out->cursor.header.hot_spot_x = consume_uint16(&in); + out->cursor.header.hot_spot_y = consume_uint16(&in); + } + data__nelements = (message_end - in) / (1); + /* use array as pointer */ + out->cursor.data = (uint8_t *)in; + out->cursor.data_size = data__nelements; + in += data__nelements; + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_cursor_move(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgCursorMove *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgCursorMove); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgCursorMove); + in = start; + + out = (SpiceMsgCursorMove *)data; + + /* position */ { + out->position.x = consume_int16(&in); + out->position.y = consume_int16(&in); + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_cursor_trail(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgCursorTrail *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgCursorTrail); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgCursorTrail); + in = start; + + out = (SpiceMsgCursorTrail *)data; + + out->length = consume_uint16(&in); + out->frequency = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_cursor_inval_one(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgDisplayInvalOne *out; + + nw_size = 8; + mem_size = sizeof(SpiceMsgDisplayInvalOne); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisplayInvalOne); + in = start; + + out = (SpiceMsgDisplayInvalOne *)data; + + out->id = consume_uint64(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_CursorChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[8] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify, + parse_SpiceMsgData + }; + static parse_msg_func_t funcs2[8] = { + parse_msg_cursor_init, + parse_SpiceMsgEmpty, + parse_msg_cursor_set, + parse_msg_cursor_move, + parse_SpiceMsgEmpty, + parse_msg_cursor_trail, + parse_msg_cursor_inval_one, + parse_SpiceMsgEmpty + }; + if (message_type >= 1 && message_type < 9) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 109) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msg_playback_data(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t data__nw_size; + uint32_t data__nelements; + SpiceMsgPlaybackPacket *out; + + { /* data */ + data__nelements = message_end - (start + 4); + + data__nw_size = data__nelements; + } + + nw_size = 4 + data__nw_size; + mem_size = sizeof(SpiceMsgPlaybackPacket); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgPlaybackPacket); + in = start; + + out = (SpiceMsgPlaybackPacket *)data; + + out->time = consume_uint32(&in); + /* use array as pointer */ + out->data = (uint8_t *)in; + out->data_size = data__nelements; + in += data__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_playback_mode(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t data__nw_size; + uint32_t data__nelements; + SpiceMsgPlaybackMode *out; + + { /* data */ + data__nelements = message_end - (start + 6); + + data__nw_size = data__nelements; + } + + nw_size = 6 + data__nw_size; + mem_size = sizeof(SpiceMsgPlaybackMode); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgPlaybackMode); + in = start; + + out = (SpiceMsgPlaybackMode *)data; + + out->time = consume_uint32(&in); + out->mode = consume_uint16(&in); + /* use array as pointer */ + out->data = (uint8_t *)in; + out->data_size = data__nelements; + in += data__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_playback_start(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgPlaybackStart *out; + + nw_size = 14; + mem_size = sizeof(SpiceMsgPlaybackStart); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgPlaybackStart); + in = start; + + out = (SpiceMsgPlaybackStart *)data; + + out->channels = consume_uint32(&in); + out->format = consume_uint16(&in); + out->frequency = consume_uint32(&in); + out->time = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_SpiceMsgAudioVolume(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t volume__nw_size, volume__mem_size; + uint32_t volume__nelements; + SpiceMsgAudioVolume *out; + uint32_t i; + + { /* volume */ + uint8_t nchannels__value; + pos = start + 0; + if (SPICE_UNLIKELY(pos + 1 > message_end)) { + goto error; + } + nchannels__value = read_uint8(pos); + volume__nelements = nchannels__value; + + volume__nw_size = (2) * volume__nelements; + volume__mem_size = sizeof(uint16_t) * volume__nelements; + } + + nw_size = 1 + volume__nw_size; + mem_size = sizeof(SpiceMsgAudioVolume) + volume__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgAudioVolume); + in = start; + + out = (SpiceMsgAudioVolume *)data; + + out->nchannels = consume_uint8(&in); + for (i = 0; i < volume__nelements; i++) { + out->volume[i] = consume_uint16(&in); + end += sizeof(uint16_t); + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_SpiceMsgAudioMute(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgAudioMute *out; + + nw_size = 1; + mem_size = sizeof(SpiceMsgAudioMute); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgAudioMute); + in = start; + + out = (SpiceMsgAudioMute *)data; + + out->mute = consume_uint8(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_PlaybackChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[8] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify, + parse_SpiceMsgData + }; + static parse_msg_func_t funcs2[6] = { + parse_msg_playback_data, + parse_msg_playback_mode, + parse_msg_playback_start, + parse_SpiceMsgEmpty, + parse_SpiceMsgAudioVolume, + parse_SpiceMsgAudioMute + }; + if (message_type >= 1 && message_type < 9) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 107) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msg_record_start(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgRecordStart *out; + + nw_size = 10; + mem_size = sizeof(SpiceMsgRecordStart); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgRecordStart); + in = start; + + out = (SpiceMsgRecordStart *)data; + + out->channels = consume_uint32(&in); + out->format = consume_uint16(&in); + out->frequency = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_RecordChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[8] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify, + parse_SpiceMsgData + }; + static parse_msg_func_t funcs2[4] = { + parse_msg_record_start, + parse_SpiceMsgEmpty, + parse_SpiceMsgAudioVolume, + parse_SpiceMsgAudioMute + }; + if (message_type >= 1 && message_type < 9) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 105) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msg_tunnel_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgTunnelInit *out; + + nw_size = 6; + mem_size = sizeof(SpiceMsgTunnelInit); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgTunnelInit); + in = start; + + out = (SpiceMsgTunnelInit *)data; + + out->max_num_of_sockets = consume_uint16(&in); + out->max_socket_data_size = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_tunnel_service_ip_map(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t virtual_ip__nw_size; + SpiceMsgTunnelServiceIpMap *out; + + { /* virtual_ip */ + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 4); + size_t u__nw_size; + uint16_t type__value; + { /* u */ + uint32_t u__nelements; + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + type__value = read_uint16(pos); + if (type__value == SPICE_TUNNEL_IP_TYPE_IPv4) { + u__nelements = 4; + + u__nw_size = u__nelements; + } else { + u__nw_size = 0; + } + + } + + virtual_ip__nw_size = 2 + u__nw_size; + } + + nw_size = 4 + virtual_ip__nw_size; + mem_size = sizeof(SpiceMsgTunnelServiceIpMap); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgTunnelServiceIpMap); + in = start; + + out = (SpiceMsgTunnelServiceIpMap *)data; + + out->service_id = consume_uint32(&in); + /* virtual_ip */ { + out->virtual_ip.type = consume_uint16(&in); + if (out->virtual_ip.type == SPICE_TUNNEL_IP_TYPE_IPv4) { + uint32_t ipv4__nelements; + ipv4__nelements = 4; + memcpy(out->virtual_ip.u.ipv4, in, ipv4__nelements); + in += ipv4__nelements; + } + } + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_tunnel_socket_open(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgTunnelSocketOpen *out; + + nw_size = 10; + mem_size = sizeof(SpiceMsgTunnelSocketOpen); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgTunnelSocketOpen); + in = start; + + out = (SpiceMsgTunnelSocketOpen *)data; + + out->connection_id = consume_uint16(&in); + out->service_id = consume_uint32(&in); + out->tokens = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_tunnel_socket_fin(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgTunnelSocketFin *out; + + nw_size = 2; + mem_size = sizeof(SpiceMsgTunnelSocketFin); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgTunnelSocketFin); + in = start; + + out = (SpiceMsgTunnelSocketFin *)data; + + out->connection_id = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_tunnel_socket_close(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgTunnelSocketClose *out; + + nw_size = 2; + mem_size = sizeof(SpiceMsgTunnelSocketClose); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgTunnelSocketClose); + in = start; + + out = (SpiceMsgTunnelSocketClose *)data; + + out->connection_id = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_tunnel_socket_data(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t data__nw_size, data__mem_size; + uint32_t data__nelements; + SpiceMsgTunnelSocketData *out; + + { /* data */ + data__nelements = message_end - (start + 2); + + data__nw_size = data__nelements; + data__mem_size = sizeof(uint8_t) * data__nelements; + } + + nw_size = 2 + data__nw_size; + mem_size = sizeof(SpiceMsgTunnelSocketData) + data__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgTunnelSocketData); + in = start; + + out = (SpiceMsgTunnelSocketData *)data; + + out->connection_id = consume_uint16(&in); + memcpy(out->data, in, data__nelements); + in += data__nelements; + end += data__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_tunnel_socket_closed_ack(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgTunnelSocketClosedAck *out; + + nw_size = 2; + mem_size = sizeof(SpiceMsgTunnelSocketClosedAck); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgTunnelSocketClosedAck); + in = start; + + out = (SpiceMsgTunnelSocketClosedAck *)data; + + out->connection_id = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msg_tunnel_socket_token(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgTunnelSocketTokens *out; + + nw_size = 6; + mem_size = sizeof(SpiceMsgTunnelSocketTokens); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgTunnelSocketTokens); + in = start; + + out = (SpiceMsgTunnelSocketTokens *)data; + + out->connection_id = consume_uint16(&in); + out->num_tokens = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_TunnelChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[8] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify, + parse_SpiceMsgData + }; + static parse_msg_func_t funcs2[8] = { + parse_msg_tunnel_init, + parse_msg_tunnel_service_ip_map, + parse_msg_tunnel_socket_open, + parse_msg_tunnel_socket_fin, + parse_msg_tunnel_socket_close, + parse_msg_tunnel_socket_data, + parse_msg_tunnel_socket_closed_ack, + parse_msg_tunnel_socket_token + }; + if (message_type >= 1 && message_type < 9) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 109) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + +#ifdef USE_SMARTCARD + +static uint8_t * parse_msg_smartcard_msg(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t data__nw_size, data__mem_size; + uint32_t data__nelements; + SpiceMsgSmartcard *out; + + { /* data */ + data__nelements = message_end - (start + 12); + + data__nw_size = data__nelements; + data__mem_size = sizeof(uint8_t) * data__nelements; + } + + nw_size = 12 + data__nw_size; + mem_size = sizeof(SpiceMsgSmartcard) + data__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgSmartcard); + in = start; + + out = (SpiceMsgSmartcard *)data; + + out->type = consume_uint32(&in); + out->reader_id = consume_uint32(&in); + out->length = consume_uint32(&in); + memcpy(out->data, in, data__nelements); + in += data__nelements; + end += data__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_SmartcardChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[8] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify, + parse_SpiceMsgData + }; + static parse_msg_func_t funcs2[1] = { + parse_msg_smartcard_msg + }; + if (message_type >= 1 && message_type < 9) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 102) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} +#endif /* USE_SMARTCARD */ + + + +static uint8_t * parse_UsbredirChannel_msg(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[8] = { + parse_msg_migrate, + parse_SpiceMsgData, + parse_msg_set_ack, + parse_msg_ping, + parse_msg_wait_for_channels, + parse_msg_disconnecting, + parse_msg_notify, + parse_SpiceMsgData + }; + static parse_msg_func_t funcs2[1] = { + parse_SpiceMsgData + }; + if (message_type >= 1 && message_type < 9) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 102) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + +spice_parse_channel_func_t spice_get_server_channel_parser(uint32_t channel, unsigned int *max_message_type) +{ + static struct {spice_parse_channel_func_t func; unsigned int max_messages; } channels[10] = { + { NULL, 0 }, + { parse_MainChannel_msg, 114}, + { parse_DisplayChannel_msg, 315}, + { parse_InputsChannel_msg, 111}, + { parse_CursorChannel_msg, 108}, + { parse_PlaybackChannel_msg, 106}, + { parse_RecordChannel_msg, 104}, + { parse_TunnelChannel_msg, 108}, +#ifdef USE_SMARTCARD + { parse_SmartcardChannel_msg, 101}, +#else /* USE_SMARTCARD */ + { NULL, 0 }, +#endif /* USE_SMARTCARD */ + { parse_UsbredirChannel_msg, 101} + }; + if (channel < 10) { + if (max_message_type != NULL) { + *max_message_type = channels[channel].max_messages; + } + return channels[channel].func; + } + return NULL; +} + +uint8_t * spice_parse_msg(uint8_t *message_start, uint8_t *message_end, uint32_t channel, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + spice_parse_channel_func_t func; + func = spice_get_server_channel_parser(channel, NULL); + if (func != NULL) { + return func(message_start, message_end, message_type, minor, size_out, free_message); + } + return NULL; +} diff -Nru spice-gtk-0.9/spice-common/common/generated_client_marshallers1.c spice-gtk-0.12/spice-common/common/generated_client_marshallers1.c --- spice-gtk-0.9/spice-common/common/generated_client_marshallers1.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/generated_client_marshallers1.c 2012-04-24 11:24:33.000000000 +0000 @@ -0,0 +1,234 @@ +/* this is a file autogenerated by spice_codegen.py */ +#ifdef HAVE_CONFIG_H +#include +#endif +#include "messages.h" +#include "client_marshallers.h" +#include +#include +#include +#include +#include +#include +#include "marshaller.h" + +#ifdef _MSC_VER +#pragma warning(disable:4101) +#pragma warning(disable:4018) +#endif + +static void spice_marshall_msgc_ack_sync(SpiceMarshaller *m, SpiceMsgcAckSync *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcAckSync *src; + src = (SpiceMsgcAckSync *)msg; + + spice_marshaller_add_uint32(m, src->generation); +} + +static void spice_marshall_SpiceMsgEmpty(SpiceMarshaller *m, SpiceMsgEmpty *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; +} + +static void spice_marshall_msgc_pong(SpiceMarshaller *m, SpiceMsgPing *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgPing *src; + src = (SpiceMsgPing *)msg; + + spice_marshaller_add_uint32(m, src->id); + spice_marshaller_add_uint64(m, src->timestamp); +} + +static void spice_marshall_SpiceMsgData(SpiceMarshaller *m, SpiceMsgData *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; +} + +static void spice_marshall_msgc_disconnecting(SpiceMarshaller *m, SpiceMsgDisconnect *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisconnect *src; + src = (SpiceMsgDisconnect *)msg; + + spice_marshaller_add_uint64(m, src->time_stamp); + spice_marshaller_add_uint32(m, src->reason); +} + +static void spice_marshall_msgc_main_client_info(SpiceMarshaller *m, SpiceMsgcClientInfo *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcClientInfo *src; + src = (SpiceMsgcClientInfo *)msg; + + spice_marshaller_add_uint64(m, src->cache_size); +} + +static void spice_marshall_msgc_main_mouse_mode_request(SpiceMarshaller *m, SpiceMsgcMainMouseModeRequest *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcMainMouseModeRequest *src; + src = (SpiceMsgcMainMouseModeRequest *)msg; + + spice_marshaller_add_uint32(m, src->mode); +} + +static void spice_marshall_msgc_main_agent_start(SpiceMarshaller *m, SpiceMsgcMainAgentStart *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcMainAgentStart *src; + src = (SpiceMsgcMainAgentStart *)msg; + + spice_marshaller_add_uint32(m, src->num_tokens); +} + +static void spice_marshall_msgc_main_agent_token(SpiceMarshaller *m, SpiceMsgcMainAgentTokens *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcMainAgentTokens *src; + src = (SpiceMsgcMainAgentTokens *)msg; + + spice_marshaller_add_uint32(m, src->num_tokens); +} + +static void spice_marshall_msgc_display_init(SpiceMarshaller *m, SpiceMsgcDisplayInit *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcDisplayInit *src; + src = (SpiceMsgcDisplayInit *)msg; + + spice_marshaller_add_uint8(m, src->pixmap_cache_id); + spice_marshaller_add_int64(m, src->pixmap_cache_size); + spice_marshaller_add_uint8(m, src->glz_dictionary_id); + spice_marshaller_add_int32(m, src->glz_dictionary_window_size); +} + +static void spice_marshall_msgc_inputs_key_down(SpiceMarshaller *m, SpiceMsgcKeyDown *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcKeyDown *src; + src = (SpiceMsgcKeyDown *)msg; + + spice_marshaller_add_uint32(m, src->code); +} + +static void spice_marshall_msgc_inputs_key_up(SpiceMarshaller *m, SpiceMsgcKeyUp *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcKeyUp *src; + src = (SpiceMsgcKeyUp *)msg; + + spice_marshaller_add_uint32(m, src->code); +} + +static void spice_marshall_msgc_inputs_key_modifiers(SpiceMarshaller *m, SpiceMsgcKeyModifiers *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcKeyModifiers *src; + src = (SpiceMsgcKeyModifiers *)msg; + + spice_marshaller_add_uint32(m, src->modifiers); +} + +static void spice_marshall_msgc_inputs_mouse_motion(SpiceMarshaller *m, SpiceMsgcMouseMotion *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcMouseMotion *src; + src = (SpiceMsgcMouseMotion *)msg; + + spice_marshaller_add_int32(m, src->dx); + spice_marshaller_add_int32(m, src->dy); + spice_marshaller_add_uint32(m, src->buttons_state); +} + +static void spice_marshall_msgc_inputs_mouse_position(SpiceMarshaller *m, SpiceMsgcMousePosition *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcMousePosition *src; + src = (SpiceMsgcMousePosition *)msg; + + spice_marshaller_add_uint32(m, src->x); + spice_marshaller_add_uint32(m, src->y); + spice_marshaller_add_uint32(m, src->buttons_state); + spice_marshaller_add_uint8(m, src->display_id); +} + +static void spice_marshall_msgc_inputs_mouse_press(SpiceMarshaller *m, SpiceMsgcMousePress *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcMousePress *src; + src = (SpiceMsgcMousePress *)msg; + + spice_marshaller_add_uint32(m, src->button); + spice_marshaller_add_uint32(m, src->buttons_state); +} + +static void spice_marshall_msgc_inputs_mouse_release(SpiceMarshaller *m, SpiceMsgcMouseRelease *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcMouseRelease *src; + src = (SpiceMsgcMouseRelease *)msg; + + spice_marshaller_add_uint32(m, src->button); + spice_marshaller_add_uint32(m, src->buttons_state); +} + +static void spice_marshall_msgc_record_data(SpiceMarshaller *m, SpiceMsgcRecordPacket *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcRecordPacket *src; + src = (SpiceMsgcRecordPacket *)msg; + + spice_marshaller_add_uint32(m, src->time); + /* Don't marshall @nomarshal data */ +} + +static void spice_marshall_msgc_record_mode(SpiceMarshaller *m, SpiceMsgcRecordMode *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcRecordMode *src; + src = (SpiceMsgcRecordMode *)msg; + + spice_marshaller_add_uint32(m, src->time); + spice_marshaller_add_uint32(m, src->mode); + /* Remaining data must be appended manually */ +} + +static void spice_marshall_msgc_record_start_mark(SpiceMarshaller *m, SpiceMsgcRecordStartMark *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcRecordStartMark *src; + src = (SpiceMsgcRecordStartMark *)msg; + + spice_marshaller_add_uint32(m, src->time); +} + +SpiceMessageMarshallers * spice_message_marshallers_get1(void) +{ + static SpiceMessageMarshallers marshallers = {NULL}; + + marshallers.msg_SpiceMsgData = spice_marshall_SpiceMsgData; + marshallers.msg_SpiceMsgEmpty = spice_marshall_SpiceMsgEmpty; + marshallers.msgc_ack_sync = spice_marshall_msgc_ack_sync; + marshallers.msgc_disconnecting = spice_marshall_msgc_disconnecting; + marshallers.msgc_display_init = spice_marshall_msgc_display_init; + marshallers.msgc_inputs_key_down = spice_marshall_msgc_inputs_key_down; + marshallers.msgc_inputs_key_modifiers = spice_marshall_msgc_inputs_key_modifiers; + marshallers.msgc_inputs_key_up = spice_marshall_msgc_inputs_key_up; + marshallers.msgc_inputs_mouse_motion = spice_marshall_msgc_inputs_mouse_motion; + marshallers.msgc_inputs_mouse_position = spice_marshall_msgc_inputs_mouse_position; + marshallers.msgc_inputs_mouse_press = spice_marshall_msgc_inputs_mouse_press; + marshallers.msgc_inputs_mouse_release = spice_marshall_msgc_inputs_mouse_release; + marshallers.msgc_main_agent_start = spice_marshall_msgc_main_agent_start; + marshallers.msgc_main_agent_token = spice_marshall_msgc_main_agent_token; + marshallers.msgc_main_client_info = spice_marshall_msgc_main_client_info; + marshallers.msgc_main_mouse_mode_request = spice_marshall_msgc_main_mouse_mode_request; + marshallers.msgc_pong = spice_marshall_msgc_pong; + marshallers.msgc_record_data = spice_marshall_msgc_record_data; + marshallers.msgc_record_mode = spice_marshall_msgc_record_mode; + marshallers.msgc_record_start_mark = spice_marshall_msgc_record_start_mark; + + return &marshallers; +} + diff -Nru spice-gtk-0.9/spice-common/common/generated_client_marshallers.c spice-gtk-0.12/spice-common/common/generated_client_marshallers.c --- spice-gtk-0.9/spice-common/common/generated_client_marshallers.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/generated_client_marshallers.c 2012-04-24 11:24:34.000000000 +0000 @@ -0,0 +1,424 @@ +/* this is a file autogenerated by spice_codegen.py */ +#ifdef HAVE_CONFIG_H +#include +#endif +#include "messages.h" +#include "client_marshallers.h" +#include +#include +#include +#include +#include +#include +#include "marshaller.h" + +#ifdef _MSC_VER +#pragma warning(disable:4101) +#pragma warning(disable:4018) +#endif + +static void spice_marshall_msgc_ack_sync(SpiceMarshaller *m, SpiceMsgcAckSync *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcAckSync *src; + src = (SpiceMsgcAckSync *)msg; + + spice_marshaller_add_uint32(m, src->generation); +} + +static void spice_marshall_SpiceMsgEmpty(SpiceMarshaller *m, SpiceMsgEmpty *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; +} + +static void spice_marshall_msgc_pong(SpiceMarshaller *m, SpiceMsgPing *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgPing *src; + src = (SpiceMsgPing *)msg; + + spice_marshaller_add_uint32(m, src->id); + spice_marshaller_add_uint64(m, src->timestamp); +} + +static void spice_marshall_SpiceMsgData(SpiceMarshaller *m, SpiceMsgData *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; +} + +static void spice_marshall_msgc_disconnecting(SpiceMarshaller *m, SpiceMsgDisconnect *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisconnect *src; + src = (SpiceMsgDisconnect *)msg; + + spice_marshaller_add_uint64(m, src->time_stamp); + spice_marshaller_add_uint32(m, src->reason); +} + +static void spice_marshall_msgc_main_client_info(SpiceMarshaller *m, SpiceMsgcClientInfo *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcClientInfo *src; + src = (SpiceMsgcClientInfo *)msg; + + spice_marshaller_add_uint64(m, src->cache_size); +} + +static void spice_marshall_msgc_main_mouse_mode_request(SpiceMarshaller *m, SpiceMsgcMainMouseModeRequest *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcMainMouseModeRequest *src; + src = (SpiceMsgcMainMouseModeRequest *)msg; + + spice_marshaller_add_uint16(m, src->mode); +} + +static void spice_marshall_msgc_main_agent_start(SpiceMarshaller *m, SpiceMsgcMainAgentStart *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcMainAgentStart *src; + src = (SpiceMsgcMainAgentStart *)msg; + + spice_marshaller_add_uint32(m, src->num_tokens); +} + +static void spice_marshall_msgc_main_agent_token(SpiceMarshaller *m, SpiceMsgcMainAgentTokens *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcMainAgentTokens *src; + src = (SpiceMsgcMainAgentTokens *)msg; + + spice_marshaller_add_uint32(m, src->num_tokens); +} + +static void spice_marshall_msgc_display_init(SpiceMarshaller *m, SpiceMsgcDisplayInit *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcDisplayInit *src; + src = (SpiceMsgcDisplayInit *)msg; + + spice_marshaller_add_uint8(m, src->pixmap_cache_id); + spice_marshaller_add_int64(m, src->pixmap_cache_size); + spice_marshaller_add_uint8(m, src->glz_dictionary_id); + spice_marshaller_add_int32(m, src->glz_dictionary_window_size); +} + +static void spice_marshall_msgc_inputs_key_down(SpiceMarshaller *m, SpiceMsgcKeyDown *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcKeyDown *src; + src = (SpiceMsgcKeyDown *)msg; + + spice_marshaller_add_uint32(m, src->code); +} + +static void spice_marshall_msgc_inputs_key_up(SpiceMarshaller *m, SpiceMsgcKeyUp *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcKeyUp *src; + src = (SpiceMsgcKeyUp *)msg; + + spice_marshaller_add_uint32(m, src->code); +} + +static void spice_marshall_msgc_inputs_key_modifiers(SpiceMarshaller *m, SpiceMsgcKeyModifiers *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcKeyModifiers *src; + src = (SpiceMsgcKeyModifiers *)msg; + + spice_marshaller_add_uint16(m, src->modifiers); +} + +static void spice_marshall_msgc_inputs_mouse_motion(SpiceMarshaller *m, SpiceMsgcMouseMotion *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcMouseMotion *src; + src = (SpiceMsgcMouseMotion *)msg; + + spice_marshaller_add_int32(m, src->dx); + spice_marshaller_add_int32(m, src->dy); + spice_marshaller_add_uint16(m, src->buttons_state); +} + +static void spice_marshall_msgc_inputs_mouse_position(SpiceMarshaller *m, SpiceMsgcMousePosition *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcMousePosition *src; + src = (SpiceMsgcMousePosition *)msg; + + spice_marshaller_add_uint32(m, src->x); + spice_marshaller_add_uint32(m, src->y); + spice_marshaller_add_uint16(m, src->buttons_state); + spice_marshaller_add_uint8(m, src->display_id); +} + +static void spice_marshall_msgc_inputs_mouse_press(SpiceMarshaller *m, SpiceMsgcMousePress *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcMousePress *src; + src = (SpiceMsgcMousePress *)msg; + + spice_marshaller_add_uint8(m, src->button); + spice_marshaller_add_uint16(m, src->buttons_state); +} + +static void spice_marshall_msgc_inputs_mouse_release(SpiceMarshaller *m, SpiceMsgcMouseRelease *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcMouseRelease *src; + src = (SpiceMsgcMouseRelease *)msg; + + spice_marshaller_add_uint8(m, src->button); + spice_marshaller_add_uint16(m, src->buttons_state); +} + +static void spice_marshall_msgc_record_data(SpiceMarshaller *m, SpiceMsgcRecordPacket *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcRecordPacket *src; + src = (SpiceMsgcRecordPacket *)msg; + + spice_marshaller_add_uint32(m, src->time); + /* Don't marshall @nomarshal data */ +} + +static void spice_marshall_msgc_record_mode(SpiceMarshaller *m, SpiceMsgcRecordMode *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcRecordMode *src; + src = (SpiceMsgcRecordMode *)msg; + + spice_marshaller_add_uint32(m, src->time); + spice_marshaller_add_uint16(m, src->mode); + /* Remaining data must be appended manually */ +} + +static void spice_marshall_msgc_record_start_mark(SpiceMarshaller *m, SpiceMsgcRecordStartMark *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcRecordStartMark *src; + src = (SpiceMsgcRecordStartMark *)msg; + + spice_marshaller_add_uint32(m, src->time); +} + +SPICE_GNUC_UNUSED static void spice_marshall_array_uint8(SpiceMarshaller *m, uint8_t *ptr, unsigned count) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + uint32_t i; + + for (i = 0; i < count; i++) { + spice_marshaller_add_uint8(m, *ptr++); + } +} + +static void spice_marshall_msgc_tunnel_service_add(SpiceMarshaller *m, SpiceMsgcTunnelAddGenericService *msg, SpiceMarshaller **name_out, SpiceMarshaller **description_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcTunnelAddGenericService *src; + uint32_t i; + *name_out = NULL; + *description_out = NULL; + src = (SpiceMsgcTunnelAddGenericService *)msg; + + spice_marshaller_add_uint16(m, src->type); + spice_marshaller_add_uint32(m, src->id); + spice_marshaller_add_uint32(m, src->group); + spice_marshaller_add_uint32(m, src->port); + *name_out = spice_marshaller_get_ptr_submarshaller(m, 0); + *description_out = spice_marshaller_get_ptr_submarshaller(m, 0); + if (src->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) { + uint8_t *ipv4__element; + spice_marshaller_add_uint16(m, src->u.ip.type); + if (src->u.ip.type == SPICE_TUNNEL_IP_TYPE_IPv4) { + ipv4__element = src->u.ip.u.ipv4; + for (i = 0; i < 4; i++) { + spice_marshaller_add_uint8(m, *ipv4__element); + ipv4__element++; + } + } + } +} + +static void spice_marshall_msgc_tunnel_service_remove(SpiceMarshaller *m, SpiceMsgcTunnelRemoveService *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcTunnelRemoveService *src; + src = (SpiceMsgcTunnelRemoveService *)msg; + + spice_marshaller_add_uint32(m, src->id); +} + +static void spice_marshall_msgc_tunnel_socket_open_ack(SpiceMarshaller *m, SpiceMsgcTunnelSocketOpenAck *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcTunnelSocketOpenAck *src; + src = (SpiceMsgcTunnelSocketOpenAck *)msg; + + spice_marshaller_add_uint16(m, src->connection_id); + spice_marshaller_add_uint32(m, src->tokens); +} + +static void spice_marshall_msgc_tunnel_socket_open_nack(SpiceMarshaller *m, SpiceMsgcTunnelSocketOpenNack *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcTunnelSocketOpenNack *src; + src = (SpiceMsgcTunnelSocketOpenNack *)msg; + + spice_marshaller_add_uint16(m, src->connection_id); +} + +static void spice_marshall_msgc_tunnel_socket_fin(SpiceMarshaller *m, SpiceMsgcTunnelSocketFin *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcTunnelSocketFin *src; + src = (SpiceMsgcTunnelSocketFin *)msg; + + spice_marshaller_add_uint16(m, src->connection_id); +} + +static void spice_marshall_msgc_tunnel_socket_closed(SpiceMarshaller *m, SpiceMsgcTunnelSocketClosed *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcTunnelSocketClosed *src; + src = (SpiceMsgcTunnelSocketClosed *)msg; + + spice_marshaller_add_uint16(m, src->connection_id); +} + +static void spice_marshall_msgc_tunnel_socket_closed_ack(SpiceMarshaller *m, SpiceMsgcTunnelSocketClosedAck *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcTunnelSocketClosedAck *src; + src = (SpiceMsgcTunnelSocketClosedAck *)msg; + + spice_marshaller_add_uint16(m, src->connection_id); +} + +static void spice_marshall_msgc_tunnel_socket_data(SpiceMarshaller *m, SpiceMsgcTunnelSocketData *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcTunnelSocketData *src; + src = (SpiceMsgcTunnelSocketData *)msg; + + spice_marshaller_add_uint16(m, src->connection_id); + /* Remaining data must be appended manually */ +} + +static void spice_marshall_msgc_tunnel_socket_token(SpiceMarshaller *m, SpiceMsgcTunnelSocketTokens *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcTunnelSocketTokens *src; + src = (SpiceMsgcTunnelSocketTokens *)msg; + + spice_marshaller_add_uint16(m, src->connection_id); + spice_marshaller_add_uint32(m, src->num_tokens); +} + +#ifdef USE_SMARTCARD +static void spice_marshall_msgc_smartcard_msg(SpiceMarshaller *m, SpiceMsgcSmartcard *msg, SpiceMarshaller **reader_name_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgcSmartcard *src; + *reader_name_out = NULL; + src = (SpiceMsgcSmartcard *)msg; + + /* header */ { + spice_marshaller_add_uint32(m, src->header.type); + spice_marshaller_add_uint32(m, src->header.reader_id); + spice_marshaller_add_uint32(m, src->header.length); + } + if (src->header.type == VSC_ReaderAdd) { + /* Don't marshall @nomarshal reader_name */ + } else if (src->header.type == VSC_ATR || src->header.type == VSC_APDU) { + /* Remaining data must be appended manually */ + } else if (src->header.type == VSC_Error) { + spice_marshaller_add_uint32(m, src->error.code); + } +} + +static void spice_marshall_msgc_smartcard_header(SpiceMarshaller *m, VSCMsgHeader *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + VSCMsgHeader *src; + src = (VSCMsgHeader *)msg; + + spice_marshaller_add_uint32(m, src->type); + spice_marshaller_add_uint32(m, src->reader_id); + spice_marshaller_add_uint32(m, src->length); +} + +static void spice_marshall_msgc_smartcard_error(SpiceMarshaller *m, VSCMsgError *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + VSCMsgError *src; + src = (VSCMsgError *)msg; + + spice_marshaller_add_uint32(m, src->code); +} + +static void spice_marshall_msgc_smartcard_atr(SpiceMarshaller *m, VSCMsgATR *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; +} + +static void spice_marshall_msgc_smartcard_reader_add(SpiceMarshaller *m, VSCMsgReaderAdd *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; +} + +#endif /* USE_SMARTCARD */ +SpiceMessageMarshallers * spice_message_marshallers_get(void) +{ + static SpiceMessageMarshallers marshallers = {NULL}; + + marshallers.msg_SpiceMsgData = spice_marshall_SpiceMsgData; + marshallers.msg_SpiceMsgEmpty = spice_marshall_SpiceMsgEmpty; + marshallers.msgc_ack_sync = spice_marshall_msgc_ack_sync; + marshallers.msgc_disconnecting = spice_marshall_msgc_disconnecting; + marshallers.msgc_display_init = spice_marshall_msgc_display_init; + marshallers.msgc_inputs_key_down = spice_marshall_msgc_inputs_key_down; + marshallers.msgc_inputs_key_modifiers = spice_marshall_msgc_inputs_key_modifiers; + marshallers.msgc_inputs_key_up = spice_marshall_msgc_inputs_key_up; + marshallers.msgc_inputs_mouse_motion = spice_marshall_msgc_inputs_mouse_motion; + marshallers.msgc_inputs_mouse_position = spice_marshall_msgc_inputs_mouse_position; + marshallers.msgc_inputs_mouse_press = spice_marshall_msgc_inputs_mouse_press; + marshallers.msgc_inputs_mouse_release = spice_marshall_msgc_inputs_mouse_release; + marshallers.msgc_main_agent_start = spice_marshall_msgc_main_agent_start; + marshallers.msgc_main_agent_token = spice_marshall_msgc_main_agent_token; + marshallers.msgc_main_client_info = spice_marshall_msgc_main_client_info; + marshallers.msgc_main_mouse_mode_request = spice_marshall_msgc_main_mouse_mode_request; + marshallers.msgc_pong = spice_marshall_msgc_pong; + marshallers.msgc_record_data = spice_marshall_msgc_record_data; + marshallers.msgc_record_mode = spice_marshall_msgc_record_mode; + marshallers.msgc_record_start_mark = spice_marshall_msgc_record_start_mark; +#ifdef USE_SMARTCARD + marshallers.msgc_smartcard_atr = spice_marshall_msgc_smartcard_atr; +#endif /* USE_SMARTCARD */ +#ifdef USE_SMARTCARD + marshallers.msgc_smartcard_error = spice_marshall_msgc_smartcard_error; +#endif /* USE_SMARTCARD */ +#ifdef USE_SMARTCARD + marshallers.msgc_smartcard_header = spice_marshall_msgc_smartcard_header; +#endif /* USE_SMARTCARD */ +#ifdef USE_SMARTCARD + marshallers.msgc_smartcard_msg = spice_marshall_msgc_smartcard_msg; +#endif /* USE_SMARTCARD */ +#ifdef USE_SMARTCARD + marshallers.msgc_smartcard_reader_add = spice_marshall_msgc_smartcard_reader_add; +#endif /* USE_SMARTCARD */ + marshallers.msgc_tunnel_service_add = spice_marshall_msgc_tunnel_service_add; + marshallers.msgc_tunnel_service_remove = spice_marshall_msgc_tunnel_service_remove; + marshallers.msgc_tunnel_socket_closed = spice_marshall_msgc_tunnel_socket_closed; + marshallers.msgc_tunnel_socket_closed_ack = spice_marshall_msgc_tunnel_socket_closed_ack; + marshallers.msgc_tunnel_socket_data = spice_marshall_msgc_tunnel_socket_data; + marshallers.msgc_tunnel_socket_fin = spice_marshall_msgc_tunnel_socket_fin; + marshallers.msgc_tunnel_socket_open_ack = spice_marshall_msgc_tunnel_socket_open_ack; + marshallers.msgc_tunnel_socket_open_nack = spice_marshall_msgc_tunnel_socket_open_nack; + marshallers.msgc_tunnel_socket_token = spice_marshall_msgc_tunnel_socket_token; + + return &marshallers; +} + diff -Nru spice-gtk-0.9/spice-common/common/generated_server_demarshallers.c spice-gtk-0.12/spice-common/common/generated_server_demarshallers.c --- spice-gtk-0.9/spice-common/common/generated_server_demarshallers.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/generated_server_demarshallers.c 2012-04-24 11:24:36.000000000 +0000 @@ -0,0 +1,1868 @@ +/* this is a file autogenerated by spice_codegen.py */ +#ifdef HAVE_CONFIG_H +#include +#endif +#include "messages.h" +#include +#include +#include +#include +#include +#include +#include "mem.h" + +#ifdef _MSC_VER +#pragma warning(disable:4101) +#endif + + + +#ifdef WORDS_BIGENDIAN +#define read_int8(ptr) (*((int8_t *)(ptr))) +#define write_int8(ptr, val) *(int8_t *)(ptr) = val +#define read_uint8(ptr) (*((uint8_t *)(ptr))) +#define write_uint8(ptr, val) *(uint8_t *)(ptr) = val +#define read_int16(ptr) ((int16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr))) +#define write_int16(ptr, val) *(uint16_t *)(ptr) = SPICE_BYTESWAP16((uint16_t)val) +#define read_uint16(ptr) ((uint16_t)SPICE_BYTESWAP16(*((uint16_t *)(ptr))) +#define write_uint16(ptr, val) *(uint16_t *)(ptr) = SPICE_BYTESWAP16((uint16_t)val) +#define read_int32(ptr) ((int32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr))) +#define write_int32(ptr, val) *(uint32_t *)(ptr) = SPICE_BYTESWAP32((uint32_t)val) +#define read_uint32(ptr) ((uint32_t)SPICE_BYTESWAP32(*((uint32_t *)(ptr))) +#define write_uint32(ptr, val) *(uint32_t *)(ptr) = SPICE_BYTESWAP32((uint32_t)val) +#define read_int64(ptr) ((int64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))) +#define write_int64(ptr, val) *(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val) +#define read_uint64(ptr) ((uint64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))) +#define write_uint64(ptr, val) *(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val) +#else +#define read_int8(ptr) (*((int8_t *)(ptr))) +#define write_int8(ptr, val) (*((int8_t *)(ptr))) = val +#define read_uint8(ptr) (*((uint8_t *)(ptr))) +#define write_uint8(ptr, val) (*((uint8_t *)(ptr))) = val +#define read_int16(ptr) (*((int16_t *)(ptr))) +#define write_int16(ptr, val) (*((int16_t *)(ptr))) = val +#define read_uint16(ptr) (*((uint16_t *)(ptr))) +#define write_uint16(ptr, val) (*((uint16_t *)(ptr))) = val +#define read_int32(ptr) (*((int32_t *)(ptr))) +#define write_int32(ptr, val) (*((int32_t *)(ptr))) = val +#define read_uint32(ptr) (*((uint32_t *)(ptr))) +#define write_uint32(ptr, val) (*((uint32_t *)(ptr))) = val +#define read_int64(ptr) (*((int64_t *)(ptr))) +#define write_int64(ptr, val) (*((int64_t *)(ptr))) = val +#define read_uint64(ptr) (*((uint64_t *)(ptr))) +#define write_uint64(ptr, val) (*((uint64_t *)(ptr))) = val +#endif + +static int8_t SPICE_GNUC_UNUSED consume_int8(uint8_t **ptr) +{ + int8_t val; + val = read_int8(*ptr); + *ptr += 1; + return val; +} + +static uint8_t SPICE_GNUC_UNUSED consume_uint8(uint8_t **ptr) +{ + uint8_t val; + val = read_uint8(*ptr); + *ptr += 1; + return val; +} + +static int16_t SPICE_GNUC_UNUSED consume_int16(uint8_t **ptr) +{ + int16_t val; + val = read_int16(*ptr); + *ptr += 2; + return val; +} + +static uint16_t SPICE_GNUC_UNUSED consume_uint16(uint8_t **ptr) +{ + uint16_t val; + val = read_uint16(*ptr); + *ptr += 2; + return val; +} + +static int32_t SPICE_GNUC_UNUSED consume_int32(uint8_t **ptr) +{ + int32_t val; + val = read_int32(*ptr); + *ptr += 4; + return val; +} + +static uint32_t SPICE_GNUC_UNUSED consume_uint32(uint8_t **ptr) +{ + uint32_t val; + val = read_uint32(*ptr); + *ptr += 4; + return val; +} + +static int64_t SPICE_GNUC_UNUSED consume_int64(uint8_t **ptr) +{ + int64_t val; + val = read_int64(*ptr); + *ptr += 8; + return val; +} + +static uint64_t SPICE_GNUC_UNUSED consume_uint64(uint8_t **ptr) +{ + uint64_t val; + val = read_uint64(*ptr); + *ptr += 8; + return val; +} + +typedef struct PointerInfo PointerInfo; +typedef void (*message_destructor_t)(uint8_t *message); +typedef uint8_t * (*parse_func_t)(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *ptr_info, int minor); +typedef uint8_t * (*parse_msg_func_t)(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size_out, message_destructor_t *free_message); +typedef uint8_t * (*spice_parse_channel_func_t)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message); + +struct PointerInfo { + uint64_t offset; + parse_func_t parse; + void * *dest; + uint32_t nelements; +}; + +static uint8_t * parse_msgc_ack_sync(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcAckSync *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgcAckSync); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcAckSync); + in = start; + + out = (SpiceMsgcAckSync *)data; + + out->generation = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_SpiceMsgEmpty(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + + nw_size = 0; + mem_size = sizeof(SpiceMsgEmpty); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgEmpty); + in = start; + + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_pong(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgPing *out; + + nw_size = 12; + mem_size = sizeof(SpiceMsgPing); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgPing); + in = start; + + out = (SpiceMsgPing *)data; + + out->id = consume_uint32(&in); + out->timestamp = consume_uint64(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static void nofree(uint8_t *data) +{ +} + +static uint8_t * parse_SpiceMsgData(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t data__nw_size; + uint32_t data__nelements; + + { /* data */ + data__nelements = message_end - (start + 0); + + data__nw_size = data__nelements; + } + + nw_size = 0 + data__nw_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = message_start; + *size = message_end - message_start; + *free_message = nofree; + return data; + +} + +static uint8_t * parse_msgc_disconnecting(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgDisconnect *out; + + nw_size = 12; + mem_size = sizeof(SpiceMsgDisconnect); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgDisconnect); + in = start; + + out = (SpiceMsgDisconnect *)data; + + out->time_stamp = consume_uint64(&in); + out->reason = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_main_client_info(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcClientInfo *out; + + nw_size = 8; + mem_size = sizeof(SpiceMsgcClientInfo); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcClientInfo); + in = start; + + out = (SpiceMsgcClientInfo *)data; + + out->cache_size = consume_uint64(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_main_mouse_mode_request(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcMainMouseModeRequest *out; + + nw_size = 2; + mem_size = sizeof(SpiceMsgcMainMouseModeRequest); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcMainMouseModeRequest); + in = start; + + out = (SpiceMsgcMainMouseModeRequest *)data; + + out->mode = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_main_agent_start(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcMainAgentStart *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgcMainAgentStart); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcMainAgentStart); + in = start; + + out = (SpiceMsgcMainAgentStart *)data; + + out->num_tokens = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_main_agent_token(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcMainAgentTokens *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgcMainAgentTokens); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcMainAgentTokens); + in = start; + + out = (SpiceMsgcMainAgentTokens *)data; + + out->num_tokens = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_MainChannel_msgc(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[6] = { + parse_msgc_ack_sync, + parse_SpiceMsgEmpty, + parse_msgc_pong, + parse_SpiceMsgEmpty, + parse_SpiceMsgData, + parse_msgc_disconnecting + }; + static parse_msg_func_t funcs2[9] = { + parse_msgc_main_client_info, + parse_SpiceMsgEmpty, + parse_SpiceMsgEmpty, + parse_SpiceMsgEmpty, + parse_msgc_main_mouse_mode_request, + parse_msgc_main_agent_start, + parse_SpiceMsgData, + parse_msgc_main_agent_token, + parse_SpiceMsgEmpty + }; + if (message_type >= 1 && message_type < 7) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 110) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msgc_display_init(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcDisplayInit *out; + + nw_size = 14; + mem_size = sizeof(SpiceMsgcDisplayInit); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcDisplayInit); + in = start; + + out = (SpiceMsgcDisplayInit *)data; + + out->pixmap_cache_id = consume_uint8(&in); + out->pixmap_cache_size = consume_int64(&in); + out->glz_dictionary_id = consume_uint8(&in); + out->glz_dictionary_window_size = consume_int32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_DisplayChannel_msgc(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[6] = { + parse_msgc_ack_sync, + parse_SpiceMsgEmpty, + parse_msgc_pong, + parse_SpiceMsgEmpty, + parse_SpiceMsgData, + parse_msgc_disconnecting + }; + static parse_msg_func_t funcs2[1] = { + parse_msgc_display_init + }; + if (message_type >= 1 && message_type < 7) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 102) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msgc_inputs_key_down(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcKeyDown *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgcKeyDown); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcKeyDown); + in = start; + + out = (SpiceMsgcKeyDown *)data; + + out->code = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_inputs_key_up(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcKeyUp *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgcKeyUp); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcKeyUp); + in = start; + + out = (SpiceMsgcKeyUp *)data; + + out->code = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_inputs_key_modifiers(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcKeyModifiers *out; + + nw_size = 2; + mem_size = sizeof(SpiceMsgcKeyModifiers); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcKeyModifiers); + in = start; + + out = (SpiceMsgcKeyModifiers *)data; + + out->modifiers = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_inputs_mouse_motion(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcMouseMotion *out; + + nw_size = 10; + mem_size = sizeof(SpiceMsgcMouseMotion); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcMouseMotion); + in = start; + + out = (SpiceMsgcMouseMotion *)data; + + out->dx = consume_int32(&in); + out->dy = consume_int32(&in); + out->buttons_state = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_inputs_mouse_position(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcMousePosition *out; + + nw_size = 11; + mem_size = sizeof(SpiceMsgcMousePosition); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcMousePosition); + in = start; + + out = (SpiceMsgcMousePosition *)data; + + out->x = consume_uint32(&in); + out->y = consume_uint32(&in); + out->buttons_state = consume_uint16(&in); + out->display_id = consume_uint8(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_inputs_mouse_press(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcMousePress *out; + + nw_size = 3; + mem_size = sizeof(SpiceMsgcMousePress); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcMousePress); + in = start; + + out = (SpiceMsgcMousePress *)data; + + out->button = consume_uint8(&in); + out->buttons_state = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_inputs_mouse_release(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcMouseRelease *out; + + nw_size = 3; + mem_size = sizeof(SpiceMsgcMouseRelease); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcMouseRelease); + in = start; + + out = (SpiceMsgcMouseRelease *)data; + + out->button = consume_uint8(&in); + out->buttons_state = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_InputsChannel_msgc(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[6] = { + parse_msgc_ack_sync, + parse_SpiceMsgEmpty, + parse_msgc_pong, + parse_SpiceMsgEmpty, + parse_SpiceMsgData, + parse_msgc_disconnecting + }; + static parse_msg_func_t funcs2[3] = { + parse_msgc_inputs_key_down, + parse_msgc_inputs_key_up, + parse_msgc_inputs_key_modifiers + }; + static parse_msg_func_t funcs3[4] = { + parse_msgc_inputs_mouse_motion, + parse_msgc_inputs_mouse_position, + parse_msgc_inputs_mouse_press, + parse_msgc_inputs_mouse_release + }; + if (message_type >= 1 && message_type < 7) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 104) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 111 && message_type < 115) { + return funcs3[message_type-111](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_CursorChannel_msgc(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[6] = { + parse_msgc_ack_sync, + parse_SpiceMsgEmpty, + parse_msgc_pong, + parse_SpiceMsgEmpty, + parse_SpiceMsgData, + parse_msgc_disconnecting + }; + if (message_type >= 1 && message_type < 7) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_PlaybackChannel_msgc(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[6] = { + parse_msgc_ack_sync, + parse_SpiceMsgEmpty, + parse_msgc_pong, + parse_SpiceMsgEmpty, + parse_SpiceMsgData, + parse_msgc_disconnecting + }; + if (message_type >= 1 && message_type < 7) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msgc_record_data(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t data__nw_size; + uint32_t data__nelements; + SpiceMsgcRecordPacket *out; + + { /* data */ + data__nelements = message_end - (start + 4); + + data__nw_size = data__nelements; + } + + nw_size = 4 + data__nw_size; + mem_size = sizeof(SpiceMsgcRecordPacket); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcRecordPacket); + in = start; + + out = (SpiceMsgcRecordPacket *)data; + + out->time = consume_uint32(&in); + /* use array as pointer */ + out->data = (uint8_t *)in; + out->data_size = data__nelements; + in += data__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_record_mode(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t data__nw_size; + uint32_t data__nelements; + SpiceMsgcRecordMode *out; + + { /* data */ + data__nelements = message_end - (start + 6); + + data__nw_size = data__nelements; + } + + nw_size = 6 + data__nw_size; + mem_size = sizeof(SpiceMsgcRecordMode); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcRecordMode); + in = start; + + out = (SpiceMsgcRecordMode *)data; + + out->time = consume_uint32(&in); + out->mode = consume_uint16(&in); + /* use array as pointer */ + out->data = (uint8_t *)in; + out->data_size = data__nelements; + in += data__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_record_start_mark(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcRecordStartMark *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgcRecordStartMark); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcRecordStartMark); + in = start; + + out = (SpiceMsgcRecordStartMark *)data; + + out->time = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_RecordChannel_msgc(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[6] = { + parse_msgc_ack_sync, + parse_SpiceMsgEmpty, + parse_msgc_pong, + parse_SpiceMsgEmpty, + parse_SpiceMsgData, + parse_msgc_disconnecting + }; + static parse_msg_func_t funcs2[3] = { + parse_msgc_record_data, + parse_msgc_record_mode, + parse_msgc_record_start_mark + }; + if (message_type >= 1 && message_type < 7) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 104) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + + +static uint8_t * parse_msgc_tunnel_service_add(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SPICE_GNUC_UNUSED intptr_t ptr_size; + uint32_t n_ptr=0; + PointerInfo ptr_info[2]; + size_t name__extra_size; + size_t description__extra_size; + size_t u__nw_size; + uint16_t type__value; + SpiceMsgcTunnelAddGenericService *out; + uint32_t i; + + { /* name */ + uint32_t name__value; + uint32_t name__array__nw_size; + pos = (start + 14); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + name__value = read_uint32(pos); + if (SPICE_UNLIKELY(message_start + name__value >= message_end)) { + goto error; + } + name__array__nw_size = spice_strnlen((char *)message_start + name__value, message_end - (message_start + name__value)); + if (SPICE_UNLIKELY(*(message_start + name__value + name__array__nw_size) != 0)) { + goto error; + } + /* @nocopy, so no extra size */ + name__extra_size = 0; + } + + { /* description */ + uint32_t description__value; + uint32_t description__array__nw_size; + pos = (start + 18); + if (SPICE_UNLIKELY(pos + 4 > message_end)) { + goto error; + } + description__value = read_uint32(pos); + if (SPICE_UNLIKELY(message_start + description__value >= message_end)) { + goto error; + } + description__array__nw_size = spice_strnlen((char *)message_start + description__value, message_end - (message_start + description__value)); + if (SPICE_UNLIKELY(*(message_start + description__value + description__array__nw_size) != 0)) { + goto error; + } + /* @nocopy, so no extra size */ + description__extra_size = 0; + } + + { /* u */ + pos = start + 0; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + type__value = read_uint16(pos); + if (type__value == SPICE_TUNNEL_SERVICE_TYPE_IPP) { + SPICE_GNUC_UNUSED uint8_t *start2 = (start + 22); + size_t u__nw_size; + uint16_t type__value; + { /* u */ + uint32_t u__nelements; + pos = start2 + 0; + if (SPICE_UNLIKELY(pos + 2 > message_end)) { + goto error; + } + type__value = read_uint16(pos); + if (type__value == SPICE_TUNNEL_IP_TYPE_IPv4) { + u__nelements = 4; + + u__nw_size = u__nelements; + } else { + u__nw_size = 0; + } + + } + + u__nw_size = 2 + u__nw_size; + } else { + u__nw_size = 0; + } + + } + + nw_size = 22 + u__nw_size; + mem_size = sizeof(SpiceMsgcTunnelAddGenericService) + name__extra_size + description__extra_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcTunnelAddGenericService); + in = start; + + out = (SpiceMsgcTunnelAddGenericService *)data; + + out->type = consume_uint16(&in); + out->id = consume_uint32(&in); + out->group = consume_uint32(&in); + out->port = consume_uint32(&in); + /* Reuse data from network message */ + out->name = (size_t)(message_start + consume_uint32(&in)); + /* Reuse data from network message */ + out->description = (size_t)(message_start + consume_uint32(&in)); + if (out->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) { + out->u.ip.type = consume_uint16(&in); + if (out->u.ip.type == SPICE_TUNNEL_IP_TYPE_IPv4) { + uint32_t ipv4__nelements; + ipv4__nelements = 4; + memcpy(out->u.ip.u.ipv4, in, ipv4__nelements); + in += ipv4__nelements; + } + } + + assert(in <= message_end); + + for (i = 0; i < n_ptr; i++) { + if (ptr_info[i].offset == 0) { + *ptr_info[i].dest = NULL; + } else { + /* Align to 32 bit */ + end = (uint8_t *)SPICE_ALIGN((size_t)end, 4); + *ptr_info[i].dest = (void *)end; + end = ptr_info[i].parse(message_start, message_end, end, &ptr_info[i], minor); + if (SPICE_UNLIKELY(end == NULL)) { + goto error; + } + } + } + + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_tunnel_service_remove(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcTunnelRemoveService *out; + + nw_size = 4; + mem_size = sizeof(SpiceMsgcTunnelRemoveService); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcTunnelRemoveService); + in = start; + + out = (SpiceMsgcTunnelRemoveService *)data; + + out->id = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_tunnel_socket_open_ack(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcTunnelSocketOpenAck *out; + + nw_size = 6; + mem_size = sizeof(SpiceMsgcTunnelSocketOpenAck); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcTunnelSocketOpenAck); + in = start; + + out = (SpiceMsgcTunnelSocketOpenAck *)data; + + out->connection_id = consume_uint16(&in); + out->tokens = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_tunnel_socket_open_nack(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcTunnelSocketOpenNack *out; + + nw_size = 2; + mem_size = sizeof(SpiceMsgcTunnelSocketOpenNack); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcTunnelSocketOpenNack); + in = start; + + out = (SpiceMsgcTunnelSocketOpenNack *)data; + + out->connection_id = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_tunnel_socket_fin(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcTunnelSocketFin *out; + + nw_size = 2; + mem_size = sizeof(SpiceMsgcTunnelSocketFin); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcTunnelSocketFin); + in = start; + + out = (SpiceMsgcTunnelSocketFin *)data; + + out->connection_id = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_tunnel_socket_closed(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcTunnelSocketClosed *out; + + nw_size = 2; + mem_size = sizeof(SpiceMsgcTunnelSocketClosed); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcTunnelSocketClosed); + in = start; + + out = (SpiceMsgcTunnelSocketClosed *)data; + + out->connection_id = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_tunnel_socket_closed_ack(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcTunnelSocketClosedAck *out; + + nw_size = 2; + mem_size = sizeof(SpiceMsgcTunnelSocketClosedAck); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcTunnelSocketClosedAck); + in = start; + + out = (SpiceMsgcTunnelSocketClosedAck *)data; + + out->connection_id = consume_uint16(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_tunnel_socket_data(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + size_t data__nw_size, data__mem_size; + uint32_t data__nelements; + SpiceMsgcTunnelSocketData *out; + + { /* data */ + data__nelements = message_end - (start + 2); + + data__nw_size = data__nelements; + data__mem_size = sizeof(uint8_t) * data__nelements; + } + + nw_size = 2 + data__nw_size; + mem_size = sizeof(SpiceMsgcTunnelSocketData) + data__mem_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcTunnelSocketData); + in = start; + + out = (SpiceMsgcTunnelSocketData *)data; + + out->connection_id = consume_uint16(&in); + memcpy(out->data, in, data__nelements); + in += data__nelements; + end += data__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_msgc_tunnel_socket_token(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + size_t mem_size; + uint8_t *in, *end; + SpiceMsgcTunnelSocketTokens *out; + + nw_size = 6; + mem_size = sizeof(SpiceMsgcTunnelSocketTokens); + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(SpiceMsgcTunnelSocketTokens); + in = start; + + out = (SpiceMsgcTunnelSocketTokens *)data; + + out->connection_id = consume_uint16(&in); + out->num_tokens = consume_uint32(&in); + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_TunnelChannel_msgc(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[6] = { + parse_msgc_ack_sync, + parse_SpiceMsgEmpty, + parse_msgc_pong, + parse_SpiceMsgEmpty, + parse_SpiceMsgData, + parse_msgc_disconnecting + }; + static parse_msg_func_t funcs2[9] = { + parse_msgc_tunnel_service_add, + parse_msgc_tunnel_service_remove, + parse_msgc_tunnel_socket_open_ack, + parse_msgc_tunnel_socket_open_nack, + parse_msgc_tunnel_socket_fin, + parse_msgc_tunnel_socket_closed, + parse_msgc_tunnel_socket_closed_ack, + parse_msgc_tunnel_socket_data, + parse_msgc_tunnel_socket_token + }; + if (message_type >= 1 && message_type < 7) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 110) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + + +#ifdef USE_SMARTCARD + +static uint8_t * parse_msgc_smartcard_reader_add(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message) +{ + SPICE_GNUC_UNUSED uint8_t *pos; + uint8_t *start = message_start; + uint8_t *data = NULL; + size_t nw_size; + uint8_t *in, *end; + size_t reader_name__nw_size; + uint32_t reader_name__nelements; + VSCMsgReaderAdd *out; + + { /* reader_name */ + reader_name__nelements = message_end - (start + 0); + + reader_name__nw_size = reader_name__nelements; + } + + nw_size = 0 + reader_name__nw_size; + + /* Check if message fits in reported side */ + if (start + nw_size > message_end) { + return NULL; + } + + /* Validated extents and calculated size */ + data = (uint8_t *)malloc(mem_size); + if (SPICE_UNLIKELY(data == NULL)) { + goto error; + } + end = data + sizeof(VSCMsgReaderAdd); + in = start; + + out = (VSCMsgReaderAdd *)data; + + memcpy(out->reader_name, in, reader_name__nelements); + in += reader_name__nelements; + + assert(in <= message_end); + assert(end <= data + mem_size); + + *size = end - data; + *free_message = (message_destructor_t) free; + return data; + + error: + if (data != NULL) { + free(data); + } + return NULL; +} + +static uint8_t * parse_SmartcardChannel_msgc(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[6] = { + parse_msgc_ack_sync, + parse_SpiceMsgEmpty, + parse_msgc_pong, + parse_SpiceMsgEmpty, + parse_SpiceMsgData, + parse_msgc_disconnecting + }; + static parse_msg_func_t funcs2[1] = { + parse_msgc_smartcard_reader_add + }; + if (message_type >= 1 && message_type < 7) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 102) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} +#endif /* USE_SMARTCARD */ + + + +static uint8_t * parse_UsbredirChannel_msgc(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + static parse_msg_func_t funcs1[6] = { + parse_msgc_ack_sync, + parse_SpiceMsgEmpty, + parse_msgc_pong, + parse_SpiceMsgEmpty, + parse_SpiceMsgData, + parse_msgc_disconnecting + }; + static parse_msg_func_t funcs2[1] = { + parse_SpiceMsgData + }; + if (message_type >= 1 && message_type < 7) { + return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); + } else if (message_type >= 101 && message_type < 102) { + return funcs2[message_type-101](message_start, message_end, minor, size_out, free_message); + } + return NULL; +} + +spice_parse_channel_func_t spice_get_client_channel_parser(uint32_t channel, unsigned int *max_message_type) +{ + static struct {spice_parse_channel_func_t func; unsigned int max_messages; } channels[10] = { + { NULL, 0 }, + { parse_MainChannel_msgc, 109}, + { parse_DisplayChannel_msgc, 101}, + { parse_InputsChannel_msgc, 114}, + { parse_CursorChannel_msgc, 6}, + { parse_PlaybackChannel_msgc, 6}, + { parse_RecordChannel_msgc, 103}, + { parse_TunnelChannel_msgc, 109}, +#ifdef USE_SMARTCARD + { parse_SmartcardChannel_msgc, 101}, +#else /* USE_SMARTCARD */ + { NULL, 0 }, +#endif /* USE_SMARTCARD */ + { parse_UsbredirChannel_msgc, 101} + }; + if (channel < 10) { + if (max_message_type != NULL) { + *max_message_type = channels[channel].max_messages; + } + return channels[channel].func; + } + return NULL; +} + +uint8_t * spice_parse_reply(uint8_t *message_start, uint8_t *message_end, uint32_t channel, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message) +{ + spice_parse_channel_func_t func; + func = spice_get_client_channel_parser(channel, NULL); + if (func != NULL) { + return func(message_start, message_end, message_type, minor, size_out, free_message); + } + return NULL; +} diff -Nru spice-gtk-0.9/spice-common/common/generated_server_marshallers.c spice-gtk-0.12/spice-common/common/generated_server_marshallers.c --- spice-gtk-0.9/spice-common/common/generated_server_marshallers.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/generated_server_marshallers.c 2012-04-24 11:24:36.000000000 +0000 @@ -0,0 +1,1723 @@ +/* this is a file autogenerated by spice_codegen.py */ +#ifdef HAVE_CONFIG_H +#include +#endif +#include "messages.h" +#include +#include +#include +#include +#include +#include +#include "marshaller.h" + +#ifdef _MSC_VER +#pragma warning(disable:4101) +#pragma warning(disable:4018) +#endif + +void spice_marshall_msg_migrate(SpiceMarshaller *m, SpiceMsgMigrate *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgMigrate *src; + src = (SpiceMsgMigrate *)msg; + + spice_marshaller_add_uint32(m, src->flags); +} + +void spice_marshall_SpiceMsgData(SpiceMarshaller *m, SpiceMsgData *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; +} + +void spice_marshall_msg_set_ack(SpiceMarshaller *m, SpiceMsgSetAck *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgSetAck *src; + src = (SpiceMsgSetAck *)msg; + + spice_marshaller_add_uint32(m, src->generation); + spice_marshaller_add_uint32(m, src->window); +} + +void spice_marshall_msg_ping(SpiceMarshaller *m, SpiceMsgPing *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgPing *src; + src = (SpiceMsgPing *)msg; + + spice_marshaller_add_uint32(m, src->id); + spice_marshaller_add_uint64(m, src->timestamp); + /* Remaining data must be appended manually */ +} + +void spice_marshall_msg_wait_for_channels(SpiceMarshaller *m, SpiceMsgWaitForChannels *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgWaitForChannels *src; + SpiceWaitForChannel *wait_list__element; + uint32_t i; + src = (SpiceMsgWaitForChannels *)msg; + + spice_marshaller_add_uint8(m, src->wait_count); + wait_list__element = src->wait_list; + for (i = 0; i < src->wait_count; i++) { + SpiceWaitForChannel *src2; + src2 = (SpiceWaitForChannel *)wait_list__element; + + spice_marshaller_add_uint8(m, src2->channel_type); + spice_marshaller_add_uint8(m, src2->channel_id); + spice_marshaller_add_uint64(m, src2->message_serial); + wait_list__element++; + } +} + +void spice_marshall_msg_disconnecting(SpiceMarshaller *m, SpiceMsgDisconnect *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisconnect *src; + src = (SpiceMsgDisconnect *)msg; + + spice_marshaller_add_uint64(m, src->time_stamp); + spice_marshaller_add_uint32(m, src->reason); +} + +void spice_marshall_msg_notify(SpiceMarshaller *m, SpiceMsgNotify *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgNotify *src; + src = (SpiceMsgNotify *)msg; + + spice_marshaller_add_uint64(m, src->time_stamp); + spice_marshaller_add_uint32(m, src->severity); + spice_marshaller_add_uint32(m, src->visibilty); + spice_marshaller_add_uint32(m, src->what); + spice_marshaller_add_uint32(m, src->message_len); + /* Don't marshall @nomarshal message */ +} + +SPICE_GNUC_UNUSED static void spice_marshall_array_uint8(SpiceMarshaller *m, uint8_t *ptr, unsigned count) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + uint32_t i; + + for (i = 0; i < count; i++) { + spice_marshaller_add_uint8(m, *ptr++); + } +} + +void spice_marshall_msg_main_migrate_begin(SpiceMarshaller *m, SpiceMsgMainMigrationBegin *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgMainMigrationBegin *src; + src = (SpiceMsgMainMigrationBegin *)msg; + + spice_marshaller_add_uint16(m, src->port); + spice_marshaller_add_uint16(m, src->sport); + spice_marshaller_add_uint32(m, src->host_size); + m2 = spice_marshaller_get_ptr_submarshaller(m, 0); + spice_marshall_array_uint8(m2, src->host_data, src->host_size); + spice_marshaller_add_uint32(m, src->cert_subject_size); + m2 = spice_marshaller_get_ptr_submarshaller(m, 0); + if (src->cert_subject_data != NULL) { + spice_marshall_array_uint8(m2, src->cert_subject_data, src->cert_subject_size); + } +} + +void spice_marshall_SpiceMsgEmpty(SpiceMarshaller *m, SpiceMsgEmpty *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; +} + +void spice_marshall_msg_main_init(SpiceMarshaller *m, SpiceMsgMainInit *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgMainInit *src; + src = (SpiceMsgMainInit *)msg; + + spice_marshaller_add_uint32(m, src->session_id); + spice_marshaller_add_uint32(m, src->display_channels_hint); + spice_marshaller_add_uint32(m, src->supported_mouse_modes); + spice_marshaller_add_uint32(m, src->current_mouse_mode); + spice_marshaller_add_uint32(m, src->agent_connected); + spice_marshaller_add_uint32(m, src->agent_tokens); + spice_marshaller_add_uint32(m, src->multi_media_time); + spice_marshaller_add_uint32(m, src->ram_hint); +} + +void spice_marshall_msg_main_channels_list(SpiceMarshaller *m, SpiceMsgChannels *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgChannels *src; + SpiceChannelId *channels__element; + uint32_t i; + src = (SpiceMsgChannels *)msg; + + spice_marshaller_add_uint32(m, src->num_of_channels); + channels__element = src->channels; + for (i = 0; i < src->num_of_channels; i++) { + SpiceChannelId *src2; + src2 = (SpiceChannelId *)channels__element; + + spice_marshaller_add_uint8(m, src2->type); + spice_marshaller_add_uint8(m, src2->id); + channels__element++; + } +} + +void spice_marshall_msg_main_mouse_mode(SpiceMarshaller *m, SpiceMsgMainMouseMode *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgMainMouseMode *src; + src = (SpiceMsgMainMouseMode *)msg; + + spice_marshaller_add_uint16(m, src->supported_modes); + spice_marshaller_add_uint16(m, src->current_mode); +} + +void spice_marshall_msg_main_multi_media_time(SpiceMarshaller *m, SpiceMsgMainMultiMediaTime *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgMainMultiMediaTime *src; + src = (SpiceMsgMainMultiMediaTime *)msg; + + spice_marshaller_add_uint32(m, src->time); +} + +void spice_marshall_msg_main_agent_disconnected(SpiceMarshaller *m, SpiceMsgMainAgentDisconnect *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgMainAgentDisconnect *src; + src = (SpiceMsgMainAgentDisconnect *)msg; + + spice_marshaller_add_uint32(m, src->error_code); +} + +void spice_marshall_msg_main_agent_token(SpiceMarshaller *m, SpiceMsgMainAgentTokens *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgMainAgentTokens *src; + src = (SpiceMsgMainAgentTokens *)msg; + + spice_marshaller_add_uint32(m, src->num_tokens); +} + +void spice_marshall_msg_main_migrate_switch_host(SpiceMarshaller *m, SpiceMsgMainMigrationSwitchHost *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgMainMigrationSwitchHost *src; + src = (SpiceMsgMainMigrationSwitchHost *)msg; + + spice_marshaller_add_uint16(m, src->port); + spice_marshaller_add_uint16(m, src->sport); + spice_marshaller_add_uint32(m, src->host_size); + m2 = spice_marshaller_get_ptr_submarshaller(m, 0); + if (src->host_data != NULL) { + spice_marshall_array_uint8(m2, src->host_data, src->host_size); + } + spice_marshaller_add_uint32(m, src->cert_subject_size); + m2 = spice_marshaller_get_ptr_submarshaller(m, 0); + if (src->cert_subject_data != NULL) { + spice_marshall_array_uint8(m2, src->cert_subject_data, src->cert_subject_size); + } +} + +void spice_marshall_msg_main_name(SpiceMarshaller *m, SpiceMsgMainName *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgMainName *src; + uint8_t *name__element; + uint32_t i; + src = (SpiceMsgMainName *)msg; + + spice_marshaller_add_uint32(m, src->name_len); + name__element = src->name; + for (i = 0; i < src->name_len; i++) { + spice_marshaller_add_uint8(m, *name__element); + name__element++; + } +} + +void spice_marshall_msg_main_uuid(SpiceMarshaller *m, SpiceMsgMainUuid *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgMainUuid *src; + uint8_t *uuid__element; + uint32_t i; + src = (SpiceMsgMainUuid *)msg; + + uuid__element = src->uuid; + for (i = 0; i < 16; i++) { + spice_marshaller_add_uint8(m, *uuid__element); + uuid__element++; + } +} + +void spice_marshall_msg_display_mode(SpiceMarshaller *m, SpiceMsgDisplayMode *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayMode *src; + src = (SpiceMsgDisplayMode *)msg; + + spice_marshaller_add_uint32(m, src->x_res); + spice_marshaller_add_uint32(m, src->y_res); + spice_marshaller_add_uint32(m, src->bits); +} + +void spice_marshall_msg_display_copy_bits(SpiceMarshaller *m, SpiceMsgDisplayCopyBits *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayCopyBits *src; + uint32_t i; + src = (SpiceMsgDisplayCopyBits *)msg; + + /* base */ { + spice_marshaller_add_uint32(m, src->base.surface_id); + /* box */ { + spice_marshaller_add_int32(m, src->base.box.top); + spice_marshaller_add_int32(m, src->base.box.left); + spice_marshaller_add_int32(m, src->base.box.bottom); + spice_marshaller_add_int32(m, src->base.box.right); + } + /* clip */ { + spice_marshaller_add_uint8(m, src->base.clip.type); + if (src->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + SpiceRect *rects__element; + spice_marshaller_add_uint32(m, src->base.clip.rects->num_rects); + rects__element = src->base.clip.rects->rects; + for (i = 0; i < src->base.clip.rects->num_rects; i++) { + SpiceRect *src2; + src2 = (SpiceRect *)rects__element; + + spice_marshaller_add_int32(m, src2->top); + spice_marshaller_add_int32(m, src2->left); + spice_marshaller_add_int32(m, src2->bottom); + spice_marshaller_add_int32(m, src2->right); + rects__element++; + } + } + } + } + /* src_pos */ { + spice_marshaller_add_int32(m, src->src_pos.x); + spice_marshaller_add_int32(m, src->src_pos.y); + } +} + +void spice_marshall_msg_display_inval_list(SpiceMarshaller *m, SpiceResourceList *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceResourceList *src; + SpiceResourceID *resources__element; + uint32_t i; + src = (SpiceResourceList *)msg; + + spice_marshaller_add_uint16(m, src->count); + resources__element = src->resources; + for (i = 0; i < src->count; i++) { + SpiceResourceID *src2; + src2 = (SpiceResourceID *)resources__element; + + spice_marshaller_add_uint8(m, src2->type); + spice_marshaller_add_uint64(m, src2->id); + resources__element++; + } +} + +void spice_marshall_msg_display_inval_all_pixmaps(SpiceMarshaller *m, SpiceMsgWaitForChannels *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgWaitForChannels *src; + SpiceWaitForChannel *wait_list__element; + uint32_t i; + src = (SpiceMsgWaitForChannels *)msg; + + spice_marshaller_add_uint8(m, src->wait_count); + wait_list__element = src->wait_list; + for (i = 0; i < src->wait_count; i++) { + SpiceWaitForChannel *src2; + src2 = (SpiceWaitForChannel *)wait_list__element; + + spice_marshaller_add_uint8(m, src2->channel_type); + spice_marshaller_add_uint8(m, src2->channel_id); + spice_marshaller_add_uint64(m, src2->message_serial); + wait_list__element++; + } +} + +void spice_marshall_msg_display_inval_palette(SpiceMarshaller *m, SpiceMsgDisplayInvalOne *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayInvalOne *src; + src = (SpiceMsgDisplayInvalOne *)msg; + + spice_marshaller_add_uint64(m, src->id); +} + +void spice_marshall_msg_display_stream_create(SpiceMarshaller *m, SpiceMsgDisplayStreamCreate *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayStreamCreate *src; + uint32_t i; + src = (SpiceMsgDisplayStreamCreate *)msg; + + spice_marshaller_add_uint32(m, src->surface_id); + spice_marshaller_add_uint32(m, src->id); + spice_marshaller_add_uint8(m, src->flags); + spice_marshaller_add_uint8(m, src->codec_type); + spice_marshaller_add_uint64(m, src->stamp); + spice_marshaller_add_uint32(m, src->stream_width); + spice_marshaller_add_uint32(m, src->stream_height); + spice_marshaller_add_uint32(m, src->src_width); + spice_marshaller_add_uint32(m, src->src_height); + /* dest */ { + spice_marshaller_add_int32(m, src->dest.top); + spice_marshaller_add_int32(m, src->dest.left); + spice_marshaller_add_int32(m, src->dest.bottom); + spice_marshaller_add_int32(m, src->dest.right); + } + /* clip */ { + spice_marshaller_add_uint8(m, src->clip.type); + if (src->clip.type == SPICE_CLIP_TYPE_RECTS) { + SpiceRect *rects__element; + spice_marshaller_add_uint32(m, src->clip.rects->num_rects); + rects__element = src->clip.rects->rects; + for (i = 0; i < src->clip.rects->num_rects; i++) { + SpiceRect *src2; + src2 = (SpiceRect *)rects__element; + + spice_marshaller_add_int32(m, src2->top); + spice_marshaller_add_int32(m, src2->left); + spice_marshaller_add_int32(m, src2->bottom); + spice_marshaller_add_int32(m, src2->right); + rects__element++; + } + } + } +} + +void spice_marshall_msg_display_stream_data(SpiceMarshaller *m, SpiceMsgDisplayStreamData *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayStreamData *src; + src = (SpiceMsgDisplayStreamData *)msg; + + spice_marshaller_add_uint32(m, src->id); + spice_marshaller_add_uint32(m, src->multi_media_time); + spice_marshaller_add_uint32(m, src->data_size); + /* Don't marshall @nomarshal data */ +} + +void spice_marshall_msg_display_stream_clip(SpiceMarshaller *m, SpiceMsgDisplayStreamClip *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayStreamClip *src; + uint32_t i; + src = (SpiceMsgDisplayStreamClip *)msg; + + spice_marshaller_add_uint32(m, src->id); + /* clip */ { + spice_marshaller_add_uint8(m, src->clip.type); + if (src->clip.type == SPICE_CLIP_TYPE_RECTS) { + SpiceRect *rects__element; + spice_marshaller_add_uint32(m, src->clip.rects->num_rects); + rects__element = src->clip.rects->rects; + for (i = 0; i < src->clip.rects->num_rects; i++) { + SpiceRect *src2; + src2 = (SpiceRect *)rects__element; + + spice_marshaller_add_int32(m, src2->top); + spice_marshaller_add_int32(m, src2->left); + spice_marshaller_add_int32(m, src2->bottom); + spice_marshaller_add_int32(m, src2->right); + rects__element++; + } + } + } +} + +void spice_marshall_msg_display_stream_destroy(SpiceMarshaller *m, SpiceMsgDisplayStreamDestroy *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayStreamDestroy *src; + src = (SpiceMsgDisplayStreamDestroy *)msg; + + spice_marshaller_add_uint32(m, src->id); +} + +void spice_marshall_msg_display_draw_fill(SpiceMarshaller *m, SpiceMsgDisplayDrawFill *msg, SpiceMarshaller **brush_pat_out, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + *brush_pat_out = NULL; + *mask_bitmap_out = NULL; +} + +void spice_marshall_msg_display_draw_opaque(SpiceMarshaller *m, SpiceMsgDisplayDrawOpaque *msg, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **pat_out, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + *src_bitmap_out = NULL; + *pat_out = NULL; + *mask_bitmap_out = NULL; +} + +void spice_marshall_Palette(SpiceMarshaller *m, SpicePalette *ptr) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpicePalette *src; + uint32_t *ents__element; + uint32_t i; + + src = (SpicePalette *)ptr; + + spice_marshaller_add_uint64(m, src->unique); + spice_marshaller_add_uint16(m, src->num_ents); + ents__element = src->ents; + for (i = 0; i < src->num_ents; i++) { + spice_marshaller_add_uint32(m, *ents__element); + ents__element++; + } +} + +void spice_marshall_Image(SpiceMarshaller *m, SpiceImage *ptr, SpiceMarshaller **bitmap_palette_out, SpiceMarshaller **lzplt_palette_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceImage *src; + *bitmap_palette_out = NULL; + *lzplt_palette_out = NULL; + + src = (SpiceImage *)ptr; + + /* descriptor */ { + spice_marshaller_add_uint64(m, src->descriptor.id); + spice_marshaller_add_uint8(m, src->descriptor.type); + spice_marshaller_add_uint8(m, src->descriptor.flags); + spice_marshaller_add_uint32(m, src->descriptor.width); + spice_marshaller_add_uint32(m, src->descriptor.height); + } + if (src->descriptor.type == SPICE_IMAGE_TYPE_BITMAP) { + spice_marshaller_add_uint8(m, src->u.bitmap.format); + spice_marshaller_add_uint8(m, src->u.bitmap.flags); + spice_marshaller_add_uint32(m, src->u.bitmap.x); + spice_marshaller_add_uint32(m, src->u.bitmap.y); + spice_marshaller_add_uint32(m, src->u.bitmap.stride); + if ((src->u.bitmap.flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { + spice_marshaller_add_uint64(m, src->u.bitmap.palette_id); + } else if (1) { + *bitmap_palette_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } + /* Don't marshall @nomarshal data */ + } else if (src->descriptor.type == SPICE_IMAGE_TYPE_QUIC) { + spice_marshaller_add_uint32(m, src->u.quic.data_size); + /* Don't marshall @nomarshal data */ + } else if (src->descriptor.type == SPICE_IMAGE_TYPE_LZ_RGB || src->descriptor.type == SPICE_IMAGE_TYPE_GLZ_RGB) { + spice_marshaller_add_uint32(m, src->u.lz_rgb.data_size); + /* Don't marshall @nomarshal data */ + } else if (src->descriptor.type == SPICE_IMAGE_TYPE_JPEG) { + spice_marshaller_add_uint32(m, src->u.jpeg.data_size); + /* Don't marshall @nomarshal data */ + } else if (src->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) { + spice_marshaller_add_uint8(m, src->u.lz_plt.flags); + spice_marshaller_add_uint32(m, src->u.lz_plt.data_size); + if ((src->u.lz_plt.flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) { + spice_marshaller_add_uint64(m, src->u.lz_plt.palette_id); + } else if (1) { + *lzplt_palette_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } + /* Don't marshall @nomarshal data */ + } else if (src->descriptor.type == SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB) { + spice_marshaller_add_uint32(m, src->u.zlib_glz.glz_data_size); + spice_marshaller_add_uint32(m, src->u.zlib_glz.data_size); + /* Don't marshall @nomarshal data */ + } else if (src->descriptor.type == SPICE_IMAGE_TYPE_JPEG_ALPHA) { + spice_marshaller_add_uint8(m, src->u.jpeg_alpha.flags); + spice_marshaller_add_uint32(m, src->u.jpeg_alpha.jpeg_size); + spice_marshaller_add_uint32(m, src->u.jpeg_alpha.data_size); + /* Don't marshall @nomarshal data */ + } else if (src->descriptor.type == SPICE_IMAGE_TYPE_SURFACE) { + spice_marshaller_add_uint32(m, src->u.surface.surface_id); + } +} + +void spice_marshall_msg_display_draw_copy(SpiceMarshaller *m, SpiceMsgDisplayDrawCopy *msg, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayDrawCopy *src; + uint32_t i; + *src_bitmap_out = NULL; + *mask_bitmap_out = NULL; + src = (SpiceMsgDisplayDrawCopy *)msg; + + /* base */ { + spice_marshaller_add_uint32(m, src->base.surface_id); + /* box */ { + spice_marshaller_add_int32(m, src->base.box.top); + spice_marshaller_add_int32(m, src->base.box.left); + spice_marshaller_add_int32(m, src->base.box.bottom); + spice_marshaller_add_int32(m, src->base.box.right); + } + /* clip */ { + spice_marshaller_add_uint8(m, src->base.clip.type); + if (src->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + SpiceRect *rects__element; + spice_marshaller_add_uint32(m, src->base.clip.rects->num_rects); + rects__element = src->base.clip.rects->rects; + for (i = 0; i < src->base.clip.rects->num_rects; i++) { + SpiceRect *src2; + src2 = (SpiceRect *)rects__element; + + spice_marshaller_add_int32(m, src2->top); + spice_marshaller_add_int32(m, src2->left); + spice_marshaller_add_int32(m, src2->bottom); + spice_marshaller_add_int32(m, src2->right); + rects__element++; + } + } + } + } + /* data */ { + *src_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* src_area */ { + spice_marshaller_add_int32(m, src->data.src_area.top); + spice_marshaller_add_int32(m, src->data.src_area.left); + spice_marshaller_add_int32(m, src->data.src_area.bottom); + spice_marshaller_add_int32(m, src->data.src_area.right); + } + spice_marshaller_add_uint16(m, src->data.rop_descriptor); + spice_marshaller_add_uint8(m, src->data.scale_mode); + /* mask */ { + spice_marshaller_add_uint8(m, src->data.mask.flags); + /* pos */ { + spice_marshaller_add_int32(m, src->data.mask.pos.x); + spice_marshaller_add_int32(m, src->data.mask.pos.y); + } + *mask_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } + } +} + +void spice_marshall_msg_display_draw_blend(SpiceMarshaller *m, SpiceMsgDisplayDrawBlend *msg, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayDrawBlend *src; + uint32_t i; + *src_bitmap_out = NULL; + *mask_bitmap_out = NULL; + src = (SpiceMsgDisplayDrawBlend *)msg; + + /* base */ { + spice_marshaller_add_uint32(m, src->base.surface_id); + /* box */ { + spice_marshaller_add_int32(m, src->base.box.top); + spice_marshaller_add_int32(m, src->base.box.left); + spice_marshaller_add_int32(m, src->base.box.bottom); + spice_marshaller_add_int32(m, src->base.box.right); + } + /* clip */ { + spice_marshaller_add_uint8(m, src->base.clip.type); + if (src->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + SpiceRect *rects__element; + spice_marshaller_add_uint32(m, src->base.clip.rects->num_rects); + rects__element = src->base.clip.rects->rects; + for (i = 0; i < src->base.clip.rects->num_rects; i++) { + SpiceRect *src2; + src2 = (SpiceRect *)rects__element; + + spice_marshaller_add_int32(m, src2->top); + spice_marshaller_add_int32(m, src2->left); + spice_marshaller_add_int32(m, src2->bottom); + spice_marshaller_add_int32(m, src2->right); + rects__element++; + } + } + } + } + /* data */ { + *src_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* src_area */ { + spice_marshaller_add_int32(m, src->data.src_area.top); + spice_marshaller_add_int32(m, src->data.src_area.left); + spice_marshaller_add_int32(m, src->data.src_area.bottom); + spice_marshaller_add_int32(m, src->data.src_area.right); + } + spice_marshaller_add_uint16(m, src->data.rop_descriptor); + spice_marshaller_add_uint8(m, src->data.scale_mode); + /* mask */ { + spice_marshaller_add_uint8(m, src->data.mask.flags); + /* pos */ { + spice_marshaller_add_int32(m, src->data.mask.pos.x); + spice_marshaller_add_int32(m, src->data.mask.pos.y); + } + *mask_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } + } +} + +void spice_marshall_msg_display_draw_blackness(SpiceMarshaller *m, SpiceMsgDisplayDrawBlackness *msg, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayDrawBlackness *src; + uint32_t i; + *mask_bitmap_out = NULL; + src = (SpiceMsgDisplayDrawBlackness *)msg; + + /* base */ { + spice_marshaller_add_uint32(m, src->base.surface_id); + /* box */ { + spice_marshaller_add_int32(m, src->base.box.top); + spice_marshaller_add_int32(m, src->base.box.left); + spice_marshaller_add_int32(m, src->base.box.bottom); + spice_marshaller_add_int32(m, src->base.box.right); + } + /* clip */ { + spice_marshaller_add_uint8(m, src->base.clip.type); + if (src->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + SpiceRect *rects__element; + spice_marshaller_add_uint32(m, src->base.clip.rects->num_rects); + rects__element = src->base.clip.rects->rects; + for (i = 0; i < src->base.clip.rects->num_rects; i++) { + SpiceRect *src2; + src2 = (SpiceRect *)rects__element; + + spice_marshaller_add_int32(m, src2->top); + spice_marshaller_add_int32(m, src2->left); + spice_marshaller_add_int32(m, src2->bottom); + spice_marshaller_add_int32(m, src2->right); + rects__element++; + } + } + } + } + /* data */ { + /* mask */ { + spice_marshaller_add_uint8(m, src->data.mask.flags); + /* pos */ { + spice_marshaller_add_int32(m, src->data.mask.pos.x); + spice_marshaller_add_int32(m, src->data.mask.pos.y); + } + *mask_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } + } +} + +void spice_marshall_msg_display_draw_whiteness(SpiceMarshaller *m, SpiceMsgDisplayDrawWhiteness *msg, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayDrawWhiteness *src; + uint32_t i; + *mask_bitmap_out = NULL; + src = (SpiceMsgDisplayDrawWhiteness *)msg; + + /* base */ { + spice_marshaller_add_uint32(m, src->base.surface_id); + /* box */ { + spice_marshaller_add_int32(m, src->base.box.top); + spice_marshaller_add_int32(m, src->base.box.left); + spice_marshaller_add_int32(m, src->base.box.bottom); + spice_marshaller_add_int32(m, src->base.box.right); + } + /* clip */ { + spice_marshaller_add_uint8(m, src->base.clip.type); + if (src->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + SpiceRect *rects__element; + spice_marshaller_add_uint32(m, src->base.clip.rects->num_rects); + rects__element = src->base.clip.rects->rects; + for (i = 0; i < src->base.clip.rects->num_rects; i++) { + SpiceRect *src2; + src2 = (SpiceRect *)rects__element; + + spice_marshaller_add_int32(m, src2->top); + spice_marshaller_add_int32(m, src2->left); + spice_marshaller_add_int32(m, src2->bottom); + spice_marshaller_add_int32(m, src2->right); + rects__element++; + } + } + } + } + /* data */ { + /* mask */ { + spice_marshaller_add_uint8(m, src->data.mask.flags); + /* pos */ { + spice_marshaller_add_int32(m, src->data.mask.pos.x); + spice_marshaller_add_int32(m, src->data.mask.pos.y); + } + *mask_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } + } +} + +void spice_marshall_msg_display_draw_invers(SpiceMarshaller *m, SpiceMsgDisplayDrawInvers *msg, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayDrawInvers *src; + uint32_t i; + *mask_bitmap_out = NULL; + src = (SpiceMsgDisplayDrawInvers *)msg; + + /* base */ { + spice_marshaller_add_uint32(m, src->base.surface_id); + /* box */ { + spice_marshaller_add_int32(m, src->base.box.top); + spice_marshaller_add_int32(m, src->base.box.left); + spice_marshaller_add_int32(m, src->base.box.bottom); + spice_marshaller_add_int32(m, src->base.box.right); + } + /* clip */ { + spice_marshaller_add_uint8(m, src->base.clip.type); + if (src->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + SpiceRect *rects__element; + spice_marshaller_add_uint32(m, src->base.clip.rects->num_rects); + rects__element = src->base.clip.rects->rects; + for (i = 0; i < src->base.clip.rects->num_rects; i++) { + SpiceRect *src2; + src2 = (SpiceRect *)rects__element; + + spice_marshaller_add_int32(m, src2->top); + spice_marshaller_add_int32(m, src2->left); + spice_marshaller_add_int32(m, src2->bottom); + spice_marshaller_add_int32(m, src2->right); + rects__element++; + } + } + } + } + /* data */ { + /* mask */ { + spice_marshaller_add_uint8(m, src->data.mask.flags); + /* pos */ { + spice_marshaller_add_int32(m, src->data.mask.pos.x); + spice_marshaller_add_int32(m, src->data.mask.pos.y); + } + *mask_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } + } +} + +void spice_marshall_msg_display_draw_rop3(SpiceMarshaller *m, SpiceMsgDisplayDrawRop3 *msg, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **pat_out, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + *src_bitmap_out = NULL; + *pat_out = NULL; + *mask_bitmap_out = NULL; +} + +void spice_marshall_msg_display_draw_stroke(SpiceMarshaller *m, SpiceMsgDisplayDrawStroke *msg, SpiceMarshaller **style_out, SpiceMarshaller **pat_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + *style_out = NULL; + *pat_out = NULL; +} + +void spice_marshall_msg_display_draw_text(SpiceMarshaller *m, SpiceMsgDisplayDrawText *msg, SpiceMarshaller **fore_brush_pat_out, SpiceMarshaller **back_brush_pat_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + *fore_brush_pat_out = NULL; + *back_brush_pat_out = NULL; +} + +void spice_marshall_msg_display_draw_transparent(SpiceMarshaller *m, SpiceMsgDisplayDrawTransparent *msg, SpiceMarshaller **src_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayDrawTransparent *src; + uint32_t i; + *src_bitmap_out = NULL; + src = (SpiceMsgDisplayDrawTransparent *)msg; + + /* base */ { + spice_marshaller_add_uint32(m, src->base.surface_id); + /* box */ { + spice_marshaller_add_int32(m, src->base.box.top); + spice_marshaller_add_int32(m, src->base.box.left); + spice_marshaller_add_int32(m, src->base.box.bottom); + spice_marshaller_add_int32(m, src->base.box.right); + } + /* clip */ { + spice_marshaller_add_uint8(m, src->base.clip.type); + if (src->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + SpiceRect *rects__element; + spice_marshaller_add_uint32(m, src->base.clip.rects->num_rects); + rects__element = src->base.clip.rects->rects; + for (i = 0; i < src->base.clip.rects->num_rects; i++) { + SpiceRect *src2; + src2 = (SpiceRect *)rects__element; + + spice_marshaller_add_int32(m, src2->top); + spice_marshaller_add_int32(m, src2->left); + spice_marshaller_add_int32(m, src2->bottom); + spice_marshaller_add_int32(m, src2->right); + rects__element++; + } + } + } + } + /* data */ { + *src_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* src_area */ { + spice_marshaller_add_int32(m, src->data.src_area.top); + spice_marshaller_add_int32(m, src->data.src_area.left); + spice_marshaller_add_int32(m, src->data.src_area.bottom); + spice_marshaller_add_int32(m, src->data.src_area.right); + } + spice_marshaller_add_uint32(m, src->data.src_color); + spice_marshaller_add_uint32(m, src->data.true_color); + } +} + +void spice_marshall_msg_display_draw_alpha_blend(SpiceMarshaller *m, SpiceMsgDisplayDrawAlphaBlend *msg, SpiceMarshaller **src_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayDrawAlphaBlend *src; + uint32_t i; + *src_bitmap_out = NULL; + src = (SpiceMsgDisplayDrawAlphaBlend *)msg; + + /* base */ { + spice_marshaller_add_uint32(m, src->base.surface_id); + /* box */ { + spice_marshaller_add_int32(m, src->base.box.top); + spice_marshaller_add_int32(m, src->base.box.left); + spice_marshaller_add_int32(m, src->base.box.bottom); + spice_marshaller_add_int32(m, src->base.box.right); + } + /* clip */ { + spice_marshaller_add_uint8(m, src->base.clip.type); + if (src->base.clip.type == SPICE_CLIP_TYPE_RECTS) { + SpiceRect *rects__element; + spice_marshaller_add_uint32(m, src->base.clip.rects->num_rects); + rects__element = src->base.clip.rects->rects; + for (i = 0; i < src->base.clip.rects->num_rects; i++) { + SpiceRect *src2; + src2 = (SpiceRect *)rects__element; + + spice_marshaller_add_int32(m, src2->top); + spice_marshaller_add_int32(m, src2->left); + spice_marshaller_add_int32(m, src2->bottom); + spice_marshaller_add_int32(m, src2->right); + rects__element++; + } + } + } + } + /* data */ { + spice_marshaller_add_uint8(m, src->data.alpha_flags); + spice_marshaller_add_uint8(m, src->data.alpha); + *src_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* src_area */ { + spice_marshaller_add_int32(m, src->data.src_area.top); + spice_marshaller_add_int32(m, src->data.src_area.left); + spice_marshaller_add_int32(m, src->data.src_area.bottom); + spice_marshaller_add_int32(m, src->data.src_area.right); + } + } +} + +void spice_marshall_msg_display_surface_create(SpiceMarshaller *m, SpiceMsgSurfaceCreate *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgSurfaceCreate *src; + src = (SpiceMsgSurfaceCreate *)msg; + + spice_marshaller_add_uint32(m, src->surface_id); + spice_marshaller_add_uint32(m, src->width); + spice_marshaller_add_uint32(m, src->height); + spice_marshaller_add_uint32(m, src->format); + spice_marshaller_add_uint32(m, src->flags); +} + +void spice_marshall_msg_display_surface_destroy(SpiceMarshaller *m, SpiceMsgSurfaceDestroy *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgSurfaceDestroy *src; + src = (SpiceMsgSurfaceDestroy *)msg; + + spice_marshaller_add_uint32(m, src->surface_id); +} + +void spice_marshall_msg_inputs_init(SpiceMarshaller *m, SpiceMsgInputsInit *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgInputsInit *src; + src = (SpiceMsgInputsInit *)msg; + + spice_marshaller_add_uint16(m, src->keyboard_modifiers); +} + +void spice_marshall_msg_inputs_key_modifiers(SpiceMarshaller *m, SpiceMsgInputsKeyModifiers *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgInputsKeyModifiers *src; + src = (SpiceMsgInputsKeyModifiers *)msg; + + spice_marshaller_add_uint16(m, src->modifiers); +} + +void spice_marshall_msg_cursor_init(SpiceMarshaller *m, SpiceMsgCursorInit *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgCursorInit *src; + src = (SpiceMsgCursorInit *)msg; + + /* position */ { + spice_marshaller_add_int16(m, src->position.x); + spice_marshaller_add_int16(m, src->position.y); + } + spice_marshaller_add_uint16(m, src->trail_length); + spice_marshaller_add_uint16(m, src->trail_frequency); + spice_marshaller_add_uint8(m, src->visible); + /* cursor */ { + spice_marshaller_add_uint16(m, src->cursor.flags); + if (!(src->cursor.flags & SPICE_CURSOR_FLAGS_NONE)) { + spice_marshaller_add_uint64(m, src->cursor.header.unique); + spice_marshaller_add_uint8(m, src->cursor.header.type); + spice_marshaller_add_uint16(m, src->cursor.header.width); + spice_marshaller_add_uint16(m, src->cursor.header.height); + spice_marshaller_add_uint16(m, src->cursor.header.hot_spot_x); + spice_marshaller_add_uint16(m, src->cursor.header.hot_spot_y); + } + /* Remaining data must be appended manually */ + } +} + +void spice_marshall_msg_cursor_set(SpiceMarshaller *m, SpiceMsgCursorSet *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgCursorSet *src; + src = (SpiceMsgCursorSet *)msg; + + /* position */ { + spice_marshaller_add_int16(m, src->position.x); + spice_marshaller_add_int16(m, src->position.y); + } + spice_marshaller_add_uint8(m, src->visible); + /* cursor */ { + spice_marshaller_add_uint16(m, src->cursor.flags); + if (!(src->cursor.flags & SPICE_CURSOR_FLAGS_NONE)) { + spice_marshaller_add_uint64(m, src->cursor.header.unique); + spice_marshaller_add_uint8(m, src->cursor.header.type); + spice_marshaller_add_uint16(m, src->cursor.header.width); + spice_marshaller_add_uint16(m, src->cursor.header.height); + spice_marshaller_add_uint16(m, src->cursor.header.hot_spot_x); + spice_marshaller_add_uint16(m, src->cursor.header.hot_spot_y); + } + /* Remaining data must be appended manually */ + } +} + +void spice_marshall_msg_cursor_move(SpiceMarshaller *m, SpiceMsgCursorMove *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgCursorMove *src; + src = (SpiceMsgCursorMove *)msg; + + /* position */ { + spice_marshaller_add_int16(m, src->position.x); + spice_marshaller_add_int16(m, src->position.y); + } +} + +void spice_marshall_msg_cursor_trail(SpiceMarshaller *m, SpiceMsgCursorTrail *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgCursorTrail *src; + src = (SpiceMsgCursorTrail *)msg; + + spice_marshaller_add_uint16(m, src->length); + spice_marshaller_add_uint16(m, src->frequency); +} + +void spice_marshall_msg_cursor_inval_one(SpiceMarshaller *m, SpiceMsgDisplayInvalOne *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayInvalOne *src; + src = (SpiceMsgDisplayInvalOne *)msg; + + spice_marshaller_add_uint64(m, src->id); +} + +void spice_marshall_msg_playback_data(SpiceMarshaller *m, SpiceMsgPlaybackPacket *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgPlaybackPacket *src; + src = (SpiceMsgPlaybackPacket *)msg; + + spice_marshaller_add_uint32(m, src->time); + /* Remaining data must be appended manually */ +} + +void spice_marshall_msg_playback_mode(SpiceMarshaller *m, SpiceMsgPlaybackMode *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgPlaybackMode *src; + src = (SpiceMsgPlaybackMode *)msg; + + spice_marshaller_add_uint32(m, src->time); + spice_marshaller_add_uint16(m, src->mode); + /* Remaining data must be appended manually */ +} + +void spice_marshall_msg_playback_start(SpiceMarshaller *m, SpiceMsgPlaybackStart *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgPlaybackStart *src; + src = (SpiceMsgPlaybackStart *)msg; + + spice_marshaller_add_uint32(m, src->channels); + spice_marshaller_add_uint16(m, src->format); + spice_marshaller_add_uint32(m, src->frequency); + spice_marshaller_add_uint32(m, src->time); +} + +void spice_marshall_SpiceMsgAudioVolume(SpiceMarshaller *m, SpiceMsgAudioVolume *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgAudioVolume *src; + uint16_t *volume__element; + uint32_t i; + src = (SpiceMsgAudioVolume *)msg; + + spice_marshaller_add_uint8(m, src->nchannels); + volume__element = src->volume; + for (i = 0; i < src->nchannels; i++) { + spice_marshaller_add_uint16(m, *volume__element); + volume__element++; + } +} + +void spice_marshall_SpiceMsgAudioMute(SpiceMarshaller *m, SpiceMsgAudioMute *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgAudioMute *src; + src = (SpiceMsgAudioMute *)msg; + + spice_marshaller_add_uint8(m, src->mute); +} + +void spice_marshall_msg_record_start(SpiceMarshaller *m, SpiceMsgRecordStart *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgRecordStart *src; + src = (SpiceMsgRecordStart *)msg; + + spice_marshaller_add_uint32(m, src->channels); + spice_marshaller_add_uint16(m, src->format); + spice_marshaller_add_uint32(m, src->frequency); +} + +void spice_marshall_msg_tunnel_init(SpiceMarshaller *m, SpiceMsgTunnelInit *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgTunnelInit *src; + src = (SpiceMsgTunnelInit *)msg; + + spice_marshaller_add_uint16(m, src->max_num_of_sockets); + spice_marshaller_add_uint32(m, src->max_socket_data_size); +} + +void spice_marshall_msg_tunnel_service_ip_map(SpiceMarshaller *m, SpiceMsgTunnelServiceIpMap *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgTunnelServiceIpMap *src; + uint32_t i; + src = (SpiceMsgTunnelServiceIpMap *)msg; + + spice_marshaller_add_uint32(m, src->service_id); + /* virtual_ip */ { + uint8_t *ipv4__element; + spice_marshaller_add_uint16(m, src->virtual_ip.type); + if (src->virtual_ip.type == SPICE_TUNNEL_IP_TYPE_IPv4) { + ipv4__element = src->virtual_ip.u.ipv4; + for (i = 0; i < 4; i++) { + spice_marshaller_add_uint8(m, *ipv4__element); + ipv4__element++; + } + } + } +} + +void spice_marshall_msg_tunnel_socket_open(SpiceMarshaller *m, SpiceMsgTunnelSocketOpen *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgTunnelSocketOpen *src; + src = (SpiceMsgTunnelSocketOpen *)msg; + + spice_marshaller_add_uint16(m, src->connection_id); + spice_marshaller_add_uint32(m, src->service_id); + spice_marshaller_add_uint32(m, src->tokens); +} + +void spice_marshall_msg_tunnel_socket_fin(SpiceMarshaller *m, SpiceMsgTunnelSocketFin *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgTunnelSocketFin *src; + src = (SpiceMsgTunnelSocketFin *)msg; + + spice_marshaller_add_uint16(m, src->connection_id); +} + +void spice_marshall_msg_tunnel_socket_close(SpiceMarshaller *m, SpiceMsgTunnelSocketClose *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgTunnelSocketClose *src; + src = (SpiceMsgTunnelSocketClose *)msg; + + spice_marshaller_add_uint16(m, src->connection_id); +} + +void spice_marshall_msg_tunnel_socket_data(SpiceMarshaller *m, SpiceMsgTunnelSocketData *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgTunnelSocketData *src; + src = (SpiceMsgTunnelSocketData *)msg; + + spice_marshaller_add_uint16(m, src->connection_id); + /* Remaining data must be appended manually */ +} + +void spice_marshall_msg_tunnel_socket_closed_ack(SpiceMarshaller *m, SpiceMsgTunnelSocketClosedAck *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgTunnelSocketClosedAck *src; + src = (SpiceMsgTunnelSocketClosedAck *)msg; + + spice_marshaller_add_uint16(m, src->connection_id); +} + +void spice_marshall_msg_tunnel_socket_token(SpiceMarshaller *m, SpiceMsgTunnelSocketTokens *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgTunnelSocketTokens *src; + src = (SpiceMsgTunnelSocketTokens *)msg; + + spice_marshaller_add_uint16(m, src->connection_id); + spice_marshaller_add_uint32(m, src->num_tokens); +} + +#ifdef USE_SMARTCARD +void spice_marshall_msg_smartcard_msg(SpiceMarshaller *m, SpiceMsgSmartcard *msg) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgSmartcard *src; + src = (SpiceMsgSmartcard *)msg; + + spice_marshaller_add_uint32(m, src->type); + spice_marshaller_add_uint32(m, src->reader_id); + spice_marshaller_add_uint32(m, src->length); + /* Remaining data must be appended manually */ +} + +#endif /* USE_SMARTCARD */ +void spice_marshall_String(SpiceMarshaller *m, SpiceString *ptr) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceString *src; + SpiceRasterGlyph * *glyphs__element; + uint32_t i; + uint32_t j; + + src = (SpiceString *)ptr; + + spice_marshaller_add_uint16(m, src->length); + spice_marshaller_add_uint8(m, src->flags); + if ((src->flags & SPICE_STRING_FLAGS_RASTER_A1)) { + glyphs__element = src->glyphs; + for (i = 0; i < src->length; i++) { + SpiceRasterGlyph *src2; + uint8_t *data__element; + src2 = (SpiceRasterGlyph *)*glyphs__element; + + /* render_pos */ { + spice_marshaller_add_int32(m, src2->render_pos.x); + spice_marshaller_add_int32(m, src2->render_pos.y); + } + /* glyph_origin */ { + spice_marshaller_add_int32(m, src2->glyph_origin.x); + spice_marshaller_add_int32(m, src2->glyph_origin.y); + } + spice_marshaller_add_uint16(m, src2->width); + spice_marshaller_add_uint16(m, src2->height); + data__element = src2->data; + for (j = 0; j < (((src2->width + 7) / 8 ) * src2->height); j++) { + spice_marshaller_add_uint8(m, *data__element); + data__element++; + } + glyphs__element++; + } + } else if ((src->flags & SPICE_STRING_FLAGS_RASTER_A4)) { + glyphs__element = src->glyphs; + for (i = 0; i < src->length; i++) { + SpiceRasterGlyph *src2; + uint8_t *data__element; + src2 = (SpiceRasterGlyph *)*glyphs__element; + + /* render_pos */ { + spice_marshaller_add_int32(m, src2->render_pos.x); + spice_marshaller_add_int32(m, src2->render_pos.y); + } + /* glyph_origin */ { + spice_marshaller_add_int32(m, src2->glyph_origin.x); + spice_marshaller_add_int32(m, src2->glyph_origin.y); + } + spice_marshaller_add_uint16(m, src2->width); + spice_marshaller_add_uint16(m, src2->height); + data__element = src2->data; + for (j = 0; j < (((4 * src2->width + 7) / 8 ) * src2->height); j++) { + spice_marshaller_add_uint8(m, *data__element); + data__element++; + } + glyphs__element++; + } + } else if ((src->flags & SPICE_STRING_FLAGS_RASTER_A8)) { + glyphs__element = src->glyphs; + for (i = 0; i < src->length; i++) { + SpiceRasterGlyph *src2; + uint8_t *data__element; + src2 = (SpiceRasterGlyph *)*glyphs__element; + + /* render_pos */ { + spice_marshaller_add_int32(m, src2->render_pos.x); + spice_marshaller_add_int32(m, src2->render_pos.y); + } + /* glyph_origin */ { + spice_marshaller_add_int32(m, src2->glyph_origin.x); + spice_marshaller_add_int32(m, src2->glyph_origin.y); + } + spice_marshaller_add_uint16(m, src2->width); + spice_marshaller_add_uint16(m, src2->height); + data__element = src2->data; + for (j = 0; j < (src2->width * src2->height); j++) { + spice_marshaller_add_uint8(m, *data__element); + data__element++; + } + glyphs__element++; + } + } +} +void spice_marshall_Rect(SpiceMarshaller *m, SpiceRect *ptr) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceRect *src; + + src = (SpiceRect *)ptr; + + spice_marshaller_add_int32(m, src->top); + spice_marshaller_add_int32(m, src->left); + spice_marshaller_add_int32(m, src->bottom); + spice_marshaller_add_int32(m, src->right); +} +void spice_marshall_Point(SpiceMarshaller *m, SpicePoint *ptr) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpicePoint *src; + + src = (SpicePoint *)ptr; + + spice_marshaller_add_int32(m, src->x); + spice_marshaller_add_int32(m, src->y); +} +void spice_marshall_DisplayBase(SpiceMarshaller *m, SpiceMsgDisplayBase *ptr) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceMsgDisplayBase *src; + uint32_t i; + + src = (SpiceMsgDisplayBase *)ptr; + + spice_marshaller_add_uint32(m, src->surface_id); + /* box */ { + spice_marshaller_add_int32(m, src->box.top); + spice_marshaller_add_int32(m, src->box.left); + spice_marshaller_add_int32(m, src->box.bottom); + spice_marshaller_add_int32(m, src->box.right); + } + /* clip */ { + spice_marshaller_add_uint8(m, src->clip.type); + if (src->clip.type == SPICE_CLIP_TYPE_RECTS) { + SpiceRect *rects__element; + spice_marshaller_add_uint32(m, src->clip.rects->num_rects); + rects__element = src->clip.rects->rects; + for (i = 0; i < src->clip.rects->num_rects; i++) { + SpiceRect *src2; + src2 = (SpiceRect *)rects__element; + + spice_marshaller_add_int32(m, src2->top); + spice_marshaller_add_int32(m, src2->left); + spice_marshaller_add_int32(m, src2->bottom); + spice_marshaller_add_int32(m, src2->right); + rects__element++; + } + } + } +} +void spice_marshall_Fill(SpiceMarshaller *m, SpiceFill *ptr, SpiceMarshaller **brush_pat_out, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceFill *src; + *brush_pat_out = NULL; + *mask_bitmap_out = NULL; + + src = (SpiceFill *)ptr; + + /* brush */ { + spice_marshaller_add_uint8(m, src->brush.type); + if (src->brush.type == SPICE_BRUSH_TYPE_SOLID) { + spice_marshaller_add_uint32(m, src->brush.u.color); + } else if (src->brush.type == SPICE_BRUSH_TYPE_PATTERN) { + *brush_pat_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* pos */ { + spice_marshaller_add_int32(m, src->brush.u.pattern.pos.x); + spice_marshaller_add_int32(m, src->brush.u.pattern.pos.y); + } + } + } + spice_marshaller_add_uint16(m, src->rop_descriptor); + /* mask */ { + spice_marshaller_add_uint8(m, src->mask.flags); + /* pos */ { + spice_marshaller_add_int32(m, src->mask.pos.x); + spice_marshaller_add_int32(m, src->mask.pos.y); + } + *mask_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } +} +void spice_marshall_Opaque(SpiceMarshaller *m, SpiceOpaque *ptr, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **pat_out, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceOpaque *src; + *src_bitmap_out = NULL; + *pat_out = NULL; + *mask_bitmap_out = NULL; + + src = (SpiceOpaque *)ptr; + + *src_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* src_area */ { + spice_marshaller_add_int32(m, src->src_area.top); + spice_marshaller_add_int32(m, src->src_area.left); + spice_marshaller_add_int32(m, src->src_area.bottom); + spice_marshaller_add_int32(m, src->src_area.right); + } + /* brush */ { + spice_marshaller_add_uint8(m, src->brush.type); + if (src->brush.type == SPICE_BRUSH_TYPE_SOLID) { + spice_marshaller_add_uint32(m, src->brush.u.color); + } else if (src->brush.type == SPICE_BRUSH_TYPE_PATTERN) { + *pat_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* pos */ { + spice_marshaller_add_int32(m, src->brush.u.pattern.pos.x); + spice_marshaller_add_int32(m, src->brush.u.pattern.pos.y); + } + } + } + spice_marshaller_add_uint16(m, src->rop_descriptor); + spice_marshaller_add_uint8(m, src->scale_mode); + /* mask */ { + spice_marshaller_add_uint8(m, src->mask.flags); + /* pos */ { + spice_marshaller_add_int32(m, src->mask.pos.x); + spice_marshaller_add_int32(m, src->mask.pos.y); + } + *mask_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } +} +void spice_marshall_Copy(SpiceMarshaller *m, SpiceCopy *ptr, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceCopy *src; + *src_bitmap_out = NULL; + *mask_bitmap_out = NULL; + + src = (SpiceCopy *)ptr; + + *src_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* src_area */ { + spice_marshaller_add_int32(m, src->src_area.top); + spice_marshaller_add_int32(m, src->src_area.left); + spice_marshaller_add_int32(m, src->src_area.bottom); + spice_marshaller_add_int32(m, src->src_area.right); + } + spice_marshaller_add_uint16(m, src->rop_descriptor); + spice_marshaller_add_uint8(m, src->scale_mode); + /* mask */ { + spice_marshaller_add_uint8(m, src->mask.flags); + /* pos */ { + spice_marshaller_add_int32(m, src->mask.pos.x); + spice_marshaller_add_int32(m, src->mask.pos.y); + } + *mask_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } +} +void spice_marshall_Blend(SpiceMarshaller *m, SpiceCopy *ptr, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceCopy *src; + *src_bitmap_out = NULL; + *mask_bitmap_out = NULL; + + src = (SpiceCopy *)ptr; + + *src_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* src_area */ { + spice_marshaller_add_int32(m, src->src_area.top); + spice_marshaller_add_int32(m, src->src_area.left); + spice_marshaller_add_int32(m, src->src_area.bottom); + spice_marshaller_add_int32(m, src->src_area.right); + } + spice_marshaller_add_uint16(m, src->rop_descriptor); + spice_marshaller_add_uint8(m, src->scale_mode); + /* mask */ { + spice_marshaller_add_uint8(m, src->mask.flags); + /* pos */ { + spice_marshaller_add_int32(m, src->mask.pos.x); + spice_marshaller_add_int32(m, src->mask.pos.y); + } + *mask_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } +} +void spice_marshall_Blackness(SpiceMarshaller *m, SpiceBlackness *ptr, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceBlackness *src; + *mask_bitmap_out = NULL; + + src = (SpiceBlackness *)ptr; + + /* mask */ { + spice_marshaller_add_uint8(m, src->mask.flags); + /* pos */ { + spice_marshaller_add_int32(m, src->mask.pos.x); + spice_marshaller_add_int32(m, src->mask.pos.y); + } + *mask_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } +} +void spice_marshall_Whiteness(SpiceMarshaller *m, SpiceWhiteness *ptr, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceWhiteness *src; + *mask_bitmap_out = NULL; + + src = (SpiceWhiteness *)ptr; + + /* mask */ { + spice_marshaller_add_uint8(m, src->mask.flags); + /* pos */ { + spice_marshaller_add_int32(m, src->mask.pos.x); + spice_marshaller_add_int32(m, src->mask.pos.y); + } + *mask_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } +} +void spice_marshall_Invers(SpiceMarshaller *m, SpiceInvers *ptr, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceInvers *src; + *mask_bitmap_out = NULL; + + src = (SpiceInvers *)ptr; + + /* mask */ { + spice_marshaller_add_uint8(m, src->mask.flags); + /* pos */ { + spice_marshaller_add_int32(m, src->mask.pos.x); + spice_marshaller_add_int32(m, src->mask.pos.y); + } + *mask_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } +} +void spice_marshall_Rop3(SpiceMarshaller *m, SpiceRop3 *ptr, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **pat_out, SpiceMarshaller **mask_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceRop3 *src; + *src_bitmap_out = NULL; + *pat_out = NULL; + *mask_bitmap_out = NULL; + + src = (SpiceRop3 *)ptr; + + *src_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* src_area */ { + spice_marshaller_add_int32(m, src->src_area.top); + spice_marshaller_add_int32(m, src->src_area.left); + spice_marshaller_add_int32(m, src->src_area.bottom); + spice_marshaller_add_int32(m, src->src_area.right); + } + /* brush */ { + spice_marshaller_add_uint8(m, src->brush.type); + if (src->brush.type == SPICE_BRUSH_TYPE_SOLID) { + spice_marshaller_add_uint32(m, src->brush.u.color); + } else if (src->brush.type == SPICE_BRUSH_TYPE_PATTERN) { + *pat_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* pos */ { + spice_marshaller_add_int32(m, src->brush.u.pattern.pos.x); + spice_marshaller_add_int32(m, src->brush.u.pattern.pos.y); + } + } + } + spice_marshaller_add_uint8(m, src->rop3); + spice_marshaller_add_uint8(m, src->scale_mode); + /* mask */ { + spice_marshaller_add_uint8(m, src->mask.flags); + /* pos */ { + spice_marshaller_add_int32(m, src->mask.pos.x); + spice_marshaller_add_int32(m, src->mask.pos.y); + } + *mask_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } +} +void spice_marshall_Path(SpiceMarshaller *m, SpicePath *ptr) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpicePath *src; + SpicePathSeg * *segments__element; + uint32_t i; + uint32_t j; + + src = (SpicePath *)ptr; + + spice_marshaller_add_uint32(m, src->num_segments); + segments__element = src->segments; + for (i = 0; i < src->num_segments; i++) { + SpicePathSeg *src2; + SpicePointFix *points__element; + src2 = (SpicePathSeg *)*segments__element; + + spice_marshaller_add_uint8(m, src2->flags); + spice_marshaller_add_uint32(m, src2->count); + points__element = src2->points; + for (j = 0; j < src2->count; j++) { + SpicePointFix *src3; + src3 = (SpicePointFix *)points__element; + + spice_marshaller_add_int32(m, src3->x); + spice_marshaller_add_int32(m, src3->y); + points__element++; + } + segments__element++; + } +} + +SPICE_GNUC_UNUSED static void spice_marshall_array_int32(SpiceMarshaller *m, int32_t *ptr, unsigned count) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + uint32_t i; + + for (i = 0; i < count; i++) { + spice_marshaller_add_int32(m, *ptr++); + } +} + +void spice_marshall_Stroke(SpiceMarshaller *m, SpiceStroke *ptr, SpiceMarshaller **style_out, SpiceMarshaller **pat_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceStroke *src; + *style_out = NULL; + *pat_out = NULL; + + src = (SpiceStroke *)ptr; + + m2 = spice_marshaller_get_ptr_submarshaller(m, 0); + spice_marshall_Path(m2, src->path); + /* attr */ { + spice_marshaller_add_uint8(m, src->attr.flags); + if ((src->attr.flags & SPICE_LINE_FLAGS_STYLED)) { + spice_marshaller_add_uint8(m, src->attr.style_nseg); + } + if ((src->attr.flags & SPICE_LINE_FLAGS_STYLED)) { + *style_out = spice_marshaller_get_ptr_submarshaller(m, 0); + } + } + /* brush */ { + spice_marshaller_add_uint8(m, src->brush.type); + if (src->brush.type == SPICE_BRUSH_TYPE_SOLID) { + spice_marshaller_add_uint32(m, src->brush.u.color); + } else if (src->brush.type == SPICE_BRUSH_TYPE_PATTERN) { + *pat_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* pos */ { + spice_marshaller_add_int32(m, src->brush.u.pattern.pos.x); + spice_marshaller_add_int32(m, src->brush.u.pattern.pos.y); + } + } + } + spice_marshaller_add_uint16(m, src->fore_mode); + spice_marshaller_add_uint16(m, src->back_mode); +} +void spice_marshall_Text(SpiceMarshaller *m, SpiceText *ptr, SpiceMarshaller **fore_brush_pat_out, SpiceMarshaller **back_brush_pat_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceText *src; + *fore_brush_pat_out = NULL; + *back_brush_pat_out = NULL; + + src = (SpiceText *)ptr; + + m2 = spice_marshaller_get_ptr_submarshaller(m, 0); + spice_marshall_String(m2, src->str); + /* back_area */ { + spice_marshaller_add_int32(m, src->back_area.top); + spice_marshaller_add_int32(m, src->back_area.left); + spice_marshaller_add_int32(m, src->back_area.bottom); + spice_marshaller_add_int32(m, src->back_area.right); + } + /* fore_brush */ { + spice_marshaller_add_uint8(m, src->fore_brush.type); + if (src->fore_brush.type == SPICE_BRUSH_TYPE_SOLID) { + spice_marshaller_add_uint32(m, src->fore_brush.u.color); + } else if (src->fore_brush.type == SPICE_BRUSH_TYPE_PATTERN) { + *fore_brush_pat_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* pos */ { + spice_marshaller_add_int32(m, src->fore_brush.u.pattern.pos.x); + spice_marshaller_add_int32(m, src->fore_brush.u.pattern.pos.y); + } + } + } + /* back_brush */ { + spice_marshaller_add_uint8(m, src->back_brush.type); + if (src->back_brush.type == SPICE_BRUSH_TYPE_SOLID) { + spice_marshaller_add_uint32(m, src->back_brush.u.color); + } else if (src->back_brush.type == SPICE_BRUSH_TYPE_PATTERN) { + *back_brush_pat_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* pos */ { + spice_marshaller_add_int32(m, src->back_brush.u.pattern.pos.x); + spice_marshaller_add_int32(m, src->back_brush.u.pattern.pos.y); + } + } + } + spice_marshaller_add_uint16(m, src->fore_mode); + spice_marshaller_add_uint16(m, src->back_mode); +} +void spice_marshall_Transparent(SpiceMarshaller *m, SpiceTransparent *ptr, SpiceMarshaller **src_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceTransparent *src; + *src_bitmap_out = NULL; + + src = (SpiceTransparent *)ptr; + + *src_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* src_area */ { + spice_marshaller_add_int32(m, src->src_area.top); + spice_marshaller_add_int32(m, src->src_area.left); + spice_marshaller_add_int32(m, src->src_area.bottom); + spice_marshaller_add_int32(m, src->src_area.right); + } + spice_marshaller_add_uint32(m, src->src_color); + spice_marshaller_add_uint32(m, src->true_color); +} +void spice_marshall_AlphaBlend(SpiceMarshaller *m, SpiceAlphaBlend *ptr, SpiceMarshaller **src_bitmap_out) +{ + SPICE_GNUC_UNUSED SpiceMarshaller *m2; + SpiceAlphaBlend *src; + *src_bitmap_out = NULL; + + src = (SpiceAlphaBlend *)ptr; + + spice_marshaller_add_uint8(m, src->alpha_flags); + spice_marshaller_add_uint8(m, src->alpha); + *src_bitmap_out = spice_marshaller_get_ptr_submarshaller(m, 0); + /* src_area */ { + spice_marshaller_add_int32(m, src->src_area.top); + spice_marshaller_add_int32(m, src->src_area.left); + spice_marshaller_add_int32(m, src->src_area.bottom); + spice_marshaller_add_int32(m, src->src_area.right); + } +} diff -Nru spice-gtk-0.9/spice-common/common/generated_server_marshallers.h spice-gtk-0.12/spice-common/common/generated_server_marshallers.h --- spice-gtk-0.9/spice-common/common/generated_server_marshallers.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/generated_server_marshallers.h 2012-04-24 11:24:36.000000000 +0000 @@ -0,0 +1,92 @@ +/* this is a file autogenerated by spice_codegen.py */ +#include "messages.h" +#include +#include "marshaller.h" + +#ifndef _GENERATED_HEADERS_H +#define _GENERATED_HEADERS_H +void spice_marshall_msg_migrate(SpiceMarshaller *m, SpiceMsgMigrate *msg); +void spice_marshall_SpiceMsgData(SpiceMarshaller *m, SpiceMsgData *msg); +void spice_marshall_msg_set_ack(SpiceMarshaller *m, SpiceMsgSetAck *msg); +void spice_marshall_msg_ping(SpiceMarshaller *m, SpiceMsgPing *msg); +void spice_marshall_msg_wait_for_channels(SpiceMarshaller *m, SpiceMsgWaitForChannels *msg); +void spice_marshall_msg_disconnecting(SpiceMarshaller *m, SpiceMsgDisconnect *msg); +void spice_marshall_msg_notify(SpiceMarshaller *m, SpiceMsgNotify *msg); +void spice_marshall_msg_main_migrate_begin(SpiceMarshaller *m, SpiceMsgMainMigrationBegin *msg); +void spice_marshall_SpiceMsgEmpty(SpiceMarshaller *m, SpiceMsgEmpty *msg); +void spice_marshall_msg_main_init(SpiceMarshaller *m, SpiceMsgMainInit *msg); +void spice_marshall_msg_main_channels_list(SpiceMarshaller *m, SpiceMsgChannels *msg); +void spice_marshall_msg_main_mouse_mode(SpiceMarshaller *m, SpiceMsgMainMouseMode *msg); +void spice_marshall_msg_main_multi_media_time(SpiceMarshaller *m, SpiceMsgMainMultiMediaTime *msg); +void spice_marshall_msg_main_agent_disconnected(SpiceMarshaller *m, SpiceMsgMainAgentDisconnect *msg); +void spice_marshall_msg_main_agent_token(SpiceMarshaller *m, SpiceMsgMainAgentTokens *msg); +void spice_marshall_msg_main_migrate_switch_host(SpiceMarshaller *m, SpiceMsgMainMigrationSwitchHost *msg); +void spice_marshall_msg_main_name(SpiceMarshaller *m, SpiceMsgMainName *msg); +void spice_marshall_msg_main_uuid(SpiceMarshaller *m, SpiceMsgMainUuid *msg); +void spice_marshall_msg_display_mode(SpiceMarshaller *m, SpiceMsgDisplayMode *msg); +void spice_marshall_msg_display_copy_bits(SpiceMarshaller *m, SpiceMsgDisplayCopyBits *msg); +void spice_marshall_msg_display_inval_list(SpiceMarshaller *m, SpiceResourceList *msg); +void spice_marshall_msg_display_inval_all_pixmaps(SpiceMarshaller *m, SpiceMsgWaitForChannels *msg); +void spice_marshall_msg_display_inval_palette(SpiceMarshaller *m, SpiceMsgDisplayInvalOne *msg); +void spice_marshall_msg_display_stream_create(SpiceMarshaller *m, SpiceMsgDisplayStreamCreate *msg); +void spice_marshall_msg_display_stream_data(SpiceMarshaller *m, SpiceMsgDisplayStreamData *msg); +void spice_marshall_msg_display_stream_clip(SpiceMarshaller *m, SpiceMsgDisplayStreamClip *msg); +void spice_marshall_msg_display_stream_destroy(SpiceMarshaller *m, SpiceMsgDisplayStreamDestroy *msg); +void spice_marshall_msg_display_draw_fill(SpiceMarshaller *m, SpiceMsgDisplayDrawFill *msg, SpiceMarshaller **brush_pat_out, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_msg_display_draw_opaque(SpiceMarshaller *m, SpiceMsgDisplayDrawOpaque *msg, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **pat_out, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_msg_display_draw_copy(SpiceMarshaller *m, SpiceMsgDisplayDrawCopy *msg, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_Image(SpiceMarshaller *m, SpiceImage *msg, SpiceMarshaller **bitmap_palette_out, SpiceMarshaller **lzplt_palette_out); +void spice_marshall_Palette(SpiceMarshaller *m, SpicePalette *msg); +void spice_marshall_msg_display_draw_blend(SpiceMarshaller *m, SpiceMsgDisplayDrawBlend *msg, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_msg_display_draw_blackness(SpiceMarshaller *m, SpiceMsgDisplayDrawBlackness *msg, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_msg_display_draw_whiteness(SpiceMarshaller *m, SpiceMsgDisplayDrawWhiteness *msg, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_msg_display_draw_invers(SpiceMarshaller *m, SpiceMsgDisplayDrawInvers *msg, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_msg_display_draw_rop3(SpiceMarshaller *m, SpiceMsgDisplayDrawRop3 *msg, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **pat_out, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_msg_display_draw_stroke(SpiceMarshaller *m, SpiceMsgDisplayDrawStroke *msg, SpiceMarshaller **style_out, SpiceMarshaller **pat_out); +void spice_marshall_msg_display_draw_text(SpiceMarshaller *m, SpiceMsgDisplayDrawText *msg, SpiceMarshaller **fore_brush_pat_out, SpiceMarshaller **back_brush_pat_out); +void spice_marshall_msg_display_draw_transparent(SpiceMarshaller *m, SpiceMsgDisplayDrawTransparent *msg, SpiceMarshaller **src_bitmap_out); +void spice_marshall_msg_display_draw_alpha_blend(SpiceMarshaller *m, SpiceMsgDisplayDrawAlphaBlend *msg, SpiceMarshaller **src_bitmap_out); +void spice_marshall_msg_display_surface_create(SpiceMarshaller *m, SpiceMsgSurfaceCreate *msg); +void spice_marshall_msg_display_surface_destroy(SpiceMarshaller *m, SpiceMsgSurfaceDestroy *msg); +void spice_marshall_msg_inputs_init(SpiceMarshaller *m, SpiceMsgInputsInit *msg); +void spice_marshall_msg_inputs_key_modifiers(SpiceMarshaller *m, SpiceMsgInputsKeyModifiers *msg); +void spice_marshall_msg_cursor_init(SpiceMarshaller *m, SpiceMsgCursorInit *msg); +void spice_marshall_msg_cursor_set(SpiceMarshaller *m, SpiceMsgCursorSet *msg); +void spice_marshall_msg_cursor_move(SpiceMarshaller *m, SpiceMsgCursorMove *msg); +void spice_marshall_msg_cursor_trail(SpiceMarshaller *m, SpiceMsgCursorTrail *msg); +void spice_marshall_msg_cursor_inval_one(SpiceMarshaller *m, SpiceMsgDisplayInvalOne *msg); +void spice_marshall_msg_playback_data(SpiceMarshaller *m, SpiceMsgPlaybackPacket *msg); +void spice_marshall_msg_playback_mode(SpiceMarshaller *m, SpiceMsgPlaybackMode *msg); +void spice_marshall_msg_playback_start(SpiceMarshaller *m, SpiceMsgPlaybackStart *msg); +void spice_marshall_SpiceMsgAudioVolume(SpiceMarshaller *m, SpiceMsgAudioVolume *msg); +void spice_marshall_SpiceMsgAudioMute(SpiceMarshaller *m, SpiceMsgAudioMute *msg); +void spice_marshall_msg_record_start(SpiceMarshaller *m, SpiceMsgRecordStart *msg); +void spice_marshall_msg_tunnel_init(SpiceMarshaller *m, SpiceMsgTunnelInit *msg); +void spice_marshall_msg_tunnel_service_ip_map(SpiceMarshaller *m, SpiceMsgTunnelServiceIpMap *msg); +void spice_marshall_msg_tunnel_socket_open(SpiceMarshaller *m, SpiceMsgTunnelSocketOpen *msg); +void spice_marshall_msg_tunnel_socket_fin(SpiceMarshaller *m, SpiceMsgTunnelSocketFin *msg); +void spice_marshall_msg_tunnel_socket_close(SpiceMarshaller *m, SpiceMsgTunnelSocketClose *msg); +void spice_marshall_msg_tunnel_socket_data(SpiceMarshaller *m, SpiceMsgTunnelSocketData *msg); +void spice_marshall_msg_tunnel_socket_closed_ack(SpiceMarshaller *m, SpiceMsgTunnelSocketClosedAck *msg); +void spice_marshall_msg_tunnel_socket_token(SpiceMarshaller *m, SpiceMsgTunnelSocketTokens *msg); +#ifdef USE_SMARTCARD +void spice_marshall_msg_smartcard_msg(SpiceMarshaller *m, SpiceMsgSmartcard *msg); +#endif /* USE_SMARTCARD */ +void spice_marshall_String(SpiceMarshaller *m, SpiceString *msg); +void spice_marshall_Rect(SpiceMarshaller *m, SpiceRect *msg); +void spice_marshall_Point(SpiceMarshaller *m, SpicePoint *msg); +void spice_marshall_DisplayBase(SpiceMarshaller *m, SpiceMsgDisplayBase *msg); +void spice_marshall_Fill(SpiceMarshaller *m, SpiceFill *msg, SpiceMarshaller **brush_pat_out, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_Opaque(SpiceMarshaller *m, SpiceOpaque *msg, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **pat_out, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_Copy(SpiceMarshaller *m, SpiceCopy *msg, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_Blend(SpiceMarshaller *m, SpiceCopy *msg, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_Blackness(SpiceMarshaller *m, SpiceBlackness *msg, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_Whiteness(SpiceMarshaller *m, SpiceWhiteness *msg, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_Invers(SpiceMarshaller *m, SpiceInvers *msg, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_Rop3(SpiceMarshaller *m, SpiceRop3 *msg, SpiceMarshaller **src_bitmap_out, SpiceMarshaller **pat_out, SpiceMarshaller **mask_bitmap_out); +void spice_marshall_Stroke(SpiceMarshaller *m, SpiceStroke *msg, SpiceMarshaller **style_out, SpiceMarshaller **pat_out); +void spice_marshall_Path(SpiceMarshaller *m, SpicePath *msg); +void spice_marshall_Text(SpiceMarshaller *m, SpiceText *msg, SpiceMarshaller **fore_brush_pat_out, SpiceMarshaller **back_brush_pat_out); +void spice_marshall_Transparent(SpiceMarshaller *m, SpiceTransparent *msg, SpiceMarshaller **src_bitmap_out); +void spice_marshall_AlphaBlend(SpiceMarshaller *m, SpiceAlphaBlend *msg, SpiceMarshaller **src_bitmap_out); +#endif diff -Nru spice-gtk-0.9/spice-common/common/gl_canvas.c spice-gtk-0.12/spice-common/common/gl_canvas.c --- spice-gtk-0.9/spice-common/common/gl_canvas.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/gl_canvas.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,911 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#include "gl_canvas.h" +#include "quic.h" +#include "rop3.h" +#include "region.h" +#include "glc.h" + +#define GL_CANVAS +#include "canvas_base.c" + +typedef struct GLCanvas GLCanvas; + +struct GLCanvas { + CanvasBase base; + GLCCtx glc; + void *private_data; + int private_data_size; + int textures_lost; +}; + +static inline uint8_t *copy_opposite_image(GLCanvas *canvas, void *data, int stride, int height) +{ + uint8_t *ret_data = (uint8_t *)data; + uint8_t *dest; + uint8_t *src; + int i; + + if (!canvas->private_data) { + canvas->private_data = spice_malloc_n(height, stride); + if (!canvas->private_data) { + return ret_data; + } + canvas->private_data_size = stride * height; + } + + if (canvas->private_data_size < (stride * height)) { + free(canvas->private_data); + canvas->private_data = spice_malloc_n(height, stride); + if (!canvas->private_data) { + return ret_data; + } + canvas->private_data_size = stride * height; + } + + dest = (uint8_t *)canvas->private_data; + src = (uint8_t *)data + (height - 1) * stride; + + for (i = 0; i < height; ++i) { + memcpy(dest, src, stride); + dest += stride; + src -= stride; + } + return (uint8_t *)canvas->private_data; +} + +static pixman_image_t *canvas_surf_to_trans_surf(GLCImage *image, + uint32_t trans_color) +{ + int width = image->width; + int height = image->height; + uint8_t *src_line; + uint8_t *end_src_line; + int src_stride; + uint8_t *dest_line; + int dest_stride; + pixman_image_t *ret; + int i; + + ret = pixman_image_create_bits(PIXMAN_a8r8g8b8, width, height, NULL, 0); + if (ret == NULL) { + spice_critical("create surface failed"); + return NULL; + } + + src_line = image->pixels; + src_stride = image->stride; + end_src_line = src_line + src_stride * height; + + dest_line = (uint8_t *)pixman_image_get_data(ret); + dest_stride = pixman_image_get_stride(ret); + + for (; src_line < end_src_line; src_line += src_stride, dest_line += dest_stride) { + for (i = 0; i < width; i++) { + if ((((uint32_t*)src_line)[i] & 0x00ffffff) == trans_color) { + ((uint32_t*)dest_line)[i] = 0; + } else { + ((uint32_t*)dest_line)[i] = (((uint32_t*)src_line)[i]) | 0xff000000; + } + } + } + + return ret; +} + +static GLCPath get_path(GLCanvas *canvas, SpicePath *s) +{ + GLCPath path = glc_path_create(canvas->glc); + int i; + + for (i = 0; i < s->num_segments; i++) { + SpicePathSeg* seg = s->segments[i]; + SpicePointFix* point = seg->points; + SpicePointFix* end_point = point + seg->count; + + if (seg->flags & SPICE_PATH_BEGIN) { + glc_path_move_to(path, fix_to_double(point->x), fix_to_double(point->y)); + point++; + } + + if (seg->flags & SPICE_PATH_BEZIER) { + spice_return_val_if_fail((point - end_point) % 3 == 0, path); + for (; point + 2 < end_point; point += 3) { + glc_path_curve_to(path, + fix_to_double(point[0].x), fix_to_double(point[0].y), + fix_to_double(point[1].x), fix_to_double(point[1].y), + fix_to_double(point[2].x), fix_to_double(point[2].y)); + } + } else { + for (; point < end_point; point++) { + glc_path_line_to(path, fix_to_double(point->x), fix_to_double(point->y)); + } + } + if (seg->flags & SPICE_PATH_END) { + if (seg->flags & SPICE_PATH_CLOSE) { + glc_path_close(path); + } + } + } + + return path; +} + +#define SET_GLC_RECT(dest, src) { \ + (dest)->x = (src)->left; \ + (dest)->y = (src)->top; \ + (dest)->width = (src)->right - (src)->left; \ + (dest)->height = (src)->bottom - (src)->top; \ +} + +#define SET_GLC_BOX(dest, src) { \ + (dest)->x = (src)->x1; \ + (dest)->y = (src)->y1; \ + (dest)->width = (src)->x2 - (src)->x1; \ + (dest)->height = (src)->y2 - (src)->y1; \ +} + +static void set_clip(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip) +{ + GLCRect rect; + glc_clip_reset(canvas->glc); + + switch (clip->type) { + case SPICE_CLIP_TYPE_NONE: + break; + case SPICE_CLIP_TYPE_RECTS: { + uint32_t n = clip->rects->num_rects; + SpiceRect *now = clip->rects->rects; + SpiceRect *end = now + n; + + if (n == 0) { + rect.x = rect.y = 0; + rect.width = rect.height = 0; + glc_clip_rect(canvas->glc, &rect, GLC_CLIP_OP_SET); + break; + } else { + SET_GLC_RECT(&rect, now); + glc_clip_rect(canvas->glc, &rect, GLC_CLIP_OP_SET); + } + + for (now++; now < end; now++) { + SET_GLC_RECT(&rect, now); + glc_clip_rect(canvas->glc, &rect, GLC_CLIP_OP_OR); + } + break; + } + default: + spice_warn_if_reached(); + return; + } +} + +static void set_mask(GLCanvas *canvas, SpiceQMask *mask, int x, int y) +{ + pixman_image_t *image; + + if (!(image = canvas_get_mask(&canvas->base, mask, NULL))) { + glc_clear_mask(canvas->glc, GLC_MASK_A); + return; + } + + + glc_set_mask(canvas->glc, x - mask->pos.x, y - mask->pos.y, + pixman_image_get_width(image), + pixman_image_get_height(image), + pixman_image_get_stride(image), + (uint8_t *)pixman_image_get_data(image), GLC_MASK_A); +} + +static inline void surface_to_image(GLCanvas *canvas, pixman_image_t *surface, GLCImage *image, + int ignore_stride) +{ + int depth = pixman_image_get_depth(surface); + + spice_return_if_fail(depth == 32 || depth == 24); + image->format = (depth == 24) ? GLC_IMAGE_RGB32 : GLC_IMAGE_ARGB32; + image->width = pixman_image_get_width(surface); + image->height = pixman_image_get_height(surface); + image->stride = pixman_image_get_stride(surface); + image->pixels = (uint8_t *)pixman_image_get_data(surface); + image->pallet = NULL; + if (ignore_stride) { + return; + } + if (image->stride < 0) { + image->stride = -image->stride; + image->pixels = image->pixels - (image->height - 1) * image->stride; + } else { + image->pixels = copy_opposite_image(canvas, image->pixels, image->stride, image->height); + } +} + +static void set_brush(GLCanvas *canvas, SpiceBrush *brush) +{ + switch (brush->type) { + case SPICE_BRUSH_TYPE_SOLID: { + uint32_t color = brush->u.color; + double r, g, b; + + b = (double)(color & canvas->base.color_mask) / canvas->base.color_mask; + color >>= canvas->base.color_shift; + g = (double)(color & canvas->base.color_mask) / canvas->base.color_mask; + color >>= canvas->base.color_shift; + r = (double)(color & canvas->base.color_mask) / canvas->base.color_mask; + glc_set_rgb(canvas->glc, r, g, b); + break; + } + case SPICE_BRUSH_TYPE_PATTERN: { + GLCImage image; + GLCPattern pattern; + pixman_image_t *surface; + + surface = canvas_get_image(&canvas->base, brush->u.pattern.pat, FALSE); + surface_to_image(canvas, surface, &image, 0); + + pattern = glc_pattern_create(canvas->glc, -brush->u.pattern.pos.x, + -brush->u.pattern.pos.y, &image); + + glc_set_pattern(canvas->glc, pattern); + glc_pattern_destroy(pattern); + pixman_image_unref (surface); + } + case SPICE_BRUSH_TYPE_NONE: + return; + default: + spice_warn_if_reached(); + return; + } +} + +static void set_op(GLCanvas *canvas, uint16_t rop_decriptor) +{ + GLCOp op; + + switch (rop_decriptor) { + case SPICE_ROPD_OP_PUT: + op = GLC_OP_COPY; + break; + case SPICE_ROPD_OP_XOR: + op = GLC_OP_XOR; + break; + case SPICE_ROPD_OP_BLACKNESS: + op = GLC_OP_CLEAR; + break; + case SPICE_ROPD_OP_WHITENESS: + op = GLC_OP_SET; + break; + case SPICE_ROPD_OP_PUT | SPICE_ROPD_INVERS_BRUSH: + case SPICE_ROPD_OP_PUT | SPICE_ROPD_INVERS_SRC: + op = GLC_OP_COPY_INVERTED; + break; + case SPICE_ROPD_OP_INVERS: + op = GLC_OP_INVERT; + break; + case SPICE_ROPD_OP_AND: + op = GLC_OP_AND; + break; + case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_RES: + op = GLC_OP_NAND; + break; + case SPICE_ROPD_OP_OR: + op = GLC_OP_OR; + break; + case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_RES: + op = GLC_OP_NOR; + break; + case SPICE_ROPD_OP_XOR | SPICE_ROPD_INVERS_RES: + op = GLC_OP_EQUIV; + break; + case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_DEST: + op = GLC_OP_AND_REVERSE; + break; + case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_BRUSH: + case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_SRC: + op = GLC_OP_AND_INVERTED; + break; + case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_DEST: + op = GLC_OP_OR_REVERSE; + break; + case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_BRUSH: + case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_SRC: + op = GLC_OP_OR_INVERTED; + break; + default: + spice_warning("GLC_OP_NOOP"); + op = GLC_OP_NOOP; + } + glc_set_op(canvas->glc, op); +} + +static void gl_canvas_draw_fill(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + GLCRect rect; + set_clip(canvas, bbox, clip); + set_mask(canvas, &fill->mask, bbox->left, bbox->top); + set_brush(canvas, &fill->brush); + set_op(canvas, fill->rop_descriptor); + SET_GLC_RECT(&rect, bbox); + + glc_fill_rect(canvas->glc, &rect); + glc_flush(canvas->glc); +} + +static void gl_canvas_draw_copy(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + pixman_image_t *surface; + GLCRecti src; + GLCRecti dest; + GLCImage image; + + set_clip(canvas, bbox, clip); + set_mask(canvas, ©->mask, bbox->left, bbox->top); + set_op(canvas, copy->rop_descriptor); + + //todo: optimize get_image (use ogl conversion + remove unnecessary copy of 32bpp) + surface = canvas_get_image(&canvas->base, copy->src_bitmap, FALSE); + surface_to_image(canvas, surface, &image, 0); + SET_GLC_RECT(&dest, bbox); + SET_GLC_RECT(&src, ©->src_area); + glc_draw_image(canvas->glc, &dest, &src, &image, 0, 1); + + pixman_image_unref(surface); + glc_flush(canvas->glc); +} + +static void gl_canvas_draw_opaque(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + pixman_image_t *surface; + GLCRecti src; + GLCRecti dest; + GLCRect fill_rect; + GLCImage image; + + set_clip(canvas, bbox, clip); + set_mask(canvas, &opaque->mask, bbox->left, bbox->top); + + glc_set_op(canvas->glc, (opaque->rop_descriptor & SPICE_ROPD_INVERS_SRC) ? GLC_OP_COPY_INVERTED : + GLC_OP_COPY); + surface = canvas_get_image(&canvas->base, opaque->src_bitmap, FALSE); + surface_to_image(canvas, surface, &image, 0); + SET_GLC_RECT(&dest, bbox); + SET_GLC_RECT(&src, &opaque->src_area); + glc_draw_image(canvas->glc, &dest, &src, &image, 0, 1); + pixman_image_unref(surface); + + set_brush(canvas, &opaque->brush); + set_op(canvas, opaque->rop_descriptor & ~SPICE_ROPD_INVERS_SRC); + SET_GLC_RECT(&fill_rect, bbox); + glc_fill_rect(canvas->glc, &fill_rect); + + glc_flush(canvas->glc); +} + +static void gl_canvas_draw_alpha_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlend *alpha_blend) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + pixman_image_t *surface; + GLCRecti src; + GLCRecti dest; + GLCImage image; + + set_clip(canvas, bbox, clip); + glc_clear_mask(canvas->glc, GLC_MASK_A); + glc_set_op(canvas->glc, GLC_OP_COPY); + + surface = canvas_get_image(&canvas->base, alpha_blend->src_bitmap, FALSE); + surface_to_image(canvas, surface, &image, 0); + SET_GLC_RECT(&dest, bbox); + SET_GLC_RECT(&src, &alpha_blend->src_area); + glc_draw_image(canvas->glc, &dest, &src, &image, 0, (double)alpha_blend->alpha / 0xff); + + pixman_image_unref(surface); + glc_flush(canvas->glc); +} + +static void gl_canvas_draw_blend(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + pixman_image_t *surface; + GLCRecti src; + GLCRecti dest; + GLCImage image; + + set_clip(canvas, bbox, clip); + set_mask(canvas, &blend->mask, bbox->left, bbox->top); + set_op(canvas, blend->rop_descriptor); + + surface = canvas_get_image(&canvas->base, blend->src_bitmap, FALSE); + SET_GLC_RECT(&dest, bbox); + SET_GLC_RECT(&src, &blend->src_area); + surface_to_image(canvas, surface, &image, 0); + glc_draw_image(canvas->glc, &dest, &src, &image, 0, 1); + + pixman_image_unref(surface); + glc_flush(canvas->glc); +} + +static void gl_canvas_draw_transparent(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent *transparent) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + pixman_image_t *surface; + pixman_image_t *trans_surf; + GLCImage image; + GLCRecti src; + GLCRecti dest; + + set_clip(canvas, bbox, clip); + glc_clear_mask(canvas->glc, GLC_MASK_A); + glc_set_op(canvas->glc, GLC_OP_COPY); + + surface = canvas_get_image(&canvas->base, transparent->src_bitmap, FALSE); + surface_to_image(canvas, surface, &image, 0); + + trans_surf = canvas_surf_to_trans_surf(&image, transparent->true_color); + pixman_image_unref(surface); + + surface_to_image(canvas, trans_surf, &image, 1); + SET_GLC_RECT(&dest, bbox); + SET_GLC_RECT(&src, &transparent->src_area); + glc_draw_image(canvas->glc, &dest, &src, &image, 0, 1); + + pixman_image_unref(trans_surf); + glc_flush(canvas->glc); +} + +static inline void fill_common(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceQMask * mask, GLCOp op) +{ + GLCRect rect; + + set_clip(canvas, bbox, clip); + set_mask(canvas, mask, bbox->left, bbox->top); + glc_set_op(canvas->glc, op); + SET_GLC_RECT(&rect, bbox); + glc_fill_rect(canvas->glc, &rect); +} + +static void gl_canvas_draw_whiteness(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + fill_common(canvas, bbox, clip, &whiteness->mask, GLC_OP_SET); +} + +static void gl_canvas_draw_blackness(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + fill_common(canvas, bbox, clip, &blackness->mask, GLC_OP_CLEAR); +} + +static void gl_canvas_draw_invers(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + fill_common(canvas, bbox, clip, &invers->mask, GLC_OP_INVERT); +} + +static void gl_canvas_draw_rop3(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + pixman_image_t *d; + pixman_image_t *s; + GLCImage image; + SpicePoint src_pos; + uint8_t *data_opp; + int src_stride; + + set_clip(canvas, bbox, clip); + set_mask(canvas, &rop3->mask, bbox->left, bbox->top); + + glc_set_op(canvas->glc, GLC_OP_COPY); + + image.format = GLC_IMAGE_RGB32; + image.width = bbox->right - bbox->left; + image.height = bbox->bottom - bbox->top; + + image.pallet = NULL; + + d = pixman_image_create_bits(PIXMAN_x8r8g8b8, image.width, image.height, NULL, 0); + if (d == NULL) { + spice_critical("create surface failed"); + return; + } + image.pixels = (uint8_t *)pixman_image_get_data(d); + image.stride = pixman_image_get_stride(d); + + glc_read_pixels(canvas->glc, bbox->left, bbox->top, &image); + data_opp = copy_opposite_image(canvas, image.pixels, + image.stride, + pixman_image_get_height(d)); + memcpy(image.pixels, data_opp, + image.stride * pixman_image_get_height(d)); + + s = canvas_get_image(&canvas->base, rop3->src_bitmap, FALSE); + src_stride = pixman_image_get_stride(s); + if (src_stride > 0) { + data_opp = copy_opposite_image(canvas, (uint8_t *)pixman_image_get_data(s), + src_stride, pixman_image_get_height(s)); + memcpy((uint8_t *)pixman_image_get_data(s), data_opp, + src_stride * pixman_image_get_height(s)); + } + + if (!rect_is_same_size(bbox, &rop3->src_area)) { + pixman_image_t *scaled_s = canvas_scale_surface(s, &rop3->src_area, image.width, + image.height, rop3->scale_mode); + pixman_image_unref(s); + s = scaled_s; + src_pos.x = 0; + src_pos.y = 0; + } else { + src_pos.x = rop3->src_area.left; + src_pos.y = rop3->src_area.top; + } + + if (pixman_image_get_width(s) - src_pos.x < image.width || + pixman_image_get_height(s) - src_pos.y < image.height) { + spice_critical("bad src bitmap size"); + return; + } + + if (rop3->brush.type == SPICE_BRUSH_TYPE_PATTERN) { + pixman_image_t *p = canvas_get_image(&canvas->base, rop3->brush.u.pattern.pat, FALSE); + SpicePoint pat_pos; + + pat_pos.x = (bbox->left - rop3->brush.u.pattern.pos.x) % pixman_image_get_width(p); + + pat_pos.y = (bbox->top - rop3->brush.u.pattern.pos.y) % pixman_image_get_height(p); + + //for now (bottom-top) + if (pat_pos.y < 0) { + pat_pos.y = pixman_image_get_height(p) + pat_pos.y; + } + pat_pos.y = (image.height + pat_pos.y) % pixman_image_get_height(p); + pat_pos.y = pixman_image_get_height(p) - pat_pos.y; + + do_rop3_with_pattern(rop3->rop3, d, s, &src_pos, p, &pat_pos); + pixman_image_unref(p); + } else { + uint32_t color = (canvas->base.color_shift) == 8 ? rop3->brush.u.color : + canvas_16bpp_to_32bpp(rop3->brush.u.color); + do_rop3_with_color(rop3->rop3, d, s, &src_pos, color); + } + + pixman_image_unref(s); + + GLCRecti dest; + GLCRecti src; + dest.x = bbox->left; + dest.y = bbox->top; + + image.pixels = copy_opposite_image(canvas, image.pixels, pixman_image_get_stride(d), + pixman_image_get_height(d)); + + src.x = src.y = 0; + dest.width = src.width = image.width; + dest.height = src.height = image.height; + glc_draw_image(canvas->glc, &dest, &src, &image, 0, 1); + pixman_image_unref(d); +} + +static void gl_canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + GLCPath path; + + set_clip(canvas, bbox, clip); + glc_clear_mask(canvas->glc, GLC_MASK_A); + set_op(canvas, stroke->fore_mode); + set_brush(canvas, &stroke->brush); + + if (stroke->attr.flags & SPICE_LINE_FLAGS_STYLED) { + spice_warning("SPICE_LINE_FLAGS_STYLED"); + } + glc_set_line_width(canvas->glc, 1.0); + + path = get_path(canvas, stroke->path); + glc_stroke_path(canvas->glc, path); + glc_path_destroy(path); +} + +static void gl_canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + GLCRect rect; + SpiceString *str; + + set_clip(canvas, bbox, clip); + glc_clear_mask(canvas->glc, GLC_MASK_A); + + if (!rect_is_empty(&text->back_area)) { + set_brush(canvas, &text->back_brush); + set_op(canvas, text->back_mode); + SET_GLC_RECT(&rect, bbox); + glc_fill_rect(canvas->glc, &rect); + } + + str = (SpiceString *)SPICE_GET_ADDRESS(text->str); + set_brush(canvas, &text->fore_brush); + set_op(canvas, text->fore_mode); + if (str->flags & SPICE_STRING_FLAGS_RASTER_A1) { + SpicePoint pos; + pixman_image_t *mask = canvas_get_str_mask(&canvas->base, str, 1, &pos); + _glc_fill_mask(canvas->glc, pos.x, pos.y, + pixman_image_get_width(mask), + pixman_image_get_height(mask), + pixman_image_get_stride(mask), + (uint8_t *)pixman_image_get_data(mask)); + pixman_image_unref(mask); + } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A4) { + SpicePoint pos; + pixman_image_t *mask = canvas_get_str_mask(&canvas->base, str, 4, &pos); + glc_fill_alpha(canvas->glc, pos.x, pos.y, + pixman_image_get_width(mask), + pixman_image_get_height(mask), + pixman_image_get_stride(mask), + (uint8_t *)pixman_image_get_data(mask)); + + pixman_image_unref(mask); + } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A8) { + spice_warning("untested path A8 glyphs, doing nothing"); + if (0) { + SpicePoint pos; + pixman_image_t *mask = canvas_get_str_mask(&canvas->base, str, 8, &pos); + glc_fill_alpha(canvas->glc, pos.x, pos.y, + pixman_image_get_width(mask), + pixman_image_get_height(mask), + pixman_image_get_stride(mask), + (uint8_t *)pixman_image_get_data(mask)); + pixman_image_unref(mask); + } + } else { + spice_warning("untested path vector glyphs, doing nothing"); + if (0) { + //draw_vector_str(canvas, str, &text->fore_brush, text->fore_mode); + } + } + glc_flush(canvas->glc); +} + +static void gl_canvas_clear(SpiceCanvas *spice_canvas) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + glc_clear(canvas->glc); + glc_flush(canvas->glc); +} + +static void gl_canvas_copy_bits(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + set_clip(canvas, bbox, clip); + glc_clear_mask(canvas->glc, GLC_MASK_A); + glc_set_op(canvas->glc, GLC_OP_COPY); + glc_copy_pixels(canvas->glc, bbox->left, bbox->top, src_pos->x, src_pos->y, + bbox->right - bbox->left, bbox->bottom - bbox->top); +} + +static void gl_canvas_read_bits(SpiceCanvas *spice_canvas, uint8_t *dest, int dest_stride, const SpiceRect *area) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + GLCImage image; + + spice_return_if_fail(dest_stride > 0); + + image.format = GLC_IMAGE_RGB32; + image.height = area->bottom - area->top; + image.width = area->right - area->left; + image.pixels = dest; + image.stride = dest_stride; + glc_read_pixels(canvas->glc, area->left, area->top, &image); +} + +static void gl_canvas_group_start(SpiceCanvas *spice_canvas, QRegion *region) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + GLCRect *glc_rects; + GLCRect *now, *end; + int num_rect; + pixman_box32_t *rects; + + canvas_base_group_start(spice_canvas, region); + + rects = pixman_region32_rectangles(region, &num_rect); + + glc_rects = spice_new(GLCRect, num_rect); + now = glc_rects; + end = glc_rects + num_rect; + + for (; now < end; now++, rects++) { + SET_GLC_BOX(now, rects); + } + glc_mask_rects(canvas->glc, num_rect, glc_rects, GLC_MASK_B); + + free(glc_rects); +} + +static void gl_canvas_put_image(SpiceCanvas *spice_canvas, const SpiceRect *dest, const uint8_t *src_data, + uint32_t src_width, uint32_t src_height, int src_stride, + const QRegion *clip) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + GLCRecti src; + GLCRecti gldest; + GLCImage image; + uint32_t i; + + spice_return_if_fail(src_stride <= 0); + + glc_clip_reset(canvas->glc); + + if (clip) { + int num_rects; + pixman_box32_t *rects = pixman_region32_rectangles((pixman_region32_t *)clip, + &num_rects); + GLCRect rect; + if (num_rects == 0) { + rect.x = rect.y = rect.width = rect.height = 0; + glc_clip_rect(canvas->glc, &rect, GLC_CLIP_OP_SET); + } else { + SET_GLC_BOX(&rect, rects); + glc_clip_rect(canvas->glc, &rect, GLC_CLIP_OP_SET); + for (i = 1; i < num_rects; i++) { + SET_GLC_BOX(&rect, rects + i); + glc_clip_rect(canvas->glc, &rect, GLC_CLIP_OP_OR); + } + } + } + + SET_GLC_RECT(&gldest, dest); + src.x = src.y = 0; + src.width = src_width; + src.height = src_height; + + image.format = GLC_IMAGE_RGB32; + image.width = src_width; + image.height = src_height; + src_stride = -src_stride; + image.stride = src_stride; + image.pixels = (uint8_t *)src_data - (src_height - 1) * src_stride; + image.pallet = NULL; + glc_draw_image(canvas->glc, &gldest, &src, &image, 0, 1); + + glc_flush(canvas->glc); +} + +static void gl_canvas_group_end(SpiceCanvas *spice_canvas) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + + canvas_base_group_end(spice_canvas); + glc_clear_mask(canvas->glc, GLC_MASK_B); +} + +static int need_init = 1; +static SpiceCanvasOps gl_canvas_ops; + +SpiceCanvas *gl_canvas_create(int width, int height, uint32_t format +#ifdef SW_CANVAS_CACHE + , SpiceImageCache *bits_cache + , SpicePaletteCache *palette_cache +#elif defined(SW_CANVAS_IMAGE_CACHE) + , SpiceImageCache *bits_cache +#endif + , SpiceImageSurfaces *surfaces + , SpiceGlzDecoder *glz_decoder + , SpiceJpegDecoder *jpeg_decoder + , SpiceZlibDecoder *zlib_decoder + ) +{ + GLCanvas *canvas; + int init_ok; + + if (need_init) { + return NULL; + } + canvas = spice_new0(GLCanvas, 1); + + if (!(canvas->glc = glc_create(width, height))) { + goto error_1; + } + canvas->private_data = NULL; + init_ok = canvas_base_init(&canvas->base, &gl_canvas_ops, + width, height, format +#ifdef SW_CANVAS_CACHE + , bits_cache + , palette_cache +#elif defined(SW_CANVAS_IMAGE_CACHE) + , bits_cache +#endif + , surfaces + , glz_decoder + , jpeg_decoder + , zlib_decoder + ); + if (!init_ok) { + goto error_2; + } + + return (SpiceCanvas *)canvas; + +error_2: + glc_destroy(canvas->glc, 0); +error_1: + free(canvas); + + return NULL; +} + +void gl_canvas_set_textures_lost(SpiceCanvas *spice_canvas, + int textures_lost) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + + canvas->textures_lost = textures_lost; +} + +static void gl_canvas_destroy(SpiceCanvas *spice_canvas) +{ + GLCanvas *canvas = (GLCanvas *)spice_canvas; + + if (!canvas) { + return; + } + canvas_base_destroy(&canvas->base); + glc_destroy(canvas->glc, canvas->textures_lost); + free(canvas->private_data); + free(canvas); +} + +void gl_canvas_init(void) //unsafe global function +{ + if (!need_init) { + return; + } + need_init = 0; + + canvas_base_init_ops(&gl_canvas_ops); + gl_canvas_ops.draw_fill = gl_canvas_draw_fill; + gl_canvas_ops.draw_copy = gl_canvas_draw_copy; + gl_canvas_ops.draw_opaque = gl_canvas_draw_opaque; + gl_canvas_ops.copy_bits = gl_canvas_copy_bits; + gl_canvas_ops.draw_text = gl_canvas_draw_text; + gl_canvas_ops.draw_stroke = gl_canvas_draw_stroke; + gl_canvas_ops.draw_rop3 = gl_canvas_draw_rop3; + gl_canvas_ops.draw_blend = gl_canvas_draw_blend; + gl_canvas_ops.draw_blackness = gl_canvas_draw_blackness; + gl_canvas_ops.draw_whiteness = gl_canvas_draw_whiteness; + gl_canvas_ops.draw_invers = gl_canvas_draw_invers; + gl_canvas_ops.draw_transparent = gl_canvas_draw_transparent; + gl_canvas_ops.draw_alpha_blend = gl_canvas_draw_alpha_blend; + gl_canvas_ops.put_image = gl_canvas_put_image; + gl_canvas_ops.clear = gl_canvas_clear; + gl_canvas_ops.read_bits = gl_canvas_read_bits; + gl_canvas_ops.group_start = gl_canvas_group_start; + gl_canvas_ops.group_end = gl_canvas_group_end; + gl_canvas_ops.destroy = gl_canvas_destroy; + + rop3_init(); +} diff -Nru spice-gtk-0.9/spice-common/common/gl_canvas.h spice-gtk-0.12/spice-common/common/gl_canvas.h --- spice-gtk-0.9/spice-common/common/gl_canvas.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/gl_canvas.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,47 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H__GL_CANVAS +#define _H__GL_CANVAS + +#include + +#include "glc.h" +#include "canvas_base.h" +#include "region.h" + +SPICE_BEGIN_DECLS + +SpiceCanvas *gl_canvas_create(int width, int height, uint32_t format +#ifdef SW_CANVAS_CACHE + , SpiceImageCache *bits_cache + , SpicePaletteCache *palette_cache +#elif defined(SW_CANVAS_IMAGE_CACHE) + , SpiceImageCache *bits_cache +#endif + , SpiceImageSurfaces *surfaces + , SpiceGlzDecoder *glz_decoder + , SpiceJpegDecoder *jpeg_decoder + , SpiceZlibDecoder *zlib_decoder + ); +void gl_canvas_set_textures_lost(SpiceCanvas *canvas, int textures_lost); +void gl_canvas_init(void); + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/glc.c spice-gtk-0.12/spice-common/common/glc.c --- spice-gtk-0.9/spice-common/common/glc.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/glc.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,1513 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifdef WIN32 +#include "glext.h" +#include "wglext.h" +#endif + +#include "mem.h" +#include "glc.h" +#include "gl_utils.h" +#include "spice_common.h" + +#define TESS_VERTEX_ALLOC_BUNCH 20 + +typedef struct InternaCtx InternaCtx; +typedef struct InternalPat { + InternaCtx *owner; + int refs; + GLuint texture; + int x_orign; + int y_orign; + int width; + int height; +} InternalPat; + +typedef struct Pathpath { + int start_point; + int num_segments; +} Path; + +enum { + GLC_PATH_SEG_LINES, + GLC_PATH_SEG_BEIZER, +}; + +//todo: flatten cache +typedef struct PathSegment { + int type; + int count; +} PathSegment; + +typedef struct PathPoint { + double x; + double y; + double z; +} PathPoint; + +typedef GLdouble Vertex[3]; + +typedef struct InternalPath { + InternaCtx *owner; + + Path *paths; + int paths_size; + int paths_pos; + + PathSegment *segments; + int segments_size; + int segments_pos; + + PathPoint *points; + int points_size; + int points_pos; + + Path *current_path; + PathSegment *current_segment; +} InternalPath; + +typedef struct TassVertex TassVertex; +struct TassVertex { + PathPoint point; + TassVertex *list_link; + TassVertex *next; +}; + +typedef struct TassVertexBuf TassVertexBuf; +struct TassVertexBuf { + TassVertexBuf *next; + TassVertex vertexs[0]; +}; + +#define USE_LINE_ANTIALIAS 0 + +typedef struct LineDash { + double *dashes; + int num_dashes; + double offset; + int cur_dash; + double dash_pos; +} LineDash; + +enum { + GLC_STROKE_NONACTIVE, + GLC_STROKE_FIRST, + GLC_STROKE_ACTIVE, +}; + +typedef struct PathStroke { + double x; + double y; + int state; +} PathStroke; + +struct InternaCtx { + int draw_mode; + int stencil_refs; + int stencil_mask; + int width; + int height; + GLfloat line_width; + LineDash line_dash; + PathStroke path_stroke; + InternalPat *pat; + int max_texture_size; + GLUtesselator* tesselator; + TassVertex *free_tess_vertex; + TassVertex *used_tess_vertex; + TassVertexBuf *vertex_bufs; + int private_tex_width; + int private_tex_height; + GLuint private_tex; +#ifdef WIN32 + PFNGLBLENDEQUATIONPROC glBlendEquation; +#endif +}; + +#define Y(y) -(y) +#define VERTEX2(x, y) glVertex2d(x, Y(y)) + +static void fill_rect(InternaCtx *ctx, void *rect); +static void fill_path(InternaCtx *ctx, void *path); +static void fill_mask(InternaCtx *ctx, int x_dest, int y_dest, int width, int height, int stride, + const uint8_t *bitmap); +static void set_pat(InternaCtx *ctx, InternalPat *pat); + +static inline void set_raster_pos(InternaCtx *ctx, int x, int y) +{ + if (x >= 0 && y >= 0 && x < ctx->width && y < ctx->height) { + glRasterPos2i(x, Y(y)); + return; + } + glRasterPos2i(0, 0); + glBitmap(0, 0, 0, 0, (GLfloat)x, (GLfloat)Y(y), NULL); +} + +static TassVertex *alloc_tess_vertex(InternaCtx *ctx) +{ + TassVertex *vertex; + + if (!ctx->free_tess_vertex) { + TassVertexBuf *buf; + int i; + + buf = (TassVertexBuf *)spice_malloc(sizeof(TassVertexBuf) + + sizeof(TassVertex) * TESS_VERTEX_ALLOC_BUNCH); + buf->next = ctx->vertex_bufs; + ctx->vertex_bufs = buf; + for (i = 0; i < TESS_VERTEX_ALLOC_BUNCH; i++) { + buf->vertexs[i].point.z = 0; + buf->vertexs[i].next = ctx->free_tess_vertex; + ctx->free_tess_vertex = &buf->vertexs[i]; + } + } + + vertex = ctx->free_tess_vertex; + ctx->free_tess_vertex = vertex->next; + vertex->next = ctx->used_tess_vertex; + ctx->used_tess_vertex = vertex; + return vertex; +} + +static void reset_tass_vertex(InternaCtx *ctx) +{ + TassVertex *vertex; + while ((vertex = ctx->used_tess_vertex)) { + ctx->used_tess_vertex = vertex->next; + vertex->next = ctx->free_tess_vertex; + ctx->free_tess_vertex = vertex; + } +} + +static void free_tass_vertex_bufs(InternaCtx *ctx) +{ + TassVertexBuf *buf; + + ctx->used_tess_vertex = NULL; + ctx->free_tess_vertex = NULL; + while ((buf = ctx->vertex_bufs)) { + ctx->vertex_bufs = buf->next; + free(buf); + } +} + +//naive bezier flattener +static TassVertex *bezier_flattener(InternaCtx *ctx, PathPoint *points) +{ + double ax, bx, cx; + double ay, by, cy; + const int num_points = 30; + double dt; + int i; + + TassVertex *vertex_list = NULL; + TassVertex *curr_vertex; + + for (i = 0; i < num_points - 2; i++) { + TassVertex *vertex; + + vertex = alloc_tess_vertex(ctx); + vertex->list_link = vertex_list; + vertex_list = vertex; + } + + curr_vertex = vertex_list; + + cx = 3.0 * (points[1].x - points[0].x); + bx = 3.0 * (points[2].x - points[1].x) - cx; + ax = points[3].x - points[0].x - cx - bx; + + cy = 3.0 * (points[1].y - points[0].y); + by = 3.0 * (points[2].y - points[1].y) - cy; + ay = points[3].y - points[0].y - cy - by; + + dt = 1.0 / (num_points - 1); + + for (i = 1; i < num_points - 1; i++, curr_vertex = curr_vertex->list_link) { + double tSquared, tCubed; + double t; + t = i * dt; + + tSquared = t * t; + tCubed = tSquared * t; + + curr_vertex->point.x = (ax * tCubed) + (bx * tSquared) + (cx * t) + points[0].x; + curr_vertex->point.y = (ay * tCubed) + (by * tSquared) + (cy * t) + points[0].y; + } + + return vertex_list; +} + +#define MORE_X(path, Type, name) { \ + Type *name; \ + \ + name = spice_new0(Type, path->name##_size * 2); \ + memcpy(name, path->name, sizeof(*name) * path->name##_size); \ + free(path->name); \ + path->name = name; \ + path->name##_size *= 2; \ +} + +static void more_points(InternalPath *path) +{ + MORE_X(path, PathPoint, points); +} + +static void more_segments(InternalPath *path) +{ + MORE_X(path, PathSegment, segments); +} + +static void more_paths(InternalPath *path) +{ + MORE_X(path, Path, paths); +} + +static inline void put_point(InternalPath *path, double x, double y) +{ + path->points[path->points_pos].x = x; + path->points[path->points_pos].y = Y(y + 0.5); + path->points[path->points_pos++].z = 0; +} + +void glc_path_move_to(GLCPath path, double x, double y) +{ + InternalPath *internal = (InternalPath *)path; + + spice_assert(internal); + + if (internal->current_segment) { + internal->current_segment = NULL; + internal->current_path = NULL; + if (internal->points_pos == internal->points_size) { + more_points(internal); + } + internal->points_pos++; + } + internal->points[internal->points_pos - 1].x = x; + internal->points[internal->points_pos - 1].y = Y(y + 0.5); + internal->points[internal->points_pos - 1].z = 0; +} + +static void add_segment_common(InternalPath *internal, int type, int num_points) +{ + if (internal->points_size - internal->points_pos < num_points) { + more_points(internal); + } + + if (internal->current_segment) { + if (internal->current_segment->type == type) { + internal->current_segment->count++; + return; + } + if (internal->segments_pos == internal->segments_size) { + more_segments(internal); + } + internal->current_segment = &internal->segments[internal->segments_pos++]; + internal->current_segment->type = type; + internal->current_segment->count = 1; + internal->current_path->num_segments++; + return; + } + + if (internal->paths_pos == internal->paths_size) { + more_paths(internal); + } + + if (internal->segments_pos == internal->segments_size) { + more_segments(internal); + } + + internal->current_path = &internal->paths[internal->paths_pos++]; + internal->current_path->start_point = internal->points_pos - 1; + internal->current_path->num_segments = 1; + internal->current_segment = &internal->segments[internal->segments_pos++]; + internal->current_segment->type = type; + internal->current_segment->count = 1; +} + +void glc_path_line_to(GLCPath path, double x, double y) +{ + InternalPath *internal = (InternalPath *)path; + + spice_assert(internal); + + add_segment_common(internal, GLC_PATH_SEG_LINES, 1); + put_point(internal, x, y); +} + +void glc_path_curve_to(GLCPath path, double p1_x, double p1_y, double p2_x, double p2_y, + double p3_x, double p3_y) +{ + InternalPath *internal = (InternalPath *)path; + + spice_assert(internal); + + add_segment_common(internal, GLC_PATH_SEG_BEIZER, 3); + put_point(internal, p1_x, p1_y); + put_point(internal, p2_x, p2_y); + put_point(internal, p3_x, p3_y); +} + +void glc_path_close(GLCPath path) +{ + InternalPath *internal = (InternalPath *)path; + + spice_assert(internal); + if (!internal->current_path) { + return; + } + PathPoint *end_point = &internal->points[internal->current_path->start_point]; + glc_path_line_to(path, end_point->x, Y(end_point->y)); + glc_path_move_to(path, end_point->x, Y(end_point->y)); +} + +void glc_path_cleare(GLCPath path) +{ + InternalPath *internal = (InternalPath *)path; + + spice_assert(internal); + internal->paths_pos = internal->segments_pos = 0; + internal->current_segment = NULL; + internal->current_path = NULL; + + internal->points[0].x = 0; + internal->points[0].y = 0; + internal->points_pos = 1; +} + +GLCPath glc_path_create(GLCCtx glc) +{ + InternaCtx *ctx = (InternaCtx *)glc; + InternalPath *path; + + spice_assert(ctx); + path = spice_new0(InternalPath, 1); + path->paths_size = 2; + path->paths = spice_new(Path, path->paths_size); + + path->segments_size = 4; + path->segments = spice_new(PathSegment, path->segments_size); + + path->points_size = 20; + path->points = spice_new(PathPoint, path->points_size); + + path->owner = ctx; + path->points_pos = 1; + return path; +} + +void glc_path_destroy(GLCPath path) +{ + InternalPath *internal = (InternalPath *)path; + + if (!path) { + return; + } + + free(internal->points); + free(internal->segments); + free(internal->paths); + free(internal); +} + +static inline void unref_pat(InternalPat *pat) +{ + if (!pat) { + return; + } + spice_assert(pat->refs > 0); + if (--pat->refs == 0) { + glFinish(); + glDeleteTextures(1, &pat->texture); + free(pat); + } + GLC_ERROR_TEST_FLUSH; +} + +static inline InternalPat *ref_pat(InternalPat *pat) +{ + pat->refs++; + return pat; +} + +static void scale(uint32_t *dest, uint32_t dest_width, uint32_t dest_height, + uint32_t *src, uint32_t src_width, uint32_t src_height, int src_stride) +{ + double x_scale = (double)src_width / dest_width; + double y_scale = (double)src_height / dest_height; + uint32_t i; + uint32_t j; + int prev_row = -1; + + for (i = 0; i < dest_height; i++) { + int row = (int)(y_scale * i); + if (row == prev_row) { + memcpy(dest, dest - dest_width, dest_width * sizeof(uint32_t)); + dest += dest_width; + continue; + } + for (j = 0; j < dest_width; j++) { + int col = (int)(x_scale * j); + *(dest++) = *(src + col); + } + prev_row = row; + src = (uint32_t *)((uint8_t *)src + src_stride); + } +} + +static inline void init_pattern(InternalPat *pat, int x_orign, int y_orign, const GLCImage *image) +{ + InternaCtx *ctx = pat->owner; + uint32_t *tmp_pixmap = NULL; + int width; + int height; + int width2; + int height2; + + const int pix_bytes = 4; + + spice_assert(image->format == GLC_IMAGE_RGB32); //for now + + width = image->width; + height = image->height; + width2 = gl_get_to_power_two(width); + height2 = gl_get_to_power_two(height); + + spice_assert(width > 0 && height > 0); + spice_assert(width > 0 && width <= pat->owner->max_texture_size); + spice_assert(height > 0 && height <= pat->owner->max_texture_size); + + if (width2 != width || height2 != height) { + tmp_pixmap = (uint32_t *)spice_malloc(width2 * height2 * sizeof(uint32_t)); + scale(tmp_pixmap, width2, height2, (uint32_t *)image->pixels, width, height, image->stride); + } + + glBindTexture(GL_TEXTURE_2D, pat->texture); + + //glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + + if (tmp_pixmap) { + glPixelStorei(GL_UNPACK_ROW_LENGTH, width2); + glTexImage2D(GL_TEXTURE_2D, 0, 4, width2, height2, 0, GL_BGRA, GL_UNSIGNED_BYTE, + tmp_pixmap); + free(tmp_pixmap); + } else { + spice_assert(image->stride % pix_bytes == 0); + glPixelStorei(GL_UNPACK_ROW_LENGTH, image->stride / pix_bytes); + glTexImage2D(GL_TEXTURE_2D, 0, 4, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, + image->pixels); + } + + GLC_ERROR_TEST_FLUSH; + pat->x_orign = x_orign % width; + pat->y_orign = y_orign % height; + pat->width = width; + pat->height = height; + + if (ctx->pat == pat) { + set_pat(pat->owner, pat); + } else if (ctx->pat) { + glBindTexture(GL_TEXTURE_2D, ctx->pat->texture); + } +} + +GLCPattern glc_pattern_create(GLCCtx glc, int x_orign, int y_orign, const GLCImage *image) +{ + InternaCtx *ctx = (InternaCtx *)glc; + InternalPat *pat; + + spice_assert(ctx && image); + + pat = spice_new0(InternalPat, 1); + pat->refs = 1; + pat->owner = ctx; + glGenTextures(1, &pat->texture); + init_pattern(pat, x_orign, y_orign, image); + return pat; +} + +void glc_pattern_set(GLCPattern pattern, int x_orign, int y_orign, const GLCImage *image) +{ + InternalPat *pat = (InternalPat *)pattern; + spice_assert(pat && pat->owner); + + glFinish(); + init_pattern(pat, x_orign, y_orign, image); +} + +void glc_pattern_destroy(GLCPattern pat) +{ + unref_pat((InternalPat *)pat); + GLC_ERROR_TEST_FLUSH; +} + +static void set_pat(InternaCtx *ctx, InternalPat *pat) +{ + pat = ref_pat(pat); + unref_pat(ctx->pat); + ctx->pat = pat; + + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, pat->texture); + + GLfloat s_gen_params[] = { (GLfloat)1.0 / pat->width, 0, 0, 0 }; + GLfloat t_gen_params[] = { 0, (GLfloat)1.0 / (GLfloat)pat->height, 0, 0 }; + glTexGenfv(GL_S, GL_OBJECT_PLANE, s_gen_params); + glTexGenfv(GL_T, GL_OBJECT_PLANE, t_gen_params); + + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glTranslatef((float)pat->x_orign / pat->width, (float)Y(pat->y_orign) / pat->height, 0); + GLC_ERROR_TEST_FLUSH; +} + +void glc_set_pattern(GLCCtx glc, GLCPattern pattern) +{ + InternaCtx *ctx = (InternaCtx *)glc; + InternalPat *pat = (InternalPat *)pattern; + + spice_assert(ctx && pat && pat->owner == ctx); + set_pat(ctx, pat); +} + +void glc_set_rgb(GLCCtx glc, double red, double green, double blue) +{ + InternaCtx *ctx = (InternaCtx *)glc; + + spice_assert(ctx); + + glDisable(GL_TEXTURE_2D); + unref_pat(ctx->pat); + ctx->pat = NULL; + glColor4d(red, green, blue, 1); + GLC_ERROR_TEST_FLUSH; +} + +void glc_set_op(GLCCtx glc, GLCOp op) +{ + if (op == GL_COPY) { + glDisable(GL_COLOR_LOGIC_OP); + return; + } + glLogicOp(op); + glEnable(GL_COLOR_LOGIC_OP); +} + +void glc_set_line_width(GLCCtx glc, double width) +{ + InternaCtx *ctx = (InternaCtx *)glc; + + spice_assert(ctx); + ctx->line_width = (GLfloat)width; + if (ctx->line_width > 0) { + glLineWidth(ctx->line_width); + } else { + ctx->line_width = 0; + } + GLC_ERROR_TEST_FLUSH; +} + +void glc_set_line_dash(GLCCtx glc, const double *dashes, int num_dashes, double offset) +{ + InternaCtx *ctx = (InternaCtx *)glc; + + spice_assert(ctx); + if (dashes && num_dashes >= 0 && offset >= 0) { + ctx->line_dash.dashes = spice_new(double, num_dashes); + memcpy(ctx->line_dash.dashes, dashes, sizeof(double) * num_dashes); + ctx->line_dash.num_dashes = num_dashes; + ctx->line_dash.offset = offset; + ctx->line_dash.cur_dash = offset ? -1 : 0; + ctx->line_dash.dash_pos = 0; + } else { + free(ctx->line_dash.dashes); + memset(&ctx->line_dash, 0, sizeof(ctx->line_dash)); + } +} + +void glc_set_fill_mode(GLCCtx glc, GLCFillMode fill_mode) +{ + InternaCtx *ctx = (InternaCtx *)glc; + + spice_assert(ctx); + int mode; + switch (fill_mode) { + case GLC_FILL_MODE_WINDING_ODD: + mode = GLU_TESS_WINDING_ODD; + break; + case GLC_FILL_MODE_WINDING_NONZERO: + mode = GLU_TESS_WINDING_NONZERO; + break; + default: + //warn + return; + } + gluTessProperty(ctx->tesselator, GLU_TESS_WINDING_RULE, mode); +} + +static inline void add_stencil_client(InternaCtx *ctx) +{ + if (!ctx->stencil_refs) { + glEnable(GL_STENCIL_TEST); + } + ctx->stencil_refs++; +} + +static inline void remove_stencil_client(InternaCtx *ctx) +{ + ctx->stencil_refs--; + if (!ctx->stencil_refs) { + glDisable(GL_STENCIL_TEST); + } +} + +void glc_set_mask(GLCCtx glc, int x_dest, int y_dest, int width, int height, + int stride, const uint8_t *bitmap, GLCMaskID id) +{ + InternaCtx *ctx = (InternaCtx *)glc; + uint32_t mask = (id == GLC_MASK_A) ? 0x04 : 0x08; + spice_assert(ctx && bitmap); + spice_assert(id == GLC_MASK_A || id == GLC_MASK_B); + + if (ctx->pat) { + glDisable(GL_TEXTURE_2D); + } + + glDisable(GL_BLEND); + + if (!(ctx->stencil_mask & mask)) { + add_stencil_client(ctx); + ctx->stencil_mask |= mask; + } + + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + ctx->draw_mode = FALSE; + glStencilMask(mask); + glClear(GL_STENCIL_BUFFER_BIT); + + glStencilFunc(GL_ALWAYS, mask, mask); + glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); + fill_mask(ctx, x_dest, y_dest, width, height, stride, bitmap); +} + +void glc_mask_rects(GLCCtx glc, int num_rect, GLCRect *rects, GLCMaskID id) +{ + InternaCtx *ctx = (InternaCtx *)glc; + uint32_t mask = (id == GLC_MASK_A) ? 0x04 : 0x08; + GLCRect *end; + spice_assert(ctx && rects); + spice_assert(id == GLC_MASK_A || id == GLC_MASK_B); + + if (ctx->pat) { + glDisable(GL_TEXTURE_2D); + } + + glDisable(GL_BLEND); + + if (!(ctx->stencil_mask & mask)) { + add_stencil_client(ctx); + ctx->stencil_mask |= mask; + } + + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + ctx->draw_mode = FALSE; + glStencilMask(mask); + glClear(GL_STENCIL_BUFFER_BIT); + + glStencilFunc(GL_ALWAYS, mask, mask); + glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); + end = rects + num_rect; + for (; rects < end; rects++) { + fill_rect(ctx, rects); + } +} + +void glc_clear_mask(GLCCtx glc, GLCMaskID id) +{ + InternaCtx *ctx = (InternaCtx *)glc; + uint32_t mask = (id == GLC_MASK_A) ? 0x04 : 0x08; + spice_assert(ctx); + spice_assert(id == GLC_MASK_A || id == GLC_MASK_B); + + if ((ctx->stencil_mask & mask)) { + ctx->stencil_mask &= ~mask; + remove_stencil_client(ctx); + } +} + +void glc_clip_reset(GLCCtx glc) +{ + InternaCtx *ctx = (InternaCtx *)glc; + + if (!(ctx->stencil_mask & 0x03)) { + return; + } + remove_stencil_client(ctx); + ctx->stencil_mask &= ~0x03; + glStencilMask(0x03); + glClear(GL_STENCIL_BUFFER_BIT); + GLC_ERROR_TEST_FLUSH; +} + +static void clip_common(InternaCtx *ctx, GLCClipOp op, void (*fill_func)(InternaCtx *, void *), + void *data) +{ + int stencil_val; + + if (ctx->pat) { + glDisable(GL_TEXTURE_2D); + } + glDisable(GL_BLEND); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + ctx->draw_mode = FALSE; + + if (op == GLC_CLIP_OP_SET) { + glc_clip_reset(ctx); + add_stencil_client(ctx); + ctx->stencil_mask |= 0x01; + } else if (!(ctx->stencil_mask & 0x03)) { + GLCRect area; + if (op == GLC_CLIP_OP_OR) { + return; + } + area.x = area.y = 0; + area.width = ctx->width; + area.height = ctx->height; + clip_common(ctx, GLC_CLIP_OP_SET, fill_rect, &area); + } + glStencilMask(0x03); + switch (op) { + case GLC_CLIP_OP_SET: + case GLC_CLIP_OP_OR: + stencil_val = ctx->stencil_mask & 0x03; + glStencilFunc(GL_ALWAYS, stencil_val, stencil_val); + glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); + fill_func(ctx, data); + break; + case GLC_CLIP_OP_AND: { + int clear_mask; + stencil_val = ctx->stencil_mask & 0x03; + glStencilFunc(GL_EQUAL, stencil_val, stencil_val); + if (stencil_val == 0x01) { + glStencilOp(GL_ZERO, GL_INCR, GL_INCR); + stencil_val = 0x02; + clear_mask = 0x01; + } else { + glStencilOp(GL_ZERO, GL_DECR, GL_DECR); + stencil_val = 0x01; + clear_mask = 0x02; + } + fill_func(ctx, data); + + glStencilMask(clear_mask); + glClear(GL_STENCIL_BUFFER_BIT); + ctx->stencil_mask = (ctx->stencil_mask & ~clear_mask) | stencil_val; + break; + } + case GLC_CLIP_OP_EXCLUDE: + stencil_val = ctx->stencil_mask & 0x03; + glStencilFunc(GL_EQUAL, stencil_val, stencil_val); + glStencilOp(GL_KEEP, GL_ZERO, GL_ZERO); + fill_func(ctx, data); + break; + } + GLC_ERROR_TEST_FLUSH; +} + +void glc_clip_rect(GLCCtx glc, const GLCRect *rect, GLCClipOp op) +{ + InternaCtx *ctx = (InternaCtx *)glc; + + spice_assert(ctx && rect); + clip_common(ctx, op, fill_rect, (void *)rect); +} + +void glc_clip_path(GLCCtx glc, GLCPath path, GLCClipOp op) +{ + InternaCtx *ctx = (InternaCtx *)glc; + + spice_assert(ctx && path); + clip_common(ctx, op, fill_path, path); +} + +typedef struct FillMaskInfo { + int x_dest; + int y_dest; + int width; + int height; + int stride; + const uint8_t *bitmap; +} FillMaskInfo; + +static void __fill_mask(InternaCtx *ctx, void *data) +{ + FillMaskInfo *info = (FillMaskInfo *)data; + fill_mask(ctx, info->x_dest, info->y_dest, info->width, info->height, info->stride, + info->bitmap); +} + +void glc_clip_mask(GLCCtx glc, int x_dest, int y_dest, int width, int height, + int stride, const uint8_t *bitmap, GLCClipOp op) +{ + InternaCtx *ctx = (InternaCtx *)glc; + FillMaskInfo mask_info; + + spice_assert(ctx && bitmap); + mask_info.x_dest = x_dest; + mask_info.y_dest = y_dest; + mask_info.width = width; + mask_info.height = height; + mask_info.stride = stride; + mask_info.bitmap = bitmap; + clip_common(ctx, op, __fill_mask, &mask_info); +} + +static inline void start_draw(InternaCtx *ctx) +{ + if (ctx->draw_mode) { + return; + } + ctx->draw_mode = TRUE; + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glStencilFunc(GL_EQUAL, ctx->stencil_mask, ctx->stencil_mask); + glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); + if (ctx->pat) { + glEnable(GL_TEXTURE_2D); + } else { + glDisable(GL_TEXTURE_2D); + } + GLC_ERROR_TEST_FLUSH; +} + +static void fill_rect(InternaCtx *ctx, void *r) +{ + GLCRect *rect = (GLCRect *)r; + glRectd(rect->x, Y(rect->y), rect->x + rect->width, Y(rect->y + rect->height)); + /*glBegin(GL_POLYGON); + VERTEX2(rect->x, rect->y); + VERTEX2 (rect->x + rect->width, rect->y); + VERTEX2 (rect->x + rect->width, rect->y + rect->height); + VERTEX2 (rect->x , rect->y + rect->height); + glEnd();*/ + GLC_ERROR_TEST_FLUSH; +} + +void glc_fill_rect(GLCCtx glc, const GLCRect *rect) +{ + InternaCtx *ctx = (InternaCtx *)glc; + GLCRect *r = (GLCRect *)rect; // to avoid bugs in gcc older than 4.3 + + spice_assert(ctx); + start_draw(ctx); + fill_rect(ctx, (void *)r); + GLC_ERROR_TEST_FLUSH; +} + +static void fill_path(InternaCtx *ctx, void *p) +{ + InternalPath *path = (InternalPath *)p; + + PathPoint *current_point = path->points; + PathSegment *current_segment = path->segments; + Path *current_path = path->paths; + Path *end_path = current_path + path->paths_pos; + reset_tass_vertex(ctx); + gluTessBeginPolygon(ctx->tesselator, ctx); + for (; current_path < end_path; current_path++) { + gluTessBeginContour(ctx->tesselator); + PathSegment *end_segment = current_segment + current_path->num_segments; + gluTessVertex(ctx->tesselator, (GLdouble *)current_point, current_point); + current_point++; + for (; current_segment < end_segment; current_segment++) { + PathPoint *end_point; + if (current_segment->type == GLC_PATH_SEG_BEIZER) { + end_point = current_point + current_segment->count * 3; + for (; current_point < end_point; current_point += 3) { + TassVertex *vertex = bezier_flattener(ctx, current_point - 1); + while (vertex) { + gluTessVertex(ctx->tesselator, (GLdouble *)&vertex->point, + (GLdouble *)&vertex->point); + vertex = vertex->list_link; + } + gluTessVertex(ctx->tesselator, (GLdouble *)¤t_point[2], + (GLdouble *)¤t_point[2]); + } + } else { + spice_assert(current_segment->type == GLC_PATH_SEG_LINES); + end_point = current_point + current_segment->count; + for (; current_point < end_point; current_point++) { + gluTessVertex(ctx->tesselator, (GLdouble *)current_point, + (GLdouble *)current_point); + } + } + } + gluTessEndContour(ctx->tesselator); + } + gluTessEndPolygon(ctx->tesselator); +} + +void glc_fill_path(GLCCtx glc, GLCPath path_ref) +{ + InternaCtx *ctx = (InternaCtx *)glc; + + spice_assert(ctx && path_ref); + start_draw(ctx); + fill_path(ctx, path_ref); +} + +static void fill_mask(InternaCtx *ctx, int x_dest, int y_dest, int width, int height, + int stride, const uint8_t *bitmap) +{ + set_raster_pos(ctx, x_dest, y_dest + height); + glPixelStorei(GL_UNPACK_ROW_LENGTH, stride * 8); + glBitmap(width, height, 0, 0, 0, 0, bitmap); +} + +void _glc_fill_mask(GLCCtx glc, int x_dest, int y_dest, int width, int height, int stride, + const uint8_t *bitmap) +{ + InternaCtx *ctx = (InternaCtx *)glc; + + spice_assert(ctx && bitmap); + start_draw(ctx); + if (ctx->pat) { + spice_critical("unimplemented fill mask with pattern"); + } + fill_mask(ctx, x_dest, y_dest, width, height, stride, bitmap); +} + +void glc_fill_alpha(GLCCtx glc, int x_dest, int y_dest, int width, int height, int stride, + const uint8_t *alpha_mask) +{ + InternaCtx *ctx = (InternaCtx *)glc; + GLCRect r; + + spice_assert(ctx); + start_draw(ctx); + + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); + set_raster_pos(ctx, x_dest, y_dest + height); + glPixelStorei(GL_UNPACK_ROW_LENGTH, stride); + glPixelZoom(1, 1); + glDrawPixels(width, height, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_mask); + + r.x = x_dest; + r.y = y_dest; + r.width = width; + r.height = height; + + //todo: support color/texture alpah vals (GL_MODULATE) + glEnable(GL_BLEND); + glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + fill_rect(ctx, &r); + glDisable(GL_BLEND); +} + +void glc_stroke_rect(GLCCtx glc, const GLCRect *rect) +{ + InternaCtx *ctx = (InternaCtx *)glc; + + spice_assert(ctx); + if (ctx->line_width == 0) { + return; + } + + start_draw(ctx); + + glBegin(GL_LINES); + VERTEX2(rect->x, rect->y + 0.5); + VERTEX2(rect->x + rect->width, rect->y + 0.5); + VERTEX2(rect->x + rect->width - 0.5, rect->y); + VERTEX2(rect->x + rect->width - 0.5, rect->y + rect->height); + VERTEX2(rect->x + rect->width, rect->y + rect->height - 0.5); + VERTEX2(rect->x, rect->y + rect->height - 0.5); + VERTEX2(rect->x + 0.5, rect->y + rect->height); + VERTEX2(rect->x + 0.5, rect->y); + glEnd(); + GLC_ERROR_TEST_FLUSH; +} + +static void glc_stroke_line(double x1, double y1, double x2, double y2, double width) +{ + double ax, ay, bx, by, cx, cy, dx, dy; + double norm, tx; + + if (width == 1 || y1 == y2 || x1 == x2) { + glBegin(GL_LINES); + glVertex2d(x1, y1); + glVertex2d(x2, y2); + glEnd(); + return; + } + norm = (x1 - x2) / (y2 - y1); + tx = width / (2 * sqrt(1 + norm * norm)); + ax = x1 + tx; + ay = y1 + norm * (ax - x1); + bx = x2 + tx; + by = y2 + norm * (bx - x2); + cx = x2 - tx; + cy = y2 + norm * (cx - x2); + dx = x1 - tx; + dy = y1 + norm * (dx - x1); + glBegin(GL_POLYGON); + glVertex2d(ax, ay); + glVertex2d(bx, by); + glVertex2d(cx, cy); + glVertex2d(dx, dy); + glEnd(); +} + +static double glc_stroke_line_dash(double x1, double y1, double x2, double y2, + double width, LineDash *dash) +{ + double ax, ay, bx, by; + double mx, my, len; + double dash_len, total = 0; + + len = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)); + if (!dash->dashes || !dash->num_dashes) { + glc_stroke_line(x1, y1, x2, y2, width); + return len; + } + mx = (x2 - x1) / len; + my = (y2 - y1) / len; + ax = x1; + ay = y1; + while (total < len) { + if (dash->cur_dash >= 0) { + dash_len = dash->dashes[dash->cur_dash % dash->num_dashes] - dash->dash_pos; + } else { + dash_len = dash->offset - dash->dash_pos; + } + total += dash_len; + if (total < len) { + bx = x1 + mx * total; + by = y1 + my * total; + dash->dash_pos = 0; + } else { + bx = x2; + by = y2; + dash->dash_pos = dash->dashes[dash->cur_dash % dash->num_dashes] - (total - len); + } + if (dash->cur_dash % 2 == 0) { + glc_stroke_line(ax, ay, bx, by, width); + } + if (dash->dash_pos == 0) { + dash->cur_dash = (dash->cur_dash + 1) % (2 * dash->num_dashes); + } + ax = bx; + ay = by; + } + return len; +} + +static void glc_vertex2d(InternaCtx *ctx, double x, double y) +{ + if (ctx->path_stroke.state == GLC_STROKE_ACTIVE) { + glc_stroke_line_dash(ctx->path_stroke.x, ctx->path_stroke.y, x, y, + ctx->line_width, &ctx->line_dash); + ctx->path_stroke.x = x; + ctx->path_stroke.y = y; + } else if (ctx->path_stroke.state == GLC_STROKE_FIRST) { + ctx->path_stroke.x = x; + ctx->path_stroke.y = y; + ctx->path_stroke.state = GLC_STROKE_ACTIVE; + } else { + spice_assert(ctx->path_stroke.state == GLC_STROKE_NONACTIVE); + //error + } +} + +static void glc_begin_path(InternaCtx *ctx) +{ + ctx->path_stroke.state = GLC_STROKE_FIRST; + ctx->line_dash.cur_dash = ctx->line_dash.offset ? -1 : 0; + ctx->line_dash.dash_pos = 0; +} + +static void glc_end_path(InternaCtx *ctx) +{ + ctx->path_stroke.state = GLC_STROKE_NONACTIVE; +} + +void glc_stroke_path(GLCCtx glc, GLCPath path_ref) +{ + InternaCtx *ctx = (InternaCtx *)glc; + InternalPath *path = (InternalPath *)path_ref; + + spice_assert(ctx && path); + if (ctx->line_width == 0) { + return; + } + start_draw(ctx); + + reset_tass_vertex(ctx); + PathPoint *current_point = path->points; + PathSegment *current_segment = path->segments; + Path *current_path = path->paths; + Path *end_path = current_path + path->paths_pos; + for (; current_path < end_path; current_path++) { + glc_begin_path(ctx); + PathSegment *end_segment = current_segment + current_path->num_segments; + glc_vertex2d(ctx, current_point->x, current_point->y); + current_point++; + for (; current_segment < end_segment; current_segment++) { + PathPoint *end_point; + if (current_segment->type == GLC_PATH_SEG_BEIZER) { + end_point = current_point + current_segment->count * 3; + for (; current_point < end_point; current_point += 3) { + TassVertex *vertex = bezier_flattener(ctx, current_point - 1); + while (vertex) { + glc_vertex2d(ctx, vertex->point.x, vertex->point.y); + vertex = vertex->list_link; + } + glc_vertex2d(ctx, current_point[2].x, current_point[2].y); + } + } else { + spice_assert(current_segment->type == GLC_PATH_SEG_LINES); + end_point = current_point + current_segment->count; + for (; current_point < end_point; current_point++) { + glc_vertex2d(ctx, current_point->x, current_point->y); + } + } + } + glc_end_path(ctx); + } +} + +void glc_draw_image(GLCCtx glc, const GLCRecti *dest, const GLCRecti *src, const GLCImage *image, + int scale_mode, double alpha) +{ + InternaCtx *ctx = (InternaCtx *)glc; + uint8_t *pixels; + const int pix_bytes = 4; + + spice_assert(ctx && image); + spice_assert(src->width > 0 && src->height > 0); + + spice_assert(image->format == GLC_IMAGE_RGB32 || image->format == GLC_IMAGE_ARGB32); //for now + start_draw(ctx); + if (ctx->pat) { + glDisable(GL_TEXTURE_2D); + } + set_raster_pos(ctx, dest->x, dest->y + dest->height); + + if (dest->width == src->width && src->height == dest->height) { + glPixelZoom(1, 1); + } else { + glPixelZoom((float)dest->width / src->width, (float)dest->height / src->height); + } + + pixels = image->pixels + src->x * 4 + (image->height - (src->y + src->height)) * image->stride; + if (image->format == GLC_IMAGE_ARGB32 || alpha != 1) { + glPixelTransferf(GL_ALPHA_SCALE, (GLfloat)alpha); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + } + spice_assert(image->stride % pix_bytes == 0); + glPixelStorei(GL_UNPACK_ROW_LENGTH, image->stride / pix_bytes); + glDrawPixels(src->width, src->height, GL_BGRA, GL_UNSIGNED_BYTE, pixels); + + if (image->format == GLC_IMAGE_ARGB32 || alpha != 1) { + glDisable(GL_BLEND); + } + + if (ctx->pat) { + glEnable(GL_TEXTURE_2D); + } + GLC_ERROR_TEST_FLUSH; +} + +void glc_copy_pixels(GLCCtx glc, int x_dest, int y_dest, int x_src, int y_src, int width, + int height) +{ + InternaCtx *ctx = (InternaCtx *)glc; + int recreate = 0; + + spice_assert(ctx); +#ifdef USE_COPY_PIXELS + start_draw(ctx); + if (ctx->pat) { + glDisable(GL_TEXTURE_2D); + } + set_raster_pos(ctx, x_dest, y_dest + height); + glPixelZoom(1, 1); + glCopyPixels(x_src, ctx->height - (y_src + height), width, height, GL_COLOR); + if (ctx->pat) { + glEnable(GL_TEXTURE_2D); + } +#else + int width2 = gl_get_to_power_two(width); + int height2 = gl_get_to_power_two(height); + + start_draw(ctx); + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, 0); + + if (width2 > ctx->private_tex_width) { + ctx->private_tex_width = width2; + recreate = 1; + } + if (height2 > ctx->private_tex_height) { + ctx->private_tex_height = height2; + recreate = 1; + } + if (recreate) { + glDeleteTextures(1, &ctx->private_tex); + glGenTextures(1, &ctx->private_tex); + glBindTexture(GL_TEXTURE_2D, ctx->private_tex); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + ctx->private_tex_width = gl_get_to_power_two(width); + ctx->private_tex_height = gl_get_to_power_two(height); + glTexImage2D(GL_TEXTURE_2D, 0, 4, ctx->private_tex_width, + ctx->private_tex_height, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); + } + spice_assert(ctx->private_tex); + glBindTexture(GL_TEXTURE_2D, ctx->private_tex); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, x_src, ctx->height - (y_src + height), + width2, height2, 0); + + GLfloat s_gen_params[] = { (GLfloat)1.0 / width2, 0, 0, 0 }; + GLfloat t_gen_params[] = { 0, (GLfloat)1.0 / height2, 0, 0 }; + glTexGenfv(GL_S, GL_OBJECT_PLANE, s_gen_params); + glTexGenfv(GL_T, GL_OBJECT_PLANE, t_gen_params); + + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glTranslatef((float)-x_dest / width2, (float)-Y(y_dest + height) / height2, 0); + + glRecti(x_dest, Y(y_dest), x_dest + width, Y(y_dest + height)); + glFlush(); + if (!ctx->pat) { + glDisable(GL_TEXTURE_2D); + } else { + set_pat(ctx, ctx->pat); + } +#endif + GLC_ERROR_TEST_FLUSH; +} + +void glc_read_pixels(GLCCtx glc, int x, int y, GLCImage *image) +{ + InternaCtx *ctx = (InternaCtx *)glc; + + spice_assert(ctx && image); + spice_assert(image->format == GLC_IMAGE_RGB32); //for now + spice_assert((image->stride % 4) == 0); //for now + glPixelStorei(GL_PACK_ROW_LENGTH, image->stride / 4); + glReadPixels(x, ctx->height - (y + image->height), image->width, image->height, + GL_BGRA, GL_UNSIGNED_BYTE, image->pixels); +} + +void glc_clear(GLCCtx glc) +{ + InternaCtx *ctx = (InternaCtx *)glc; + + spice_assert(ctx); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glClear(GL_COLOR_BUFFER_BIT); +} + +void glc_flush(GLCCtx glc) +{ + glFlush(); + + GLC_ERROR_TEST_FLUSH; +} + +static void tessellation_combine(GLdouble coords[3], GLdouble *vertex_data[4], GLfloat weight[4], + GLdouble **data_out, void *usr_data) +{ + TassVertex *vertex; + + vertex = alloc_tess_vertex((InternaCtx *)usr_data); + vertex->point.x = coords[0]; + vertex->point.y = coords[1]; + //vertex->point.z = coords[2]; + *data_out = (GLdouble *)&vertex->point; +} + +static void tessellation_error(GLenum errorCode) +{ + printf("%s: %s\n", __FUNCTION__, gluErrorString(errorCode)); +} + +#ifdef WIN32 +#define TESS_CALL_BACK_TYPE void(CALLBACK *)() +#else +#define TESS_CALL_BACK_TYPE void(*)() +#endif + +static int init(InternaCtx *ctx, int width, int height) +{ +#ifdef WIN32 + if (!(ctx->glBlendEquation = (PFNGLBLENDEQUATIONPROC)wglGetProcAddress("glBlendEquation"))) { + return FALSE; + } +#endif + ctx->width = width; + ctx->height = height; + ctx->line_width = 1; + + glClearColor(0, 0, 0, 0); + glClearStencil(0); + + if (!(ctx->tesselator = gluNewTess())) { + return FALSE; + } + + glGenTextures(1, &ctx->private_tex); + glBindTexture(GL_TEXTURE_2D, ctx->private_tex); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexImage2D(GL_TEXTURE_2D, 0, 4, gl_get_to_power_two(width), + gl_get_to_power_two(height), 0, + GL_BGRA, GL_UNSIGNED_BYTE, NULL); + ctx->private_tex_width = gl_get_to_power_two(width); + ctx->private_tex_height = gl_get_to_power_two(height); + glBindTexture(GL_TEXTURE_2D, 0); + + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, width, 0, height, -1, 1); + + gluTessProperty(ctx->tesselator, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD); + gluTessCallback(ctx->tesselator, GLU_BEGIN, (TESS_CALL_BACK_TYPE)glBegin); + gluTessCallback(ctx->tesselator, GLU_VERTEX, (TESS_CALL_BACK_TYPE)glVertex3dv); + gluTessCallback(ctx->tesselator, GLU_END, (TESS_CALL_BACK_TYPE)glEnd); + gluTessCallback(ctx->tesselator, GLU_TESS_COMBINE_DATA, + (TESS_CALL_BACK_TYPE)tessellation_combine); + gluTessCallback(ctx->tesselator, GLU_TESS_ERROR, (TESS_CALL_BACK_TYPE)tessellation_error); + + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0, (GLfloat)height, 0); + + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &ctx->max_texture_size); + + glPixelStorei(GL_PACK_ALIGNMENT, 1); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); + glPixelTransferf(GL_ALPHA_BIAS, 0); +#ifdef WIN32 + ctx->glBlendEquation(GL_FUNC_ADD); +#else + glBlendEquation(GL_FUNC_ADD); +#endif + + glStencilMask(0xff); + glClear(GL_STENCIL_BUFFER_BIT); + + glClear(GL_COLOR_BUFFER_BIT); + + return TRUE; +} + +GLCCtx glc_create(int width, int height) +{ + InternaCtx *ctx; + + spice_static_assert(sizeof(PathPoint) == sizeof(Vertex)); + + ctx = spice_new0(InternaCtx, 1); + if (!init(ctx, width, height)) { + free(ctx); + return NULL; + } + return ctx; +} + +/* + * In glx video mode change the textures will be destroyed, therefore + * if we will try to glDeleteTextures() them we might get seagfault. + * (this why we use the textures_lost parameter) + */ +void glc_destroy(GLCCtx glc, int textures_lost) +{ + InternaCtx *ctx; + + if (!(ctx = (InternaCtx *)glc)) { + return; + } + + if (!textures_lost) { + unref_pat(ctx->pat); + ctx->pat = NULL; + if (ctx->private_tex) { + glDeleteTextures(1, &ctx->private_tex); + } + } + + free_tass_vertex_bufs(ctx); + free(ctx->line_dash.dashes); + free(ctx); + GLC_ERROR_TEST_FINISH; +} + +/* + todo: + 1. test double vs float in gl calls + 2. int vs flat raster position + 3. pixels stride vs bytes stride + 4. improve non power of two. + glGetString(GL_EXTENSIONS); + ARB_texture_non_power_of_two + ARB_texture_rectangle + GL_TEXTURE_RECTANGLE_ARB + 5. scale + 6. origin + 7. fonts + 8. support more image formats + 9. use GLCImage in mask ops? +*/ diff -Nru spice-gtk-0.9/spice-common/common/glc.h spice-gtk-0.12/spice-common/common/glc.h --- spice-gtk-0.9/spice-common/common/glc.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/glc.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,164 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _H_GL_CANVASE +#define _H_GL_CANVASE + +#include +#include + +SPICE_BEGIN_DECLS + +typedef void * GLCCtx; +typedef void * GLCPattern; +typedef void * GLCPath; + +typedef struct GLCRect { + double x; + double y; + double width; + double height; +} GLCRect; + +typedef struct GLCRecti { + int x; + int y; + int width; + int height; +} GLCRecti; + +typedef enum { + GLC_IMAGE_RGB32, + GLC_IMAGE_ARGB32, +} GLCImageFormat; + +typedef struct GLCPImage { + GLCImageFormat format; + int width; + int height; + int stride; + uint8_t *pixels; + uint32_t *pallet; +} GLCImage; + +GLCPattern glc_pattern_create(GLCCtx glc, int x_orign, int y_orign, const GLCImage *image); +void glc_pattern_set(GLCPattern pattern, int x_orign, int y_orign, const GLCImage *image); +void glc_pattern_destroy(GLCPattern pattern); + +void glc_path_move_to(GLCPath path, double x, double y); +void glc_path_line_to(GLCPath path, double x, double y); +void glc_path_curve_to(GLCPath path, double p1_x, double p1_y, double p2_x, double p2_y, + double p3_x, double p3_y); +void glc_path_rel_move_to(GLCPath path, double x, double y); +void glc_path_rel_line_to(GLCPath path, double x, double y); +void glc_path_rel_curve_to(GLCPath path, double p1_x, double p1_y, double p2_x, double p2_y, + double p3_x, double p3_y); +void glc_path_close(GLCPath path); + +void glc_path_cleare(GLCPath); +GLCPath glc_path_create(GLCCtx glc); +void glc_path_destroy(GLCPath path); + +void glc_set_rgb(GLCCtx glc, double red, double green, double blue); +void glc_set_rgba(GLCCtx glc, double red, double green, double blue, double alpha); +void glc_set_pattern(GLCCtx glc, GLCPattern pattern); + +typedef enum { + GLC_OP_CLEAR = 0x1500, + GLC_OP_SET = 0x150F, + GLC_OP_COPY = 0x1503, + GLC_OP_COPY_INVERTED = 0x150C, + GLC_OP_NOOP = 0x1505, + GLC_OP_INVERT = 0x150A, + GLC_OP_AND = 0x1501, + GLC_OP_NAND = 0x150E, + GLC_OP_OR = 0x1507, + GLC_OP_NOR = 0x1508, + GLC_OP_XOR = 0x1506, + GLC_OP_EQUIV = 0x1509, + GLC_OP_AND_REVERSE = 0x1502, + GLC_OP_AND_INVERTED = 0x1504, + GLC_OP_OR_REVERSE = 0x150B, + GLC_OP_OR_INVERTED = 0x150D, +} GLCOp; + +void glc_set_op(GLCCtx glc, GLCOp op); +void glc_set_alpha_factor(GLCCtx glc, double alpah); + +typedef enum { + GLC_FILL_MODE_WINDING_ODD, + GLC_FILL_MODE_WINDING_NONZERO, +} GLCFillMode; + +void glc_set_fill_mode(GLCCtx glc, GLCFillMode mode); +void glc_set_line_width(GLCCtx glc, double width); +void glc_set_line_end_cap(GLCCtx glc, int style); +void glc_set_line_join(GLCCtx glc, int style); +void glc_set_miter_limit(GLCCtx glc, int limit); +void glc_set_line_dash(GLCCtx glc, const double *dashes, int num_dashes, double offset); + +typedef enum { + GLC_MASK_A, + GLC_MASK_B, +} GLCMaskID; + +void glc_set_mask(GLCCtx glc, int x_dest, int y_dest, int width, int height, + int stride, const uint8_t *bitmap, GLCMaskID id); +void glc_mask_rects(GLCCtx glc, int num_rect, GLCRect *rects, GLCMaskID id); +void glc_clear_mask(GLCCtx glc, GLCMaskID id); + +typedef enum { + GLC_CLIP_OP_SET, + GLC_CLIP_OP_OR, + GLC_CLIP_OP_AND, + GLC_CLIP_OP_EXCLUDE, +} GLCClipOp; + +void glc_clip_rect(GLCCtx glc, const GLCRect *rect, GLCClipOp op); +void glc_clip_path(GLCCtx glc, GLCPath path, GLCClipOp op); +void glc_clip_mask(GLCCtx glc, int x_dest, int y_dest, int width, int height, int stride, + const uint8_t *bitmap, GLCClipOp op); +void glc_clip_reset(GLCCtx glc); + +void glc_fill_rect(GLCCtx glc, const GLCRect *rect); +void glc_fill_path(GLCCtx glc, GLCPath path); +void _glc_fill_mask(GLCCtx glc, int x_dest, int y_dest, int width, int height, int stride, + const uint8_t *bitmap); +void glc_fill_alpha(GLCCtx glc, int x_dest, int y_dest, int width, int height, int stride, + const uint8_t *alpha_mask); + +void glc_stroke_rect(GLCCtx glc, const GLCRect *rect); +void glc_stroke_path(GLCCtx glc, GLCPath path); + +void glc_draw_image(GLCCtx glc, const GLCRecti *dest, const GLCRecti *src, const GLCImage *image, + int scale_mode, double alpha); + +void glc_copy_pixels(GLCCtx glc, int x_dest, int y_dest, int x_src, int y_src, int width, + int height); +void glc_read_pixels(GLCCtx glc, int x, int y, GLCImage *image); + +void glc_flush(GLCCtx glc); +void glc_clear(GLCCtx glc); +GLCCtx glc_create(int width, int height); +void glc_destroy(GLCCtx glc, int textures_lost); + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/gl_utils.h spice-gtk-0.12/spice-common/common/gl_utils.h --- spice-gtk-0.9/spice-common/common/gl_utils.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/gl_utils.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,60 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef GL_UTILS_H +#define GL_UTILS_H + +#include +#include "spice_common.h" + +SPICE_BEGIN_DECLS + +#ifdef RED_DEBUG +#define GLC_ERROR_TEST_FLUSH { \ + GLenum gl_err; glFlush(); \ + if ((gl_err = glGetError()) != GL_NO_ERROR) { \ + printf("%s[%d]: opengl error: %s\n", __FUNCTION__, __LINE__, \ + gluErrorString(gl_err)); \ + spice_abort(); \ + } \ +} + +#define GLC_ERROR_TEST_FINISH { \ + GLenum gl_err; glFinish(); \ + if ((gl_err = glGetError()) != GL_NO_ERROR) { \ + printf("%s[%d]: opengl error: %s\n", __FUNCTION__, __LINE__, \ + gluErrorString(gl_err)); \ + spice_abort(); \ + } \ +} +#else +#define GLC_ERROR_TEST_FLUSH ; + +#define GLC_ERROR_TEST_FINISH ; +#endif + +#include "bitops.h" + +#define find_msb spice_bit_find_msb +#define gl_get_to_power_two spice_bit_next_pow2 + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/lines.c spice-gtk-0.12/spice-common/common/lines.c --- spice-gtk-0.9/spice-common/common/lines.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/lines.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,3613 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/*********************************************************** + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#ifdef _XOPEN_SOURCE +#include +#else +#define _XOPEN_SOURCE /* to get prototype for hypot on some systems */ +#include +#undef _XOPEN_SOURCE +#endif +#include "lines.h" +#include "mem.h" + +#define xalloc(i) spice_malloc(i) +#define xrealloc(a,b) spice_realloc(a,b) +#define xfree(i) free(i) + +typedef unsigned int CARD32; +typedef int Boolean; +typedef pixman_rectangle32_t xRectangle; +typedef SpicePoint DDXPointRec; +typedef DDXPointRec *DDXPointPtr; +typedef struct lineGC *GCPtr; + +/* largest positive value that can fit into a component of a point. + * Assumes that the point structure is {type x, y;} where type is + * a signed type. + */ +#define MAX_COORDINATE 2147483647 +#define MIN_COORDINATE -2147483647 + +#define miZeroLine spice_canvas_zero_line +#define miZeroDashLine spice_canvas_zero_dash_line +#define miWideDash spice_canvas_wide_dash_line +#define miWideLine spice_canvas_wide_line + +static INLINE int ICEIL (double x) +{ + int _cTmp = (int)x; + return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp + 1; +} + +typedef struct { + int count; /* number of spans */ + DDXPointPtr points; /* pointer to list of start points */ + int *widths; /* pointer to list of widths */ +} Spans; + +typedef struct { + int size; /* Total number of *Spans allocated */ + int count; /* Number of *Spans actually in group */ + Spans *group; /* List of Spans */ + int ymin, ymax; /* Min, max y values encountered */ +} SpanGroup; + +/* Initialize SpanGroup. MUST BE DONE before use. */ +static void miInitSpanGroup (SpanGroup * /*spanGroup */ + ); + +/* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */ +static void miAppendSpans (SpanGroup * /*spanGroup */ , + SpanGroup * /*otherGroup */ , + Spans * /*spans */ + ); + +/* Paint a span group, insuring that each pixel is painted at most once */ +static void miFillUniqueSpanGroup (GCPtr /*pGC */ , + SpanGroup * /*spanGroup */ , + Boolean /* foreground */ + ); + +/* Free up data in a span group. MUST BE DONE or you'll suffer memory leaks */ +static void miFreeSpanGroup (SpanGroup * /*spanGroup */ + ); + +/* Rops which must use span groups */ +#define miSpansCarefulRop(rop) (((rop) & 0xc) == 0x8 || ((rop) & 0x3) == 0x2) +#define miSpansEasyRop(rop) (!miSpansCarefulRop(rop)) + +/* + * Public definitions used for configuring basic pixelization aspects + * of the sample implementation line-drawing routines provided in + * {mfb,mi,cfb*} at run-time. + */ + +#define XDECREASING 4 +#define YDECREASING 2 +#define YMAJOR 1 + +#define OCTANT1 (1 << (YDECREASING)) +#define OCTANT2 (1 << (YDECREASING|YMAJOR)) +#define OCTANT3 (1 << (XDECREASING|YDECREASING|YMAJOR)) +#define OCTANT4 (1 << (XDECREASING|YDECREASING)) +#define OCTANT5 (1 << (XDECREASING)) +#define OCTANT6 (1 << (XDECREASING|YMAJOR)) +#define OCTANT7 (1 << (YMAJOR)) +#define OCTANT8 (1 << (0)) + +#define XMAJOROCTANTS (OCTANT1 | OCTANT4 | OCTANT5 | OCTANT8) + +#define DEFAULTZEROLINEBIAS (OCTANT2 | OCTANT3 | OCTANT4 | OCTANT5) + +/* + * Devices can configure the rendering of routines in mi, mfb, and cfb* + * by specifying a thin line bias to be applied to a particular screen + * using the following function. The bias parameter is an OR'ing of + * the appropriate OCTANT constants defined above to indicate which + * octants to bias a line to prefer an axial step when the Bresenham + * error term is exactly zero. The octants are mapped as follows: + * + * \ | / + * \ 3 | 2 / + * \ | / + * 4 \ | / 1 + * \|/ + * ----------- + * /|\ + * 5 / | \ 8 + * / | \ + * / 6 | 7 \ + * / | \ + * + * For more information, see "Ambiguities in Incremental Line Rastering," + * Jack E. Bresenham, IEEE CG&A, May 1987. + */ + +/* + * Private definitions needed for drawing thin (zero width) lines + * Used by the mi, mfb, and all cfb* components. + */ + +#define X_AXIS 0 +#define Y_AXIS 1 + +#define OUT_LEFT 0x08 +#define OUT_RIGHT 0x04 +#define OUT_ABOVE 0x02 +#define OUT_BELOW 0x01 + +#define OUTCODES(_result, _x, _y, _pbox) \ + if ( (_x) < (_pbox)->x1) (_result) |= OUT_LEFT; \ + else if ( (_x) >= (_pbox)->x2) (_result) |= OUT_RIGHT; \ + if ( (_y) < (_pbox)->y1) (_result) |= OUT_ABOVE; \ + else if ( (_y) >= (_pbox)->y2) (_result) |= OUT_BELOW; + +#define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \ +{\ + if (x < xmin) outcode |= OUT_LEFT;\ + if (x > xmax) outcode |= OUT_RIGHT;\ + if (y < ymin) outcode |= OUT_ABOVE;\ + if (y > ymax) outcode |= OUT_BELOW;\ +} + +#define SWAPINT(i, j) \ +{ int _t = i; i = j; j = _t; } + +#define SWAPPT(i, j) \ +{ DDXPointRec _t; _t = i; i = j; j = _t; } + +#define SWAPINT_PAIR(x1, y1, x2, y2)\ +{ int t = x1; x1 = x2; x2 = t;\ + t = y1; y1 = y2; y2 = t;\ +} + +#define miGetZeroLineBias(_pScreen) (DEFAULTZEROLINEBIAS) + +#define CalcLineDeltas(_x1,_y1,_x2,_y2,_adx,_ady,_sx,_sy,_SX,_SY,_octant) \ + (_octant) = 0; \ + (_sx) = (_SX); \ + if (((_adx) = (_x2) - (_x1)) < 0) { \ + (_adx) = -(_adx); \ + (_sx = -(_sx)); \ + (_octant) |= XDECREASING; \ + } \ + (_sy) = (_SY); \ + if (((_ady) = (_y2) - (_y1)) < 0) { \ + (_ady) = -(_ady); \ + (_sy = -(_sy)); \ + (_octant) |= YDECREASING; \ + } + +#define SetYMajorOctant(_octant) ((_octant) |= YMAJOR) + +#define FIXUP_ERROR(_e, _octant, _bias) \ + (_e) -= (((_bias) >> (_octant)) & 1) + +#define IsXMajorOctant(_octant) (!((_octant) & YMAJOR)) +#define IsYMajorOctant(_octant) ((_octant) & YMAJOR) +#define IsXDecreasingOctant(_octant) ((_octant) & XDECREASING) +#define IsYDecreasingOctant(_octant) ((_octant) & YDECREASING) + +static int miZeroClipLine (int /*xmin */ , + int /*ymin */ , + int /*xmax */ , + int /*ymax */ , + int * /*new_x1 */ , + int * /*new_y1 */ , + int * /*new_x2 */ , + int * /*new_y2 */ , + unsigned int /*adx */ , + unsigned int /*ady */ , + int * /*pt1_clipped */ , + int * /*pt2_clipped */ , + int /*octant */ , + unsigned int /*bias */ , + int /*oc1 */ , + int /*oc2 */ + ); + +/* + * interface data to span-merging polygon filler + */ + +typedef struct _SpanData { + SpanGroup fgGroup, bgGroup; +} SpanDataRec, *SpanDataPtr; + +#define AppendSpanGroup(pGC, foreground, spanPtr, spanData) { \ + SpanGroup *group, *othergroup = NULL; \ + if (foreground) \ + { \ + group = &spanData->fgGroup; \ + if (pGC->lineStyle == LineDoubleDash) \ + othergroup = &spanData->bgGroup; \ + } \ + else \ + { \ + group = &spanData->bgGroup; \ + othergroup = &spanData->fgGroup; \ + } \ + miAppendSpans (group, othergroup, spanPtr); \ +} + +/* + * Polygon edge description for integer wide-line routines + */ + +typedef struct _PolyEdge { + int height; /* number of scanlines to process */ + int x; /* starting x coordinate */ + int stepx; /* fixed integral dx */ + int signdx; /* variable dx sign */ + int e; /* initial error term */ + int dy; + int dx; +} PolyEdgeRec, *PolyEdgePtr; + +#define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - miter limit constant */ + +/* + * types for general polygon routines + */ + +typedef struct _PolyVertex { + double x, y; +} PolyVertexRec, *PolyVertexPtr; + +typedef struct _PolySlope { + int dx, dy; + double k; /* x0 * dy - y0 * dx */ +} PolySlopeRec, *PolySlopePtr; + +/* + * Line face description for caps/joins + */ + +typedef struct _LineFace { + double xa, ya; + int dx, dy; + int x, y; + double k; +} LineFaceRec, *LineFacePtr; + +/* + * macros for polygon fillers + */ + +#define MIPOLYRELOADLEFT if (!left_height && left_count) { \ + left_height = left->height; \ + left_x = left->x; \ + left_stepx = left->stepx; \ + left_signdx = left->signdx; \ + left_e = left->e; \ + left_dy = left->dy; \ + left_dx = left->dx; \ + --left_count; \ + ++left; \ + } + +#define MIPOLYRELOADRIGHT if (!right_height && right_count) { \ + right_height = right->height; \ + right_x = right->x; \ + right_stepx = right->stepx; \ + right_signdx = right->signdx; \ + right_e = right->e; \ + right_dy = right->dy; \ + right_dx = right->dx; \ + --right_count; \ + ++right; \ + } + +#define MIPOLYSTEPLEFT left_x += left_stepx; \ + left_e += left_dx; \ + if (left_e > 0) \ + { \ + left_x += left_signdx; \ + left_e -= left_dy; \ + } + +#define MIPOLYSTEPRIGHT right_x += right_stepx; \ + right_e += right_dx; \ + if (right_e > 0) \ + { \ + right_x += right_signdx; \ + right_e -= right_dy; \ + } + +static void miRoundJoinClip (LineFacePtr /*pLeft */ , + LineFacePtr /*pRight */ , + PolyEdgePtr /*edge1 */ , + PolyEdgePtr /*edge2 */ , + int * /*y1 */ , + int * /*y2 */ , + Boolean * /*left1 */ , + Boolean * /*left2 */ + ); + +static int miRoundCapClip (LineFacePtr /*face */ , + Boolean /*isInt */ , + PolyEdgePtr /*edge */ , + Boolean * /*leftEdge */ + ); + +static int miPolyBuildEdge (double x0, double y0, double k, int dx, int dy, + int xi, int yi, int left, PolyEdgePtr edge); +static int miPolyBuildPoly (PolyVertexPtr vertices, PolySlopePtr slopes, + int count, int xi, int yi, PolyEdgePtr left, + PolyEdgePtr right, int *pnleft, int *pnright, int *h); + + +static void +miStepDash (int dist, /* distance to step */ + int *pDashIndex, /* current dash */ + unsigned char *pDash, /* dash list */ + int numInDashList, /* total length of dash list */ + int *pDashOffset /* offset into current dash */ + ) +{ + int dashIndex, dashOffset; + int totallen; + int i; + + dashIndex = *pDashIndex; + dashOffset = *pDashOffset; + if (dist < pDash[dashIndex] - dashOffset) { + *pDashOffset = dashOffset + dist; + return; + } + dist -= pDash[dashIndex] - dashOffset; + if (++dashIndex == numInDashList) + dashIndex = 0; + totallen = 0; + for (i = 0; i < numInDashList; i++) + totallen += pDash[i]; + if (totallen <= dist) + dist = dist % totallen; + while (dist >= pDash[dashIndex]) { + dist -= pDash[dashIndex]; + if (++dashIndex == numInDashList) + dashIndex = 0; + } + *pDashIndex = dashIndex; + *pDashOffset = dist; +} + +/* + +These routines maintain lists of Spans, in order to implement the +``touch-each-pixel-once'' rules of wide lines and arcs. + +Written by Joel McCormack, Summer 1989. + +*/ + + +static void +miInitSpanGroup (SpanGroup * spanGroup) +{ + spanGroup->size = 0; + spanGroup->count = 0; + spanGroup->group = NULL; + spanGroup->ymin = MAX_COORDINATE; + spanGroup->ymax = MIN_COORDINATE; +} /* InitSpanGroup */ + +#define YMIN(spans) (spans->points[0].y) +#define YMAX(spans) (spans->points[spans->count-1].y) + +static void +miSubtractSpans (SpanGroup * spanGroup, Spans * sub) +{ + int i, subCount, spansCount; + int ymin, ymax, xmin, xmax; + Spans *spans; + DDXPointPtr subPt, spansPt; + int *subWid, *spansWid; + int extra; + + ymin = YMIN (sub); + ymax = YMAX (sub); + spans = spanGroup->group; + for (i = spanGroup->count; i; i--, spans++) { + if (YMIN (spans) <= ymax && ymin <= YMAX (spans)) { + subCount = sub->count; + subPt = sub->points; + subWid = sub->widths; + spansCount = spans->count; + spansPt = spans->points; + spansWid = spans->widths; + extra = 0; + for (;;) { + while (spansCount && spansPt->y < subPt->y) { + spansPt++; + spansWid++; + spansCount--; + } + if (!spansCount) + break; + while (subCount && subPt->y < spansPt->y) { + subPt++; + subWid++; + subCount--; + } + if (!subCount) + break; + if (subPt->y == spansPt->y) { + xmin = subPt->x; + xmax = xmin + *subWid; + if (xmin >= spansPt->x + *spansWid || spansPt->x >= xmax) { + ; + } else if (xmin <= spansPt->x) { + if (xmax >= spansPt->x + *spansWid) { + memmove (spansPt, spansPt + 1, sizeof *spansPt * (spansCount - 1)); + memmove (spansWid, spansWid + 1, sizeof *spansWid * (spansCount - 1)); + spansPt--; + spansWid--; + spans->count--; + extra++; + } else { + *spansWid = *spansWid - (xmax - spansPt->x); + spansPt->x = xmax; + } + } else { + if (xmax >= spansPt->x + *spansWid) { + *spansWid = xmin - spansPt->x; + } else { + if (!extra) { + DDXPointPtr newPt; + int *newwid; + +#define EXTRA 8 + newPt = xrealloc (spans->points, + (spans->count + + EXTRA) * sizeof (DDXPointRec)); + if (!newPt) + break; + spansPt = newPt + (spansPt - spans->points); + spans->points = newPt; + newwid = xrealloc (spans->widths, + (spans->count + EXTRA) * sizeof (int)); + if (!newwid) + break; + spansWid = newwid + (spansWid - spans->widths); + spans->widths = newwid; + extra = EXTRA; + } + memmove (spansPt + 1, spansPt, sizeof *spansPt * (spansCount)); + memmove (spansWid + 1, spansWid, sizeof *spansWid * (spansCount)); + spans->count++; + extra--; + *spansWid = xmin - spansPt->x; + spansWid++; + spansPt++; + *spansWid = *spansWid - (xmax - spansPt->x); + spansPt->x = xmax; + } + } + } + spansPt++; + spansWid++; + spansCount--; + } + } + } +} + +static void +miAppendSpans (SpanGroup * spanGroup, SpanGroup * otherGroup, Spans * spans) +{ + int ymin, ymax; + int spansCount; + + spansCount = spans->count; + if (spansCount > 0) { + if (spanGroup->size == spanGroup->count) { + spanGroup->size = (spanGroup->size + 8) * 2; + spanGroup->group = + xrealloc (spanGroup->group, sizeof (Spans) * spanGroup->size); + } + + spanGroup->group[spanGroup->count] = *spans; + (spanGroup->count)++; + ymin = spans->points[0].y; + if (ymin < spanGroup->ymin) + spanGroup->ymin = ymin; + ymax = spans->points[spansCount - 1].y; + if (ymax > spanGroup->ymax) + spanGroup->ymax = ymax; + if (otherGroup && otherGroup->ymin < ymax && ymin < otherGroup->ymax) { + miSubtractSpans (otherGroup, spans); + } + } else { + xfree (spans->points); + xfree (spans->widths); + } +} /* AppendSpans */ + +static void +miFreeSpanGroup (SpanGroup * spanGroup) +{ + xfree (spanGroup->group); +} + +static void +QuickSortSpansX (DDXPointRec points[], int widths[], int numSpans) +{ + int x; + int i, j, m; + DDXPointPtr r; + +/* Always called with numSpans > 1 */ +/* Sorts only by x, as all y should be the same */ + +#define ExchangeSpans(a, b) \ +{ \ + DDXPointRec tpt; \ + int tw; \ + \ + tpt = points[a]; points[a] = points[b]; points[b] = tpt; \ + tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \ +} + + do { + if (numSpans < 9) { + /* Do insertion sort */ + int xprev; + + xprev = points[0].x; + i = 1; + do { /* while i != numSpans */ + x = points[i].x; + if (xprev > x) { + /* points[i] is out of order. Move into proper location. */ + DDXPointRec tpt; + int tw, k; + + for (j = 0; x >= points[j].x; j++) { + } + tpt = points[i]; + tw = widths[i]; + for (k = i; k != j; k--) { + points[k] = points[k - 1]; + widths[k] = widths[k - 1]; + } + points[j] = tpt; + widths[j] = tw; + x = points[i].x; + } /* if out of order */ + xprev = x; + i++; + } while (i != numSpans); + return; + } + + /* Choose partition element, stick in location 0 */ + m = numSpans / 2; + if (points[m].x > points[0].x) + ExchangeSpans (m, 0); + if (points[m].x > points[numSpans - 1].x) + ExchangeSpans (m, numSpans - 1); + if (points[m].x > points[0].x) + ExchangeSpans (m, 0); + x = points[0].x; + + /* Partition array */ + i = 0; + j = numSpans; + do { + r = &(points[i]); + do { + r++; + i++; + } while (i != numSpans && r->x < x); + r = &(points[j]); + do { + r--; + j--; + } while (x < r->x); + if (i < j) + ExchangeSpans (i, j); + } while (i < j); + + /* Move partition element back to middle */ + ExchangeSpans (0, j); + + /* Recurse */ + if (numSpans - j - 1 > 1) + QuickSortSpansX (&points[j + 1], &widths[j + 1], numSpans - j - 1); + numSpans = j; + } while (numSpans > 1); +} /* QuickSortSpans */ + + +static int +UniquifySpansX (Spans * spans, DDXPointRec * newPoints, int *newWidths) +{ + int newx1, newx2, oldpt, i, y; + DDXPointRec *oldPoints; + int *oldWidths; + int *startNewWidths; + +/* Always called with numSpans > 1 */ +/* Uniquify the spans, and stash them into newPoints and newWidths. Return the + number of unique spans. */ + + + startNewWidths = newWidths; + + oldPoints = spans->points; + oldWidths = spans->widths; + + y = oldPoints->y; + newx1 = oldPoints->x; + newx2 = newx1 + *oldWidths; + + for (i = spans->count - 1; i != 0; i--) { + oldPoints++; + oldWidths++; + oldpt = oldPoints->x; + if (oldpt > newx2) { + /* Write current span, start a new one */ + newPoints->x = newx1; + newPoints->y = y; + *newWidths = newx2 - newx1; + newPoints++; + newWidths++; + newx1 = oldpt; + newx2 = oldpt + *oldWidths; + } else { + /* extend current span, if old extends beyond new */ + oldpt = oldpt + *oldWidths; + if (oldpt > newx2) + newx2 = oldpt; + } + } /* for */ + + /* Write final span */ + newPoints->x = newx1; + *newWidths = newx2 - newx1; + newPoints->y = y; + + return (newWidths - startNewWidths) + 1; +} /* UniquifySpansX */ + +static void +miDisposeSpanGroup (SpanGroup * spanGroup) +{ + int i; + Spans *spans; + + for (i = 0; i < spanGroup->count; i++) { + spans = spanGroup->group + i; + xfree (spans->points); + xfree (spans->widths); + } +} + +static void +miFillUniqueSpanGroup (GCPtr pGC, SpanGroup * spanGroup, Boolean foreground) +{ + int i; + Spans *spans; + Spans *yspans; + int *ysizes; + int ymin, ylength; + + /* Outgoing spans for one big call to FillSpans */ + DDXPointPtr points; + int *widths; + int count; + + if (spanGroup->count == 0) + return; + + if (spanGroup->count == 1) { + /* Already should be sorted, unique */ + spans = spanGroup->group; + (*pGC->ops->FillSpans) + (pGC, spans->count, spans->points, spans->widths, TRUE, foreground); + xfree (spans->points); + xfree (spans->widths); + } else { + /* Yuck. Gross. Radix sort into y buckets, then sort x and uniquify */ + /* This seems to be the fastest thing to do. I've tried sorting on + both x and y at the same time rather than creating into all those + y buckets, but it was somewhat slower. */ + + ymin = spanGroup->ymin; + ylength = spanGroup->ymax - ymin + 1; + + /* Allocate Spans for y buckets */ + yspans = (Spans*)xalloc (ylength * sizeof (Spans)); + ysizes = (int *)xalloc (ylength * sizeof (int)); + + if (!yspans || !ysizes) { + xfree (yspans); + xfree (ysizes); + miDisposeSpanGroup (spanGroup); + return; + } + + for (i = 0; i != ylength; i++) { + ysizes[i] = 0; + yspans[i].count = 0; + yspans[i].points = NULL; + yspans[i].widths = NULL; + } + + /* Go through every single span and put it into the correct bucket */ + count = 0; + for (i = 0, spans = spanGroup->group; i != spanGroup->count; i++, spans++) { + int index; + int j; + + for (j = 0, points = spans->points, widths = spans->widths; + j != spans->count; j++, points++, widths++) { + index = points->y - ymin; + if (index >= 0 && index < ylength) { + Spans *newspans = &(yspans[index]); + if (newspans->count == ysizes[index]) { + DDXPointPtr newpoints; + int *newwidths; + ysizes[index] = (ysizes[index] + 8) * 2; + newpoints = xrealloc (newspans->points, + ysizes[index] * sizeof (DDXPointRec)); + newwidths = xrealloc (newspans->widths, + ysizes[index] * sizeof (int)); + if (!newpoints || !newwidths) { + int i; + + for (i = 0; i < ylength; i++) { + xfree (yspans[i].points); + xfree (yspans[i].widths); + } + xfree (yspans); + xfree (ysizes); + miDisposeSpanGroup (spanGroup); + return; + } + newspans->points = newpoints; + newspans->widths = newwidths; + } + newspans->points[newspans->count] = *points; + newspans->widths[newspans->count] = *widths; + (newspans->count)++; + } /* if y value of span in range */ + } /* for j through spans */ + count += spans->count; + xfree (spans->points); + spans->points = NULL; + xfree (spans->widths); + spans->widths = NULL; + } /* for i thorough Spans */ + + /* Now sort by x and uniquify each bucket into the final array */ + points = (DDXPointRec*)xalloc (count * sizeof (DDXPointRec)); + widths = (int *)xalloc (count * sizeof (int)); + if (!points || !widths) { + int i; + + for (i = 0; i < ylength; i++) { + xfree (yspans[i].points); + xfree (yspans[i].widths); + } + xfree (yspans); + xfree (ysizes); + xfree (points); + xfree (widths); + return; + } + count = 0; + for (i = 0; i != ylength; i++) { + int ycount = yspans[i].count; + if (ycount > 0) { + if (ycount > 1) { + QuickSortSpansX (yspans[i].points, yspans[i].widths, ycount); + count += UniquifySpansX (&(yspans[i]), &(points[count]), &(widths[count])); + } else { + points[count] = yspans[i].points[0]; + widths[count] = yspans[i].widths[0]; + count++; + } + xfree (yspans[i].points); + xfree (yspans[i].widths); + } + } + + (*pGC->ops->FillSpans) (pGC, count, points, widths, TRUE, foreground); + xfree (points); + xfree (widths); + xfree (yspans); + xfree (ysizes); /* use (DE)xalloc for these? */ + } + + spanGroup->count = 0; + spanGroup->ymin = MAX_COORDINATE; + spanGroup->ymax = MIN_COORDINATE; +} + +/* + +The bresenham error equation used in the mi/mfb/cfb line routines is: + + e = error + dx = difference in raw X coordinates + dy = difference in raw Y coordinates + M = # of steps in X direction + N = # of steps in Y direction + B = 0 to prefer diagonal steps in a given octant, + 1 to prefer axial steps in a given octant + + For X major lines: + e = 2Mdy - 2Ndx - dx - B + -2dx <= e < 0 + + For Y major lines: + e = 2Ndx - 2Mdy - dy - B + -2dy <= e < 0 + +At the start of the line, we have taken 0 X steps and 0 Y steps, +so M = 0 and N = 0: + + X major e = 2Mdy - 2Ndx - dx - B + = -dx - B + + Y major e = 2Ndx - 2Mdy - dy - B + = -dy - B + +At the end of the line, we have taken dx X steps and dy Y steps, +so M = dx and N = dy: + + X major e = 2Mdy - 2Ndx - dx - B + = 2dxdy - 2dydx - dx - B + = -dx - B + Y major e = 2Ndx - 2Mdy - dy - B + = 2dydx - 2dxdy - dy - B + = -dy - B + +Thus, the error term is the same at the start and end of the line. + +Let us consider clipping an X coordinate. There are 4 cases which +represent the two independent cases of clipping the start vs. the +end of the line and an X major vs. a Y major line. In any of these +cases, we know the number of X steps (M) and we wish to find the +number of Y steps (N). Thus, we will solve our error term equation. +If we are clipping the start of the line, we will find the smallest +N that satisfies our error term inequality. If we are clipping the +end of the line, we will find the largest number of Y steps that +satisfies the inequality. In that case, since we are representing +the Y steps as (dy - N), we will actually want to solve for the +smallest N in that equation. + +Case 1: X major, starting X coordinate moved by M steps + + -2dx <= 2Mdy - 2Ndx - dx - B < 0 + 2Ndx <= 2Mdy - dx - B + 2dx 2Ndx > 2Mdy - dx - B + 2Ndx <= 2Mdy + dx - B N > (2Mdy - dx - B) / 2dx + N <= (2Mdy + dx - B) / 2dx + +Since we are trying to find the smallest N that satisfies these +equations, we should use the > inequality to find the smallest: + + N = floor((2Mdy - dx - B) / 2dx) + 1 + = floor((2Mdy - dx - B + 2dx) / 2dx) + = floor((2Mdy + dx - B) / 2dx) + +Case 1b: X major, ending X coordinate moved to M steps + +Same derivations as Case 1, but we want the largest N that satisfies +the equations, so we use the <= inequality: + + N = floor((2Mdy + dx - B) / 2dx) + +Case 2: X major, ending X coordinate moved by M steps + + -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0 + -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0 + -2dx <= 2Ndx - 2Mdy - dx - B < 0 + 2Ndx >= 2Mdy + dx + B - 2dx 2Ndx < 2Mdy + dx + B + 2Ndx >= 2Mdy - dx + B N < (2Mdy + dx + B) / 2dx + N >= (2Mdy - dx + B) / 2dx + +Since we are trying to find the highest number of Y steps that +satisfies these equations, we need to find the smallest N, so +we should use the >= inequality to find the smallest: + + N = ceiling((2Mdy - dx + B) / 2dx) + = floor((2Mdy - dx + B + 2dx - 1) / 2dx) + = floor((2Mdy + dx + B - 1) / 2dx) + +Case 2b: X major, starting X coordinate moved to M steps from end + +Same derivations as Case 2, but we want the smallest number of Y +steps, so we want the highest N, so we use the < inequality: + + N = ceiling((2Mdy + dx + B) / 2dx) - 1 + = floor((2Mdy + dx + B + 2dx - 1) / 2dx) - 1 + = floor((2Mdy + dx + B + 2dx - 1 - 2dx) / 2dx) + = floor((2Mdy + dx + B - 1) / 2dx) + +Case 3: Y major, starting X coordinate moved by M steps + + -2dy <= 2Ndx - 2Mdy - dy - B < 0 + 2Ndx >= 2Mdy + dy + B - 2dy 2Ndx < 2Mdy + dy + B + 2Ndx >= 2Mdy - dy + B N < (2Mdy + dy + B) / 2dx + N >= (2Mdy - dy + B) / 2dx + +Since we are trying to find the smallest N that satisfies these +equations, we should use the >= inequality to find the smallest: + + N = ceiling((2Mdy - dy + B) / 2dx) + = floor((2Mdy - dy + B + 2dx - 1) / 2dx) + = floor((2Mdy - dy + B - 1) / 2dx) + 1 + +Case 3b: Y major, ending X coordinate moved to M steps + +Same derivations as Case 3, but we want the largest N that satisfies +the equations, so we use the < inequality: + + N = ceiling((2Mdy + dy + B) / 2dx) - 1 + = floor((2Mdy + dy + B + 2dx - 1) / 2dx) - 1 + = floor((2Mdy + dy + B + 2dx - 1 - 2dx) / 2dx) + = floor((2Mdy + dy + B - 1) / 2dx) + +Case 4: Y major, ending X coordinate moved by M steps + + -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0 + -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0 + -2dy <= 2Mdy - 2Ndx - dy - B < 0 + 2Ndx <= 2Mdy - dy - B + 2dy 2Ndx > 2Mdy - dy - B + 2Ndx <= 2Mdy + dy - B N > (2Mdy - dy - B) / 2dx + N <= (2Mdy + dy - B) / 2dx + +Since we are trying to find the highest number of Y steps that +satisfies these equations, we need to find the smallest N, so +we should use the > inequality to find the smallest: + + N = floor((2Mdy - dy - B) / 2dx) + 1 + +Case 4b: Y major, starting X coordinate moved to M steps from end + +Same analysis as Case 4, but we want the smallest number of Y steps +which means the largest N, so we use the <= inequality: + + N = floor((2Mdy + dy - B) / 2dx) + +Now let's try the Y coordinates, we have the same 4 cases. + +Case 5: X major, starting Y coordinate moved by N steps + + -2dx <= 2Mdy - 2Ndx - dx - B < 0 + 2Mdy >= 2Ndx + dx + B - 2dx 2Mdy < 2Ndx + dx + B + 2Mdy >= 2Ndx - dx + B M < (2Ndx + dx + B) / 2dy + M >= (2Ndx - dx + B) / 2dy + +Since we are trying to find the smallest M, we use the >= inequality: + + M = ceiling((2Ndx - dx + B) / 2dy) + = floor((2Ndx - dx + B + 2dy - 1) / 2dy) + = floor((2Ndx - dx + B - 1) / 2dy) + 1 + +Case 5b: X major, ending Y coordinate moved to N steps + +Same derivations as Case 5, but we want the largest M that satisfies +the equations, so we use the < inequality: + + M = ceiling((2Ndx + dx + B) / 2dy) - 1 + = floor((2Ndx + dx + B + 2dy - 1) / 2dy) - 1 + = floor((2Ndx + dx + B + 2dy - 1 - 2dy) / 2dy) + = floor((2Ndx + dx + B - 1) / 2dy) + +Case 6: X major, ending Y coordinate moved by N steps + + -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0 + -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0 + -2dx <= 2Ndx - 2Mdy - dx - B < 0 + 2Mdy <= 2Ndx - dx - B + 2dx 2Mdy > 2Ndx - dx - B + 2Mdy <= 2Ndx + dx - B M > (2Ndx - dx - B) / 2dy + M <= (2Ndx + dx - B) / 2dy + +Largest # of X steps means smallest M, so use the > inequality: + + M = floor((2Ndx - dx - B) / 2dy) + 1 + +Case 6b: X major, starting Y coordinate moved to N steps from end + +Same derivations as Case 6, but we want the smallest # of X steps +which means the largest M, so use the <= inequality: + + M = floor((2Ndx + dx - B) / 2dy) + +Case 7: Y major, starting Y coordinate moved by N steps + + -2dy <= 2Ndx - 2Mdy - dy - B < 0 + 2Mdy <= 2Ndx - dy - B + 2dy 2Mdy > 2Ndx - dy - B + 2Mdy <= 2Ndx + dy - B M > (2Ndx - dy - B) / 2dy + M <= (2Ndx + dy - B) / 2dy + +To find the smallest M, use the > inequality: + + M = floor((2Ndx - dy - B) / 2dy) + 1 + = floor((2Ndx - dy - B + 2dy) / 2dy) + = floor((2Ndx + dy - B) / 2dy) + +Case 7b: Y major, ending Y coordinate moved to N steps + +Same derivations as Case 7, but we want the largest M that satisfies +the equations, so use the <= inequality: + + M = floor((2Ndx + dy - B) / 2dy) + +Case 8: Y major, ending Y coordinate moved by N steps + + -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0 + -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0 + -2dy <= 2Mdy - 2Ndx - dy - B < 0 + 2Mdy >= 2Ndx + dy + B - 2dy 2Mdy < 2Ndx + dy + B + 2Mdy >= 2Ndx - dy + B M < (2Ndx + dy + B) / 2dy + M >= (2Ndx - dy + B) / 2dy + +To find the highest X steps, find the smallest M, use the >= inequality: + + M = ceiling((2Ndx - dy + B) / 2dy) + = floor((2Ndx - dy + B + 2dy - 1) / 2dy) + = floor((2Ndx + dy + B - 1) / 2dy) + +Case 8b: Y major, starting Y coordinate moved to N steps from the end + +Same derivations as Case 8, but we want to find the smallest # of X +steps which means the largest M, so we use the < inequality: + + M = ceiling((2Ndx + dy + B) / 2dy) - 1 + = floor((2Ndx + dy + B + 2dy - 1) / 2dy) - 1 + = floor((2Ndx + dy + B + 2dy - 1 - 2dy) / 2dy) + = floor((2Ndx + dy + B - 1) / 2dy) + +So, our equations are: + + 1: X major move x1 to x1+M floor((2Mdy + dx - B) / 2dx) + 1b: X major move x2 to x1+M floor((2Mdy + dx - B) / 2dx) + 2: X major move x2 to x2-M floor((2Mdy + dx + B - 1) / 2dx) + 2b: X major move x1 to x2-M floor((2Mdy + dx + B - 1) / 2dx) + + 3: Y major move x1 to x1+M floor((2Mdy - dy + B - 1) / 2dx) + 1 + 3b: Y major move x2 to x1+M floor((2Mdy + dy + B - 1) / 2dx) + 4: Y major move x2 to x2-M floor((2Mdy - dy - B) / 2dx) + 1 + 4b: Y major move x1 to x2-M floor((2Mdy + dy - B) / 2dx) + + 5: X major move y1 to y1+N floor((2Ndx - dx + B - 1) / 2dy) + 1 + 5b: X major move y2 to y1+N floor((2Ndx + dx + B - 1) / 2dy) + 6: X major move y2 to y2-N floor((2Ndx - dx - B) / 2dy) + 1 + 6b: X major move y1 to y2-N floor((2Ndx + dx - B) / 2dy) + + 7: Y major move y1 to y1+N floor((2Ndx + dy - B) / 2dy) + 7b: Y major move y2 to y1+N floor((2Ndx + dy - B) / 2dy) + 8: Y major move y2 to y2-N floor((2Ndx + dy + B - 1) / 2dy) + 8b: Y major move y1 to y2-N floor((2Ndx + dy + B - 1) / 2dy) + +We have the following constraints on all of the above terms: + + 0 < M,N <= 2^15 2^15 can be imposed by miZeroClipLine + 0 <= dx/dy <= 2^16 - 1 + 0 <= B <= 1 + +The floor in all of the above equations can be accomplished with a +simple C divide operation provided that both numerator and denominator +are positive. + +Since dx,dy >= 0 and since moving an X coordinate implies that dx != 0 +and moving a Y coordinate implies dy != 0, we know that the denominators +are all > 0. + +For all lines, (-B) and (B-1) are both either 0 or -1, depending on the +bias. Thus, we have to show that the 2MNdxy +/- dxy terms are all >= 1 +or > 0 to prove that the numerators are positive (or zero). + +For X Major lines we know that dx > 0 and since 2Mdy is >= 0 due to the +constraints, the first four equations all have numerators >= 0. + +For the second four equations, M > 0, so 2Mdy >= 2dy so (2Mdy - dy) >= dy +So (2Mdy - dy) > 0, since they are Y major lines. Also, (2Mdy + dy) >= 3dy +or (2Mdy + dy) > 0. So all of their numerators are >= 0. + +For the third set of four equations, N > 0, so 2Ndx >= 2dx so (2Ndx - dx) +>= dx > 0. Similarly (2Ndx + dx) >= 3dx > 0. So all numerators >= 0. + +For the fourth set of equations, dy > 0 and 2Ndx >= 0, so all numerators +are > 0. + +To consider overflow, consider the case of 2 * M,N * dx,dy + dx,dy. This +is bounded <= 2 * 2^15 * (2^16 - 1) + (2^16 - 1) + <= 2^16 * (2^16 - 1) + (2^16 - 1) + <= 2^32 - 2^16 + 2^16 - 1 + <= 2^32 - 1 +Since the (-B) and (B-1) terms are all 0 or -1, the maximum value of +the numerator is therefore (2^32 - 1), which does not overflow an unsigned +32 bit variable. + +*/ + +/* Bit codes for the terms of the 16 clipping equations defined below. */ + +#define T_2NDX (1 << 0) +#define T_2MDY (0) /* implicit term */ +#define T_DXNOTY (1 << 1) +#define T_DYNOTX (0) /* implicit term */ +#define T_SUBDXORY (1 << 2) +#define T_ADDDX (T_DXNOTY) /* composite term */ +#define T_SUBDX (T_DXNOTY | T_SUBDXORY) /* composite term */ +#define T_ADDDY (T_DYNOTX) /* composite term */ +#define T_SUBDY (T_DYNOTX | T_SUBDXORY) /* composite term */ +#define T_BIASSUBONE (1 << 3) +#define T_SUBBIAS (0) /* implicit term */ +#define T_DIV2DX (1 << 4) +#define T_DIV2DY (0) /* implicit term */ +#define T_ADDONE (1 << 5) + +/* Bit masks defining the 16 equations used in miZeroClipLine. */ + +#define EQN1 (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX) +#define EQN1B (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX) +#define EQN2 (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX) +#define EQN2B (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX) + +#define EQN3 (T_2MDY | T_SUBDY | T_BIASSUBONE | T_DIV2DX | T_ADDONE) +#define EQN3B (T_2MDY | T_ADDDY | T_BIASSUBONE | T_DIV2DX) +#define EQN4 (T_2MDY | T_SUBDY | T_SUBBIAS | T_DIV2DX | T_ADDONE) +#define EQN4B (T_2MDY | T_ADDDY | T_SUBBIAS | T_DIV2DX) + +#define EQN5 (T_2NDX | T_SUBDX | T_BIASSUBONE | T_DIV2DY | T_ADDONE) +#define EQN5B (T_2NDX | T_ADDDX | T_BIASSUBONE | T_DIV2DY) +#define EQN6 (T_2NDX | T_SUBDX | T_SUBBIAS | T_DIV2DY | T_ADDONE) +#define EQN6B (T_2NDX | T_ADDDX | T_SUBBIAS | T_DIV2DY) + +#define EQN7 (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY) +#define EQN7B (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY) +#define EQN8 (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY) +#define EQN8B (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY) + +/* miZeroClipLine + * + * returns: 1 for partially clipped line + * -1 for completely clipped line + * + */ +static int +miZeroClipLine (int xmin, int ymin, int xmax, int ymax, + int *new_x1, int *new_y1, int *new_x2, int *new_y2, + unsigned int adx, unsigned int ady, + int *pt1_clipped, int *pt2_clipped, int octant, unsigned int bias, int oc1, int oc2) +{ + int swapped = 0; + int clipDone = 0; + CARD32 utmp = 0; + int clip1, clip2; + int x1, y1, x2, y2; + int x1_orig, y1_orig, x2_orig, y2_orig; + int xmajor; + int negslope = 0, anchorval = 0; + unsigned int eqn = 0; + + x1 = x1_orig = *new_x1; + y1 = y1_orig = *new_y1; + x2 = x2_orig = *new_x2; + y2 = y2_orig = *new_y2; + + clip1 = 0; + clip2 = 0; + + xmajor = IsXMajorOctant (octant); + bias = ((bias >> octant) & 1); + + while (1) { + if ((oc1 & oc2) != 0) { /* trivial reject */ + clipDone = -1; + clip1 = oc1; + clip2 = oc2; + break; + } else if ((oc1 | oc2) == 0) { /* trivial accept */ + clipDone = 1; + if (swapped) { + SWAPINT_PAIR (x1, y1, x2, y2); + SWAPINT (clip1, clip2); + } + break; + } else { /* have to clip */ + + /* only clip one point at a time */ + if (oc1 == 0) { + SWAPINT_PAIR (x1, y1, x2, y2); + SWAPINT_PAIR (x1_orig, y1_orig, x2_orig, y2_orig); + SWAPINT (oc1, oc2); + SWAPINT (clip1, clip2); + swapped = !swapped; + } + + clip1 |= oc1; + if (oc1 & OUT_LEFT) { + negslope = IsYDecreasingOctant (octant); + utmp = xmin - x1_orig; + if (utmp <= 32767) { /* clip based on near endpt */ + if (xmajor) + eqn = (swapped) ? EQN2 : EQN1; + else + eqn = (swapped) ? EQN4 : EQN3; + anchorval = y1_orig; + } else { /* clip based on far endpt */ + + utmp = x2_orig - xmin; + if (xmajor) + eqn = (swapped) ? EQN1B : EQN2B; + else + eqn = (swapped) ? EQN3B : EQN4B; + anchorval = y2_orig; + negslope = !negslope; + } + x1 = xmin; + } else if (oc1 & OUT_ABOVE) { + negslope = IsXDecreasingOctant (octant); + utmp = ymin - y1_orig; + if (utmp <= 32767) { /* clip based on near endpt */ + if (xmajor) + eqn = (swapped) ? EQN6 : EQN5; + else + eqn = (swapped) ? EQN8 : EQN7; + anchorval = x1_orig; + } else { /* clip based on far endpt */ + + utmp = y2_orig - ymin; + if (xmajor) + eqn = (swapped) ? EQN5B : EQN6B; + else + eqn = (swapped) ? EQN7B : EQN8B; + anchorval = x2_orig; + negslope = !negslope; + } + y1 = ymin; + } else if (oc1 & OUT_RIGHT) { + negslope = IsYDecreasingOctant (octant); + utmp = x1_orig - xmax; + if (utmp <= 32767) { /* clip based on near endpt */ + if (xmajor) + eqn = (swapped) ? EQN2 : EQN1; + else + eqn = (swapped) ? EQN4 : EQN3; + anchorval = y1_orig; + } else { /* clip based on far endpt */ + + /* + * Technically since the equations can handle + * utmp == 32768, this overflow code isn't + * needed since X11 protocol can't generate + * a line which goes more than 32768 pixels + * to the right of a clip rectangle. + */ + utmp = xmax - x2_orig; + if (xmajor) + eqn = (swapped) ? EQN1B : EQN2B; + else + eqn = (swapped) ? EQN3B : EQN4B; + anchorval = y2_orig; + negslope = !negslope; + } + x1 = xmax; + } else if (oc1 & OUT_BELOW) { + negslope = IsXDecreasingOctant (octant); + utmp = y1_orig - ymax; + if (utmp <= 32767) { /* clip based on near endpt */ + if (xmajor) + eqn = (swapped) ? EQN6 : EQN5; + else + eqn = (swapped) ? EQN8 : EQN7; + anchorval = x1_orig; + } else { /* clip based on far endpt */ + + /* + * Technically since the equations can handle + * utmp == 32768, this overflow code isn't + * needed since X11 protocol can't generate + * a line which goes more than 32768 pixels + * below the bottom of a clip rectangle. + */ + utmp = ymax - y2_orig; + if (xmajor) + eqn = (swapped) ? EQN5B : EQN6B; + else + eqn = (swapped) ? EQN7B : EQN8B; + anchorval = x2_orig; + negslope = !negslope; + } + y1 = ymax; + } + + if (swapped) + negslope = !negslope; + + utmp <<= 1; /* utmp = 2N or 2M */ + if (eqn & T_2NDX) + utmp = (utmp * adx); + else /* (eqn & T_2MDY) */ + utmp = (utmp * ady); + if (eqn & T_DXNOTY) + if (eqn & T_SUBDXORY) + utmp -= adx; + else + utmp += adx; + else /* (eqn & T_DYNOTX) */ if (eqn & T_SUBDXORY) + utmp -= ady; + else + utmp += ady; + if (eqn & T_BIASSUBONE) + utmp += bias - 1; + else /* (eqn & T_SUBBIAS) */ + utmp -= bias; + if (eqn & T_DIV2DX) + utmp /= (adx << 1); + else /* (eqn & T_DIV2DY) */ + utmp /= (ady << 1); + if (eqn & T_ADDONE) + utmp++; + + if (negslope) + utmp = (uint32_t)(-(int32_t)utmp); + + if (eqn & T_2NDX) /* We are calculating X steps */ + x1 = anchorval + utmp; + else /* else, Y steps */ + y1 = anchorval + utmp; + + oc1 = 0; + MIOUTCODES (oc1, x1, y1, xmin, ymin, xmax, ymax); + } + } + + *new_x1 = x1; + *new_y1 = y1; + *new_x2 = x2; + *new_y2 = y2; + + *pt1_clipped = clip1; + *pt2_clipped = clip2; + + return clipDone; +} + +/* Draw lineSolid, fillStyle-independent zero width lines. + * + * Must keep X and Y coordinates in "ints" at least until after they're + * translated and clipped to accomodate CoordModePrevious lines with very + * large coordinates. + * + * Draws the same pixels regardless of sign(dx) or sign(dy). + * + * Ken Whaley + * + */ + +#define MI_OUTPUT_POINT(xx, yy)\ +{\ + if ( !new_span && yy == current_y)\ + {\ + if (xx < spans->x)\ + spans->x = xx;\ + ++*widths;\ + }\ + else\ + {\ + ++Nspans;\ + ++spans;\ + ++widths;\ + spans->x = xx;\ + spans->y = yy;\ + *widths = 1;\ + current_y = yy;\ + new_span = FALSE;\ + }\ +} + +void +miZeroLine (GCPtr pGC, int mode, /* Origin or Previous */ + int npt, /* number of points */ + DDXPointPtr pptInit) +{ + int Nspans, current_y = 0; + DDXPointPtr ppt; + DDXPointPtr pspanInit, spans; + int *pwidthInit, *widths, list_len; + int xleft, ytop, xright, ybottom; + int new_x1, new_y1, new_x2, new_y2; + int x = 0, y = 0, x1, y1, x2, y2, xstart, ystart; + int oc1, oc2; + int result; + int pt1_clipped, pt2_clipped = 0; + Boolean new_span; + int signdx, signdy; + int clipdx, clipdy; + int width, height; + int adx, ady; + int octant; + unsigned int bias = miGetZeroLineBias (screen); + int e, e1, e2, e3; /* Bresenham error terms */ + int length; /* length of lines == # of pixels on major axis */ + + xleft = 0; + ytop = 0; + xright = pGC->width - 1; + ybottom = pGC->height - 1; + + /* it doesn't matter whether we're in drawable or screen coordinates, + * FillSpans simply cannot take starting coordinates outside of the + * range of a DDXPointRec component. + */ + if (xright > MAX_COORDINATE) + xright = MAX_COORDINATE; + if (ybottom > MAX_COORDINATE) + ybottom = MAX_COORDINATE; + + /* since we're clipping to the drawable's boundaries & coordinate + * space boundaries, we're guaranteed that the larger of width/height + * is the longest span we'll need to output + */ + width = xright - xleft + 1; + height = ybottom - ytop + 1; + list_len = (height >= width) ? height : width; + pspanInit = (DDXPointRec *)xalloc (list_len * sizeof (DDXPointRec)); + pwidthInit = (int *)xalloc (list_len * sizeof (int)); + if (!pspanInit || !pwidthInit) + goto out; + + Nspans = 0; + new_span = TRUE; + spans = pspanInit - 1; + widths = pwidthInit - 1; + ppt = pptInit; + + xstart = ppt->x; + ystart = ppt->y; + + /* x2, y2, oc2 copied to x1, y1, oc1 at top of loop to simplify + * iteration logic + */ + x2 = xstart; + y2 = ystart; + oc2 = 0; + MIOUTCODES (oc2, x2, y2, xleft, ytop, xright, ybottom); + + while (--npt > 0) { + if (Nspans > 0) + (*pGC->ops->FillSpans) (pGC, Nspans, pspanInit, pwidthInit, FALSE, TRUE); + Nspans = 0; + new_span = TRUE; + spans = pspanInit - 1; + widths = pwidthInit - 1; + + x1 = x2; + y1 = y2; + oc1 = oc2; + ++ppt; + + x2 = ppt->x; + y2 = ppt->y; + if (mode == CoordModePrevious) { + x2 += x1; + y2 += y1; + } + + oc2 = 0; + MIOUTCODES (oc2, x2, y2, xleft, ytop, xright, ybottom); + + CalcLineDeltas (x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); + + if (adx > ady) { + e1 = ady << 1; + e2 = e1 - (adx << 1); + e = e1 - adx; + length = adx; /* don't draw endpoint in main loop */ + + FIXUP_ERROR (e, octant, bias); + + new_x1 = x1; + new_y1 = y1; + new_x2 = x2; + new_y2 = y2; + pt1_clipped = 0; + pt2_clipped = 0; + + if ((oc1 | oc2) != 0) { + result = miZeroClipLine (xleft, ytop, xright, ybottom, + &new_x1, &new_y1, &new_x2, &new_y2, + adx, ady, + &pt1_clipped, &pt2_clipped, octant, bias, oc1, oc2); + if (result == -1) + continue; + + length = abs (new_x2 - new_x1); + + /* if we've clipped the endpoint, always draw the full length + * of the segment, because then the capstyle doesn't matter + */ + if (pt2_clipped) + length++; + + if (pt1_clipped) { + /* must calculate new error terms */ + clipdx = abs (new_x1 - x1); + clipdy = abs (new_y1 - y1); + e += (clipdy * e2) + ((clipdx - clipdy) * e1); + } + } + + /* draw the segment */ + + x = new_x1; + y = new_y1; + + e3 = e2 - e1; + e = e - e1; + + while (length--) { + MI_OUTPUT_POINT (x, y); + e += e1; + if (e >= 0) { + y += signdy; + e += e3; + } + x += signdx; + } + } else { /* Y major line */ + + e1 = adx << 1; + e2 = e1 - (ady << 1); + e = e1 - ady; + length = ady; /* don't draw endpoint in main loop */ + + SetYMajorOctant (octant); + FIXUP_ERROR (e, octant, bias); + + new_x1 = x1; + new_y1 = y1; + new_x2 = x2; + new_y2 = y2; + pt1_clipped = 0; + pt2_clipped = 0; + + if ((oc1 | oc2) != 0) { + result = miZeroClipLine (xleft, ytop, xright, ybottom, + &new_x1, &new_y1, &new_x2, &new_y2, + adx, ady, + &pt1_clipped, &pt2_clipped, octant, bias, oc1, oc2); + if (result == -1) + continue; + + length = abs (new_y2 - new_y1); + + /* if we've clipped the endpoint, always draw the full length + * of the segment, because then the capstyle doesn't matter + */ + if (pt2_clipped) + length++; + + if (pt1_clipped) { + /* must calculate new error terms */ + clipdx = abs (new_x1 - x1); + clipdy = abs (new_y1 - y1); + e += (clipdx * e2) + ((clipdy - clipdx) * e1); + } + } + + /* draw the segment */ + + x = new_x1; + y = new_y1; + + e3 = e2 - e1; + e = e - e1; + + while (length--) { + MI_OUTPUT_POINT (x, y); + e += e1; + if (e >= 0) { + x += signdx; + e += e3; + } + y += signdy; + } + } + } + + /* only do the capnotlast check on the last segment + * and only if the endpoint wasn't clipped. And then, if the last + * point is the same as the first point, do not draw it, unless the + * line is degenerate + */ + if ((!pt2_clipped) && (pGC->capStyle != CapNotLast) && + (((xstart != x2) || (ystart != y2)) || (ppt == pptInit + 1))) { + MI_OUTPUT_POINT (x, y); + } + + if (Nspans > 0) + (*pGC->ops->FillSpans) (pGC, Nspans, pspanInit, pwidthInit, FALSE, TRUE); + +out: + xfree (pwidthInit); + xfree (pspanInit); +} + +void +miZeroDashLine (GCPtr pgc, int mode, int nptInit, /* number of points in polyline */ + DDXPointRec * pptInit /* points in the polyline */ + ) +{ + /* XXX kludge until real zero-width dash code is written */ + pgc->lineWidth = 1; + miWideDash (pgc, mode, nptInit, pptInit); + pgc->lineWidth = 0; +} + +static void miLineArc (GCPtr pGC, + Boolean foreground, SpanDataPtr spanData, + LineFacePtr leftFace, + LineFacePtr rightFace, double xorg, double yorg, Boolean isInt); + + +/* + * spans-based polygon filler + */ + +static void +miFillPolyHelper (GCPtr pGC, Boolean foreground, + SpanDataPtr spanData, int y, int overall_height, + PolyEdgePtr left, PolyEdgePtr right, int left_count, int right_count) +{ + int left_x = 0, left_e = 0; + int left_stepx = 0; + int left_signdx = 0; + int left_dy = 0, left_dx = 0; + + int right_x = 0, right_e = 0; + int right_stepx = 0; + int right_signdx = 0; + int right_dy = 0, right_dx = 0; + + int height = 0; + int left_height = 0, right_height = 0; + + DDXPointPtr ppt; + DDXPointPtr pptInit = NULL; + int *pwidth; + int *pwidthInit = NULL; + int xorg; + Spans spanRec; + + left_height = 0; + right_height = 0; + + if (!spanData) { + pptInit = (DDXPointRec *)xalloc (overall_height * sizeof (*ppt)); + if (!pptInit) + return; + pwidthInit = (int *)xalloc (overall_height * sizeof (*pwidth)); + if (!pwidthInit) { + xfree (pptInit); + return; + } + ppt = pptInit; + pwidth = pwidthInit; + } else { + spanRec.points = (DDXPointRec *)xalloc (overall_height * sizeof (*ppt)); + if (!spanRec.points) + return; + spanRec.widths = (int *)xalloc (overall_height * sizeof (int)); + if (!spanRec.widths) { + xfree (spanRec.points); + return; + } + ppt = spanRec.points; + pwidth = spanRec.widths; + } + + xorg = 0; + while ((left_count || left_height) && (right_count || right_height)) { + MIPOLYRELOADLEFT MIPOLYRELOADRIGHT height = left_height; + if (height > right_height) + height = right_height; + + left_height -= height; + right_height -= height; + + while (--height >= 0) { + if (right_x >= left_x) { + ppt->y = y; + ppt->x = left_x + xorg; + ppt++; + *pwidth++ = right_x - left_x + 1; + } + y++; + + MIPOLYSTEPLEFT MIPOLYSTEPRIGHT} + } + if (!spanData) { + (*pGC->ops->FillSpans) (pGC, ppt - pptInit, pptInit, pwidthInit, TRUE, foreground); + xfree (pwidthInit); + xfree (pptInit); + } else { + spanRec.count = ppt - spanRec.points; + AppendSpanGroup (pGC, foreground, &spanRec, spanData) + } +} + +static void +miFillRectPolyHelper (GCPtr pGC, Boolean foreground, SpanDataPtr spanData, int x, int y, int w, int h) +{ + DDXPointPtr ppt; + int *pwidth; + Spans spanRec; + xRectangle rect; + + if (!spanData) { + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + (*pGC->ops->FillRects) (pGC, 1, &rect, foreground); + } else { + spanRec.points = (DDXPointRec *)xalloc (h * sizeof (*ppt)); + if (!spanRec.points) + return; + spanRec.widths = (int *)xalloc (h * sizeof (int)); + if (!spanRec.widths) { + xfree (spanRec.points); + return; + } + ppt = spanRec.points; + pwidth = spanRec.widths; + + while (h--) { + ppt->x = x; + ppt->y = y; + ppt++; + *pwidth++ = w; + y++; + } + spanRec.count = ppt - spanRec.points; + AppendSpanGroup (pGC, foreground, &spanRec, spanData) + } +} + +static int +miPolyBuildEdge (double x0, double y0, double k, /* x0 * dy - y0 * dx */ + int dx, int dy, int xi, int yi, int left, PolyEdgePtr edge) +{ + int x, y, e; + int xady; + + if (dy < 0) { + dy = -dy; + dx = -dx; + k = -k; + } +#ifdef NOTDEF + { + double realk, kerror; + realk = x0 * dy - y0 * dx; + kerror = Fabs (realk - k); + if (kerror > .1) + printf ("realk: %g k: %g\n", realk, k); + } +#endif + y = ICEIL (y0); + xady = ICEIL (k) + y * dx; + + if (xady <= 0) + x = -(-xady / dy) - 1; + else + x = (xady - 1) / dy; + + e = xady - x * dy; + + if (dx >= 0) { + edge->signdx = 1; + edge->stepx = dx / dy; + edge->dx = dx % dy; + } else { + edge->signdx = -1; + edge->stepx = -(-dx / dy); + edge->dx = -dx % dy; + e = dy - e + 1; + } + edge->dy = dy; + edge->x = x + left + xi; + edge->e = e - dy; /* bias to compare against 0 instead of dy */ + return y + yi; +} + +#define StepAround(v, incr, max) (((v) + (incr) < 0) ? (max - 1) : ((v) + (incr) == max) ? 0 : ((v) + (incr))) + +static int +miPolyBuildPoly (PolyVertexPtr vertices, + PolySlopePtr slopes, + int count, + int xi, + int yi, PolyEdgePtr left, PolyEdgePtr right, int *pnleft, int *pnright, int *h) +{ + int top, bottom; + double miny, maxy; + int i; + int j; + int clockwise; + int slopeoff; + int s; + int nright, nleft; + int y, lasty = 0, bottomy, topy = 0; + + /* find the top of the polygon */ + maxy = miny = vertices[0].y; + bottom = top = 0; + for (i = 1; i < count; i++) { + if (vertices[i].y < miny) { + top = i; + miny = vertices[i].y; + } + if (vertices[i].y >= maxy) { + bottom = i; + maxy = vertices[i].y; + } + } + clockwise = 1; + slopeoff = 0; + + i = top; + j = StepAround (top, -1, count); + + if (slopes[j].dy * slopes[i].dx > slopes[i].dy * slopes[j].dx) { + clockwise = -1; + slopeoff = -1; + } + + bottomy = ICEIL (maxy) + yi; + + nright = 0; + + s = StepAround (top, slopeoff, count); + i = top; + while (i != bottom) { + if (slopes[s].dy != 0) { + y = miPolyBuildEdge (vertices[i].x, vertices[i].y, + slopes[s].k, + slopes[s].dx, slopes[s].dy, xi, yi, 0, &right[nright]); + if (nright != 0) + right[nright - 1].height = y - lasty; + else + topy = y; + nright++; + lasty = y; + } + + i = StepAround (i, clockwise, count); + s = StepAround (s, clockwise, count); + } + if (nright != 0) + right[nright - 1].height = bottomy - lasty; + + if (slopeoff == 0) + slopeoff = -1; + else + slopeoff = 0; + + nleft = 0; + s = StepAround (top, slopeoff, count); + i = top; + while (i != bottom) { + if (slopes[s].dy != 0) { + y = miPolyBuildEdge (vertices[i].x, vertices[i].y, + slopes[s].k, slopes[s].dx, slopes[s].dy, xi, yi, 1, &left[nleft]); + + if (nleft != 0) + left[nleft - 1].height = y - lasty; + nleft++; + lasty = y; + } + i = StepAround (i, -clockwise, count); + s = StepAround (s, -clockwise, count); + } + if (nleft != 0) + left[nleft - 1].height = bottomy - lasty; + *pnleft = nleft; + *pnright = nright; + *h = bottomy - topy; + return topy; +} + +static void +miLineOnePoint (GCPtr pGC, Boolean foreground, SpanDataPtr spanData, int x, int y) +{ + DDXPointRec pt; + int wid; + + wid = 1; + pt.x = x; + pt.y = y; + (*pGC->ops->FillSpans) (pGC, 1, &pt, &wid, TRUE, foreground); +} + +static void +miLineJoin (GCPtr pGC, Boolean foreground, SpanDataPtr spanData, LineFacePtr pLeft, LineFacePtr pRight) +{ + double mx = 0, my = 0; + double denom = 0.0; + PolyVertexRec vertices[4]; + PolySlopeRec slopes[4]; + int edgecount; + PolyEdgeRec left[4], right[4]; + int nleft, nright; + int y, height; + int swapslopes; + int joinStyle = pGC->joinStyle; + int lw = pGC->lineWidth; + + if (lw == 1 && !spanData) { + /* See if one of the lines will draw the joining pixel */ + if (pLeft->dx > 0 || (pLeft->dx == 0 && pLeft->dy > 0)) + return; + if (pRight->dx > 0 || (pRight->dx == 0 && pRight->dy > 0)) + return; + if (joinStyle != JoinRound) { + denom = -pLeft->dx * (double) pRight->dy + pRight->dx * (double) pLeft->dy; + if (denom == 0) + return; /* no join to draw */ + } + if (joinStyle != JoinMiter) { + miLineOnePoint (pGC, foreground, spanData, pLeft->x, pLeft->y); + return; + } + } else { + if (joinStyle == JoinRound) { + miLineArc (pGC, foreground, spanData, pLeft, pRight, (double) 0.0, (double) 0.0, TRUE); + return; + } + denom = -pLeft->dx * (double) pRight->dy + pRight->dx * (double) pLeft->dy; + if (denom == 0.0) + return; /* no join to draw */ + } + + swapslopes = 0; + if (denom > 0) { + pLeft->xa = -pLeft->xa; + pLeft->ya = -pLeft->ya; + pLeft->dx = -pLeft->dx; + pLeft->dy = -pLeft->dy; + } else { + swapslopes = 1; + pRight->xa = -pRight->xa; + pRight->ya = -pRight->ya; + pRight->dx = -pRight->dx; + pRight->dy = -pRight->dy; + } + + vertices[0].x = pRight->xa; + vertices[0].y = pRight->ya; + slopes[0].dx = -pRight->dy; + slopes[0].dy = pRight->dx; + slopes[0].k = 0; + + vertices[1].x = 0; + vertices[1].y = 0; + slopes[1].dx = pLeft->dy; + slopes[1].dy = -pLeft->dx; + slopes[1].k = 0; + + vertices[2].x = pLeft->xa; + vertices[2].y = pLeft->ya; + + if (joinStyle == JoinMiter) { + my = (pLeft->dy * (pRight->xa * pRight->dy - pRight->ya * pRight->dx) - + pRight->dy * (pLeft->xa * pLeft->dy - pLeft->ya * pLeft->dx)) / denom; + if (pLeft->dy != 0) { + mx = pLeft->xa + (my - pLeft->ya) * (double) pLeft->dx / (double) pLeft->dy; + } else { + mx = pRight->xa + (my - pRight->ya) * (double) pRight->dx / (double) pRight->dy; + } + /* check miter limit */ + if ((mx * mx + my * my) * 4 > SQSECANT * lw * lw) + joinStyle = JoinBevel; + } + + if (joinStyle == JoinMiter) { + slopes[2].dx = pLeft->dx; + slopes[2].dy = pLeft->dy; + slopes[2].k = pLeft->k; + if (swapslopes) { + slopes[2].dx = -slopes[2].dx; + slopes[2].dy = -slopes[2].dy; + slopes[2].k = -slopes[2].k; + } + vertices[3].x = mx; + vertices[3].y = my; + slopes[3].dx = pRight->dx; + slopes[3].dy = pRight->dy; + slopes[3].k = pRight->k; + if (swapslopes) { + slopes[3].dx = -slopes[3].dx; + slopes[3].dy = -slopes[3].dy; + slopes[3].k = -slopes[3].k; + } + edgecount = 4; + } else { + double scale, dx, dy, adx, ady; + + adx = dx = pRight->xa - pLeft->xa; + ady = dy = pRight->ya - pLeft->ya; + if (adx < 0) + adx = -adx; + if (ady < 0) + ady = -ady; + scale = ady; + if (adx > ady) + scale = adx; + slopes[2].dx = (int) ((dx * 65536) / scale); + slopes[2].dy = (int) ((dy * 65536) / scale); + slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy - + (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0; + edgecount = 3; + } + + y = miPolyBuildPoly (vertices, slopes, edgecount, pLeft->x, pLeft->y, + left, right, &nleft, &nright, &height); + miFillPolyHelper (pGC, foreground, spanData, y, height, left, right, nleft, nright); +} + +static int +miLineArcI (GCPtr pGC, int xorg, int yorg, DDXPointPtr points, int *widths) +{ + DDXPointPtr tpts, bpts; + int *twids, *bwids; + int x, y, e, ex, slw; + + tpts = points; + twids = widths; + slw = pGC->lineWidth; + if (slw == 1) { + tpts->x = xorg; + tpts->y = yorg; + *twids = 1; + return 1; + } + bpts = tpts + slw; + bwids = twids + slw; + y = (slw >> 1) + 1; + if (slw & 1) + e = -((y << 2) + 3); + else + e = -(y << 3); + ex = -4; + x = 0; + while (y) { + e += (y << 3) - 4; + while (e >= 0) { + x++; + e += (ex = -((x << 3) + 4)); + } + y--; + slw = (x << 1) + 1; + if ((e == ex) && (slw > 1)) + slw--; + tpts->x = xorg - x; + tpts->y = yorg - y; + tpts++; + *twids++ = slw; + if ((y != 0) && ((slw > 1) || (e != ex))) { + bpts--; + bpts->x = xorg - x; + bpts->y = yorg + y; + *--bwids = slw; + } + } + return (pGC->lineWidth); +} + +#define CLIPSTEPEDGE(edgey,edge,edgeleft) \ + if (ybase == edgey) \ + { \ + if (edgeleft) \ + { \ + if (edge->x > xcl) \ + xcl = edge->x; \ + } \ + else \ + { \ + if (edge->x < xcr) \ + xcr = edge->x; \ + } \ + edgey++; \ + edge->x += edge->stepx; \ + edge->e += edge->dx; \ + if (edge->e > 0) \ + { \ + edge->x += edge->signdx; \ + edge->e -= edge->dy; \ + } \ + } + +static int +miLineArcD (GCPtr pGC, + double xorg, + double yorg, + DDXPointPtr points, + int *widths, + PolyEdgePtr edge1, + int edgey1, Boolean edgeleft1, PolyEdgePtr edge2, int edgey2, Boolean edgeleft2) +{ + DDXPointPtr pts; + int *wids; + double radius, x0, y0, el, er, yk, xlk, xrk, k; + int xbase, ybase, y, boty, xl, xr, xcl, xcr; + int ymin, ymax; + Boolean edge1IsMin, edge2IsMin; + int ymin1, ymin2; + + pts = points; + wids = widths; + xbase = (int)floor (xorg); + x0 = xorg - xbase; + ybase = ICEIL (yorg); + y0 = yorg - ybase; + xlk = x0 + x0 + 1.0; + xrk = x0 + x0 - 1.0; + yk = y0 + y0 - 1.0; + radius = ((double) pGC->lineWidth) / 2.0; + y = (int)floor (radius - y0 + 1.0); + ybase -= y; + ymin = ybase; + ymax = 65536; + edge1IsMin = FALSE; + ymin1 = edgey1; + if (edge1->dy >= 0) { + if (!edge1->dy) { + if (edgeleft1) + edge1IsMin = TRUE; + else + ymax = edgey1; + edgey1 = 65536; + } else { + if ((edge1->signdx < 0) == edgeleft1) + edge1IsMin = TRUE; + } + } + edge2IsMin = FALSE; + ymin2 = edgey2; + if (edge2->dy >= 0) { + if (!edge2->dy) { + if (edgeleft2) + edge2IsMin = TRUE; + else + ymax = edgey2; + edgey2 = 65536; + } else { + if ((edge2->signdx < 0) == edgeleft2) + edge2IsMin = TRUE; + } + } + if (edge1IsMin) { + ymin = ymin1; + if (edge2IsMin && ymin1 > ymin2) + ymin = ymin2; + } else if (edge2IsMin) + ymin = ymin2; + el = radius * radius - ((y + y0) * (y + y0)) - (x0 * x0); + er = el + xrk; + xl = 1; + xr = 0; + if (x0 < 0.5) { + xl = 0; + el -= xlk; + } + boty = (y0 < -0.5) ? 1 : 0; + if (ybase + y - boty > ymax) + boty = ymax - ybase - y; + while (y > boty) { + k = (y << 1) + yk; + er += k; + while (er > 0.0) { + xr++; + er += xrk - (xr << 1); + } + el += k; + while (el >= 0.0) { + xl--; + el += (xl << 1) - xlk; + } + y--; + ybase++; + if (ybase < ymin) + continue; + xcl = xl + xbase; + xcr = xr + xbase; + CLIPSTEPEDGE (edgey1, edge1, edgeleft1); + CLIPSTEPEDGE (edgey2, edge2, edgeleft2); + if (xcr >= xcl) { + pts->x = xcl; + pts->y = ybase; + pts++; + *wids++ = xcr - xcl + 1; + } + } + er = xrk - (xr << 1) - er; + el = (xl << 1) - xlk - el; + boty = (int)floor (-y0 - radius + 1.0); + if (ybase + y - boty > ymax) + boty = ymax - ybase - y; + while (y > boty) { + k = (y << 1) + yk; + er -= k; + while ((er >= 0.0) && (xr >= 0)) { + xr--; + er += xrk - (xr << 1); + } + el -= k; + while ((el > 0.0) && (xl <= 0)) { + xl++; + el += (xl << 1) - xlk; + } + y--; + ybase++; + if (ybase < ymin) + continue; + xcl = xl + xbase; + xcr = xr + xbase; + CLIPSTEPEDGE (edgey1, edge1, edgeleft1); + CLIPSTEPEDGE (edgey2, edge2, edgeleft2); + if (xcr >= xcl) { + pts->x = xcl; + pts->y = ybase; + pts++; + *wids++ = xcr - xcl + 1; + } + } + return (pts - points); +} + +static int +miRoundJoinFace (LineFacePtr face, PolyEdgePtr edge, Boolean * leftEdge) +{ + int y; + int dx, dy; + double xa, ya; + Boolean left; + + dx = -face->dy; + dy = face->dx; + xa = face->xa; + ya = face->ya; + left = 1; + if (ya > 0) { + ya = 0.0; + xa = 0.0; + } + if (dy < 0 || (dy == 0 && dx > 0)) { + dx = -dx; + dy = -dy; + left = !left; + } + if (dx == 0 && dy == 0) + dy = 1; + if (dy == 0) { + y = ICEIL (face->ya) + face->y; + edge->x = -32767; + edge->stepx = 0; + edge->signdx = 0; + edge->e = -1; + edge->dy = 0; + edge->dx = 0; + edge->height = 0; + } else { + y = miPolyBuildEdge (xa, ya, 0.0, dx, dy, face->x, face->y, !left, edge); + edge->height = 32767; + } + *leftEdge = !left; + return y; +} + +static void +miRoundJoinClip (LineFacePtr pLeft, LineFacePtr pRight, + PolyEdgePtr edge1, PolyEdgePtr edge2, int *y1, int *y2, Boolean * left1, Boolean * left2) +{ + double denom; + + denom = -pLeft->dx * (double) pRight->dy + pRight->dx * (double) pLeft->dy; + + if (denom >= 0) { + pLeft->xa = -pLeft->xa; + pLeft->ya = -pLeft->ya; + } else { + pRight->xa = -pRight->xa; + pRight->ya = -pRight->ya; + } + *y1 = miRoundJoinFace (pLeft, edge1, left1); + *y2 = miRoundJoinFace (pRight, edge2, left2); +} + +static int +miRoundCapClip (LineFacePtr face, Boolean isInt, PolyEdgePtr edge, Boolean * leftEdge) +{ + int y; + int dx, dy; + double xa, ya, k; + Boolean left; + + dx = -face->dy; + dy = face->dx; + xa = face->xa; + ya = face->ya; + k = 0.0; + if (!isInt) + k = face->k; + left = 1; + if (dy < 0 || (dy == 0 && dx > 0)) { + dx = -dx; + dy = -dy; + xa = -xa; + ya = -ya; + left = !left; + } + if (dx == 0 && dy == 0) + dy = 1; + if (dy == 0) { + y = ICEIL (face->ya) + face->y; + edge->x = -32767; + edge->stepx = 0; + edge->signdx = 0; + edge->e = -1; + edge->dy = 0; + edge->dx = 0; + edge->height = 0; + } else { + y = miPolyBuildEdge (xa, ya, k, dx, dy, face->x, face->y, !left, edge); + edge->height = 32767; + } + *leftEdge = !left; + return y; +} + +static void +miLineArc (GCPtr pGC, + Boolean foreground, + SpanDataPtr spanData, + LineFacePtr leftFace, LineFacePtr rightFace, double xorg, double yorg, Boolean isInt) +{ + DDXPointPtr points; + int *widths; + int xorgi = 0, yorgi = 0; + Spans spanRec; + int n; + PolyEdgeRec edge1, edge2; + int edgey1, edgey2; + Boolean edgeleft1, edgeleft2; + + if (isInt) { + xorgi = leftFace ? leftFace->x : rightFace->x; + yorgi = leftFace ? leftFace->y : rightFace->y; + } + edgey1 = 65536; + edgey2 = 65536; + edge1.x = 0; /* not used, keep memory checkers happy */ + edge1.dy = -1; + edge2.x = 0; /* not used, keep memory checkers happy */ + edge2.dy = -1; + edgeleft1 = FALSE; + edgeleft2 = FALSE; + if ((pGC->lineStyle != LineSolid || pGC->lineWidth > 2) && + ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) || + (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt))) { + if (isInt) { + xorg = (double) xorgi; + yorg = (double) yorgi; + } + if (leftFace && rightFace) { + miRoundJoinClip (leftFace, rightFace, &edge1, &edge2, + &edgey1, &edgey2, &edgeleft1, &edgeleft2); + } else if (leftFace) { + edgey1 = miRoundCapClip (leftFace, isInt, &edge1, &edgeleft1); + } else if (rightFace) { + edgey2 = miRoundCapClip (rightFace, isInt, &edge2, &edgeleft2); + } + isInt = FALSE; + } + if (!spanData) { + points = (DDXPointRec *)xalloc (sizeof (DDXPointRec) * pGC->lineWidth); + if (!points) + return; + widths = (int *)xalloc (sizeof (int) * pGC->lineWidth); + if (!widths) { + xfree (points); + return; + } + } else { + points = (DDXPointRec *)xalloc (pGC->lineWidth * sizeof (DDXPointRec)); + if (!points) + return; + widths = (int *)xalloc (pGC->lineWidth * sizeof (int)); + if (!widths) { + xfree (points); + return; + } + spanRec.points = points; + spanRec.widths = widths; + } + if (isInt) + n = miLineArcI (pGC, xorgi, yorgi, points, widths); + else + n = miLineArcD (pGC, xorg, yorg, points, widths, + &edge1, edgey1, edgeleft1, &edge2, edgey2, edgeleft2); + + if (!spanData) { + (*pGC->ops->FillSpans) (pGC, n, points, widths, TRUE, foreground); + xfree (widths); + xfree (points); + } else { + spanRec.count = n; + AppendSpanGroup (pGC, foreground, &spanRec, spanData) + } +} + +static void +miLineProjectingCap (GCPtr pGC, Boolean foreground, + SpanDataPtr spanData, LineFacePtr face, Boolean isLeft, + double xorg, double yorg, Boolean isInt) +{ + int xorgi = 0, yorgi = 0; + int lw; + PolyEdgeRec lefts[2], rights[2]; + int lefty, righty, topy, bottomy; + PolyEdgePtr left, right; + PolyEdgePtr top, bottom; + double xa, ya; + double k; + double xap, yap; + int dx, dy; + double projectXoff, projectYoff; + double maxy; + int finaly; + + if (isInt) { + xorgi = face->x; + yorgi = face->y; + } + lw = pGC->lineWidth; + dx = face->dx; + dy = face->dy; + k = face->k; + if (dy == 0) { + lefts[0].height = lw; + lefts[0].x = xorgi; + if (isLeft) + lefts[0].x -= (lw >> 1); + lefts[0].stepx = 0; + lefts[0].signdx = 1; + lefts[0].e = -lw; + lefts[0].dx = 0; + lefts[0].dy = lw; + rights[0].height = lw; + rights[0].x = xorgi; + if (!isLeft) + rights[0].x += ((lw + 1) >> 1); + rights[0].stepx = 0; + rights[0].signdx = 1; + rights[0].e = -lw; + rights[0].dx = 0; + rights[0].dy = lw; + miFillPolyHelper (pGC, foreground, spanData, yorgi - (lw >> 1), lw, lefts, rights, 1, 1); + } else if (dx == 0) { + if (dy < 0) { + dy = -dy; + isLeft = !isLeft; + } + topy = yorgi; + bottomy = yorgi + dy; + if (isLeft) + topy -= (lw >> 1); + else + bottomy += (lw >> 1); + lefts[0].height = bottomy - topy; + lefts[0].x = xorgi - (lw >> 1); + lefts[0].stepx = 0; + lefts[0].signdx = 1; + lefts[0].e = -dy; + lefts[0].dx = dx; + lefts[0].dy = dy; + + rights[0].height = bottomy - topy; + rights[0].x = lefts[0].x + (lw - 1); + rights[0].stepx = 0; + rights[0].signdx = 1; + rights[0].e = -dy; + rights[0].dx = dx; + rights[0].dy = dy; + miFillPolyHelper (pGC, foreground, spanData, topy, bottomy - topy, lefts, rights, 1, 1); + } else { + xa = face->xa; + ya = face->ya; + projectXoff = -ya; + projectYoff = xa; + if (dx < 0) { + right = &rights[1]; + left = &lefts[0]; + top = &rights[0]; + bottom = &lefts[1]; + } else { + right = &rights[0]; + left = &lefts[1]; + top = &lefts[0]; + bottom = &rights[1]; + } + if (isLeft) { + righty = miPolyBuildEdge (xa, ya, k, dx, dy, xorgi, yorgi, 0, right); + + xa = -xa; + ya = -ya; + k = -k; + lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, + k, dx, dy, xorgi, yorgi, 1, left); + if (dx > 0) { + ya = -ya; + xa = -xa; + } + xap = xa - projectXoff; + yap = ya - projectYoff; + topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, + -dy, dx, xorgi, yorgi, dx > 0, top); + bottomy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, xorgi, yorgi, dx < 0, bottom); + maxy = -ya; + } else { + righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, + k, dx, dy, xorgi, yorgi, 0, right); + + xa = -xa; + ya = -ya; + k = -k; + lefty = miPolyBuildEdge (xa, ya, k, dx, dy, xorgi, yorgi, 1, left); + if (dx > 0) { + ya = -ya; + xa = -xa; + } + xap = xa - projectXoff; + yap = ya - projectYoff; + topy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, xorgi, xorgi, dx > 0, top); + bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, + -dy, dx, xorgi, xorgi, dx < 0, bottom); + maxy = -ya + projectYoff; + } + finaly = ICEIL (maxy) + yorgi; + if (dx < 0) { + left->height = bottomy - lefty; + right->height = finaly - righty; + top->height = righty - topy; + } else { + right->height = bottomy - righty; + left->height = finaly - lefty; + top->height = lefty - topy; + } + bottom->height = finaly - bottomy; + miFillPolyHelper (pGC, foreground, spanData, topy, + bottom->height + bottomy - topy, lefts, rights, 2, 2); + } +} + +static void +miWideSegment (GCPtr pGC, + Boolean foreground, + SpanDataPtr spanData, + int x1, + int y1, + int x2, + int y2, + Boolean projectLeft, Boolean projectRight, LineFacePtr leftFace, LineFacePtr rightFace) +{ + double l, L, r; + double xa, ya; + double projectXoff = 0.0, projectYoff = 0.0; + double k; + double maxy; + int x, y; + int dx, dy; + int finaly; + PolyEdgePtr left, right; + PolyEdgePtr top, bottom; + int lefty, righty, topy, bottomy; + int signdx; + PolyEdgeRec lefts[2], rights[2]; + LineFacePtr tface; + int lw = pGC->lineWidth; + + /* draw top-to-bottom always */ + if (y2 < y1 || (y2 == y1 && x2 < x1)) { + x = x1; + x1 = x2; + x2 = x; + + y = y1; + y1 = y2; + y2 = y; + + x = projectLeft; + projectLeft = projectRight; + projectRight = x; + + tface = leftFace; + leftFace = rightFace; + rightFace = tface; + } + + dy = y2 - y1; + signdx = 1; + dx = x2 - x1; + if (dx < 0) + signdx = -1; + + leftFace->x = x1; + leftFace->y = y1; + leftFace->dx = dx; + leftFace->dy = dy; + + rightFace->x = x2; + rightFace->y = y2; + rightFace->dx = -dx; + rightFace->dy = -dy; + + if (dy == 0) { + rightFace->xa = 0; + rightFace->ya = (double) lw / 2.0; + rightFace->k = -(double) (lw * dx) / 2.0; + leftFace->xa = 0; + leftFace->ya = -rightFace->ya; + leftFace->k = rightFace->k; + x = x1; + if (projectLeft) + x -= (lw >> 1); + y = y1 - (lw >> 1); + dx = x2 - x; + if (projectRight) + dx += ((lw + 1) >> 1); + dy = lw; + miFillRectPolyHelper (pGC, foreground, spanData, x, y, dx, dy); + } else if (dx == 0) { + leftFace->xa = (double) lw / 2.0; + leftFace->ya = 0; + leftFace->k = (double) (lw * dy) / 2.0; + rightFace->xa = -leftFace->xa; + rightFace->ya = 0; + rightFace->k = leftFace->k; + y = y1; + if (projectLeft) + y -= lw >> 1; + x = x1 - (lw >> 1); + dy = y2 - y; + if (projectRight) + dy += ((lw + 1) >> 1); + dx = lw; + miFillRectPolyHelper (pGC, foreground, spanData, x, y, dx, dy); + } else { + l = ((double) lw) / 2.0; + L = hypot ((double) dx, (double) dy); + + if (dx < 0) { + right = &rights[1]; + left = &lefts[0]; + top = &rights[0]; + bottom = &lefts[1]; + } else { + right = &rights[0]; + left = &lefts[1]; + top = &lefts[0]; + bottom = &rights[1]; + } + r = l / L; + + /* coord of upper bound at integral y */ + ya = -r * dx; + xa = r * dy; + + if (projectLeft | projectRight) { + projectXoff = -ya; + projectYoff = xa; + } + + /* xa * dy - ya * dx */ + k = l * L; + + leftFace->xa = xa; + leftFace->ya = ya; + leftFace->k = k; + rightFace->xa = -xa; + rightFace->ya = -ya; + rightFace->k = k; + + if (projectLeft) + righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, + k, dx, dy, x1, y1, 0, right); + else + righty = miPolyBuildEdge (xa, ya, k, dx, dy, x1, y1, 0, right); + + /* coord of lower bound at integral y */ + ya = -ya; + xa = -xa; + + /* xa * dy - ya * dx */ + k = -k; + + if (projectLeft) + lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, + k, dx, dy, x1, y1, 1, left); + else + lefty = miPolyBuildEdge (xa, ya, k, dx, dy, x1, y1, 1, left); + + /* coord of top face at integral y */ + + if (signdx > 0) { + ya = -ya; + xa = -xa; + } + + if (projectLeft) { + double xap = xa - projectXoff; + double yap = ya - projectYoff; + topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, -dy, dx, x1, y1, dx > 0, top); + } else + topy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, x1, y1, dx > 0, top); + + /* coord of bottom face at integral y */ + + if (projectRight) { + double xap = xa + projectXoff; + double yap = ya + projectYoff; + bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, + -dy, dx, x2, y2, dx < 0, bottom); + maxy = -ya + projectYoff; + } else { + bottomy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, x2, y2, dx < 0, bottom); + maxy = -ya; + } + + finaly = ICEIL (maxy) + y2; + + if (dx < 0) { + left->height = bottomy - lefty; + right->height = finaly - righty; + top->height = righty - topy; + } else { + right->height = bottomy - righty; + left->height = finaly - lefty; + top->height = lefty - topy; + } + bottom->height = finaly - bottomy; + miFillPolyHelper (pGC, foreground, spanData, topy, + bottom->height + bottomy - topy, lefts, rights, 2, 2); + } +} + +static SpanDataPtr +miSetupSpanData (GCPtr pGC, SpanDataPtr spanData, int npt) +{ + if ((npt < 3 && pGC->capStyle != CapRound) || miSpansEasyRop (pGC->alu)) + return (SpanDataPtr) NULL; + if (pGC->lineStyle == LineDoubleDash) + miInitSpanGroup (&spanData->bgGroup); + miInitSpanGroup (&spanData->fgGroup); + return spanData; +} + +static void +miCleanupSpanData (GCPtr pGC, SpanDataPtr spanData) +{ + if (pGC->lineStyle == LineDoubleDash) { + miFillUniqueSpanGroup (pGC, &spanData->bgGroup, FALSE); + miFreeSpanGroup (&spanData->bgGroup); + } + miFillUniqueSpanGroup (pGC, &spanData->fgGroup, TRUE); + miFreeSpanGroup (&spanData->fgGroup); +} + +void +miWideLine (GCPtr pGC, int mode, int npt, DDXPointPtr pPts) +{ + int x1, y1, x2, y2; + SpanDataRec spanDataRec; + SpanDataPtr spanData; + Boolean projectLeft, projectRight; + LineFaceRec leftFace, rightFace, prevRightFace; + LineFaceRec firstFace; + int first; + Boolean somethingDrawn = FALSE; + Boolean selfJoin; + + spanData = miSetupSpanData (pGC, &spanDataRec, npt); + x2 = pPts->x; + y2 = pPts->y; + first = TRUE; + selfJoin = FALSE; + if (npt > 1) { + if (mode == CoordModePrevious) { + int nptTmp; + DDXPointPtr pPtsTmp; + + x1 = x2; + y1 = y2; + nptTmp = npt; + pPtsTmp = pPts + 1; + while (--nptTmp) { + x1 += pPtsTmp->x; + y1 += pPtsTmp->y; + ++pPtsTmp; + } + if (x2 == x1 && y2 == y1) + selfJoin = TRUE; + } else if (x2 == pPts[npt - 1].x && y2 == pPts[npt - 1].y) { + selfJoin = TRUE; + } + } + projectLeft = pGC->capStyle == CapProjecting && !selfJoin; + projectRight = FALSE; + while (--npt) { + x1 = x2; + y1 = y2; + ++pPts; + x2 = pPts->x; + y2 = pPts->y; + if (mode == CoordModePrevious) { + x2 += x1; + y2 += y1; + } + if (x1 != x2 || y1 != y2) { + somethingDrawn = TRUE; + if (npt == 1 && pGC->capStyle == CapProjecting && !selfJoin) + projectRight = TRUE; + miWideSegment (pGC, TRUE, spanData, x1, y1, x2, y2, + projectLeft, projectRight, &leftFace, &rightFace); + if (first) { + if (selfJoin) + firstFace = leftFace; + else if (pGC->capStyle == CapRound) { + if (pGC->lineWidth == 1 && !spanData) + miLineOnePoint (pGC, TRUE, spanData, x1, y1); + else + miLineArc (pGC, TRUE, spanData, + &leftFace, (LineFacePtr) NULL, (double) 0.0, (double) 0.0, TRUE); + } + } else { + miLineJoin (pGC, TRUE, spanData, &leftFace, &prevRightFace); + } + prevRightFace = rightFace; + first = FALSE; + projectLeft = FALSE; + } + if (npt == 1 && somethingDrawn) { + if (selfJoin) + miLineJoin (pGC, TRUE, spanData, &firstFace, &rightFace); + else if (pGC->capStyle == CapRound) { + if (pGC->lineWidth == 1 && !spanData) + miLineOnePoint (pGC, TRUE, spanData, x2, y2); + else + miLineArc (pGC, TRUE, spanData, + (LineFacePtr) NULL, &rightFace, (double) 0.0, (double) 0.0, TRUE); + } + } + } + /* handle crock where all points are coincedent */ + if (!somethingDrawn) { + projectLeft = pGC->capStyle == CapProjecting; + miWideSegment (pGC, TRUE, spanData, + x2, y2, x2, y2, projectLeft, projectLeft, &leftFace, &rightFace); + if (pGC->capStyle == CapRound) { + miLineArc (pGC, TRUE, spanData, + &leftFace, (LineFacePtr) NULL, (double) 0.0, (double) 0.0, TRUE); + rightFace.dx = -1; /* sleezy hack to make it work */ + miLineArc (pGC, TRUE, spanData, + (LineFacePtr) NULL, &rightFace, (double) 0.0, (double) 0.0, TRUE); + } + } + if (spanData) + miCleanupSpanData (pGC, spanData); +} + +#define V_TOP 0 +#define V_RIGHT 1 +#define V_BOTTOM 2 +#define V_LEFT 3 + +static void +miWideDashSegment (GCPtr pGC, + SpanDataPtr spanData, + int *pDashOffset, + int *pDashIndex, + int x1, + int y1, + int x2, + int y2, + Boolean projectLeft, Boolean projectRight, LineFacePtr leftFace, LineFacePtr rightFace) +{ + int dashIndex, dashRemain; + unsigned char *pDash; + double L, l; + double k; + PolyVertexRec vertices[4]; + PolyVertexRec saveRight = { 0 }, saveBottom; + PolySlopeRec slopes[4]; + PolyEdgeRec left[2], right[2]; + LineFaceRec lcapFace, rcapFace; + int nleft, nright; + int h; + int y; + int dy, dx; + Boolean foreground; + double LRemain; + double r; + double rdx, rdy; + double dashDx, dashDy; + double saveK = 0.0; + Boolean first = TRUE; + double lcenterx, lcentery, rcenterx = 0.0, rcentery = 0.0; + + dx = x2 - x1; + dy = y2 - y1; + dashIndex = *pDashIndex; + pDash = pGC->dash; + dashRemain = pDash[dashIndex] - *pDashOffset; + + l = ((double) pGC->lineWidth) / 2.0; + if (dx == 0) { + L = dy; + rdx = 0; + rdy = l; + if (dy < 0) { + L = -dy; + rdy = -l; + } + } else if (dy == 0) { + L = dx; + rdx = l; + rdy = 0; + if (dx < 0) { + L = -dx; + rdx = -l; + } + } else { + L = hypot ((double) dx, (double) dy); + r = l / L; + + rdx = r * dx; + rdy = r * dy; + } + k = l * L; + LRemain = L; + /* All position comments are relative to a line with dx and dy > 0, + * but the code does not depend on this */ + /* top */ + slopes[V_TOP].dx = dx; + slopes[V_TOP].dy = dy; + slopes[V_TOP].k = k; + /* right */ + slopes[V_RIGHT].dx = -dy; + slopes[V_RIGHT].dy = dx; + slopes[V_RIGHT].k = 0; + /* bottom */ + slopes[V_BOTTOM].dx = -dx; + slopes[V_BOTTOM].dy = -dy; + slopes[V_BOTTOM].k = k; + /* left */ + slopes[V_LEFT].dx = dy; + slopes[V_LEFT].dy = -dx; + slopes[V_LEFT].k = 0; + + /* preload the start coordinates */ + vertices[V_RIGHT].x = vertices[V_TOP].x = rdy; + vertices[V_RIGHT].y = vertices[V_TOP].y = -rdx; + + vertices[V_BOTTOM].x = vertices[V_LEFT].x = -rdy; + vertices[V_BOTTOM].y = vertices[V_LEFT].y = rdx; + + if (projectLeft) { + vertices[V_TOP].x -= rdx; + vertices[V_TOP].y -= rdy; + + vertices[V_LEFT].x -= rdx; + vertices[V_LEFT].y -= rdy; + + slopes[V_LEFT].k = rdx * dx + rdy * dy; + } + + lcenterx = x1; + lcentery = y1; + + if (pGC->capStyle == CapRound) { + lcapFace.dx = dx; + lcapFace.dy = dy; + lcapFace.x = x1; + lcapFace.y = y1; + + rcapFace.dx = -dx; + rcapFace.dy = -dy; + rcapFace.x = x1; + rcapFace.y = y1; + } + while (LRemain > dashRemain) { + dashDx = (dashRemain * dx) / L; + dashDy = (dashRemain * dy) / L; + + rcenterx = lcenterx + dashDx; + rcentery = lcentery + dashDy; + + vertices[V_RIGHT].x += dashDx; + vertices[V_RIGHT].y += dashDy; + + vertices[V_BOTTOM].x += dashDx; + vertices[V_BOTTOM].y += dashDy; + + slopes[V_RIGHT].k = vertices[V_RIGHT].x * dx + vertices[V_RIGHT].y * dy; + + if (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1)) { + if (pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapProjecting) { + saveRight = vertices[V_RIGHT]; + saveBottom = vertices[V_BOTTOM]; + saveK = slopes[V_RIGHT].k; + + if (!first) { + vertices[V_TOP].x -= rdx; + vertices[V_TOP].y -= rdy; + + vertices[V_LEFT].x -= rdx; + vertices[V_LEFT].y -= rdy; + + slopes[V_LEFT].k = vertices[V_LEFT].x * + slopes[V_LEFT].dy - vertices[V_LEFT].y * slopes[V_LEFT].dx; + } + + vertices[V_RIGHT].x += rdx; + vertices[V_RIGHT].y += rdy; + + vertices[V_BOTTOM].x += rdx; + vertices[V_BOTTOM].y += rdy; + + slopes[V_RIGHT].k = vertices[V_RIGHT].x * + slopes[V_RIGHT].dy - vertices[V_RIGHT].y * slopes[V_RIGHT].dx; + } + y = miPolyBuildPoly (vertices, slopes, 4, x1, y1, left, right, &nleft, &nright, &h); + foreground = (dashIndex & 1) == 0; + miFillPolyHelper (pGC, foreground, spanData, y, h, left, right, nleft, nright); + + if (pGC->lineStyle == LineOnOffDash) { + switch (pGC->capStyle) { + case CapProjecting: + vertices[V_BOTTOM] = saveBottom; + vertices[V_RIGHT] = saveRight; + slopes[V_RIGHT].k = saveK; + break; + case CapRound: + if (!first) { + if (dx < 0) { + lcapFace.xa = -vertices[V_LEFT].x; + lcapFace.ya = -vertices[V_LEFT].y; + lcapFace.k = slopes[V_LEFT].k; + } else { + lcapFace.xa = vertices[V_TOP].x; + lcapFace.ya = vertices[V_TOP].y; + lcapFace.k = -slopes[V_LEFT].k; + } + miLineArc (pGC, foreground, spanData, + &lcapFace, (LineFacePtr) NULL, lcenterx, lcentery, FALSE); + } + if (dx < 0) { + rcapFace.xa = vertices[V_BOTTOM].x; + rcapFace.ya = vertices[V_BOTTOM].y; + rcapFace.k = slopes[V_RIGHT].k; + } else { + rcapFace.xa = -vertices[V_RIGHT].x; + rcapFace.ya = -vertices[V_RIGHT].y; + rcapFace.k = -slopes[V_RIGHT].k; + } + miLineArc (pGC, foreground, spanData, + (LineFacePtr) NULL, &rcapFace, rcenterx, rcentery, FALSE); + break; + } + } + } + LRemain -= dashRemain; + ++dashIndex; + if (dashIndex == pGC->numInDashList) + dashIndex = 0; + dashRemain = pDash[dashIndex]; + + lcenterx = rcenterx; + lcentery = rcentery; + + vertices[V_TOP] = vertices[V_RIGHT]; + vertices[V_LEFT] = vertices[V_BOTTOM]; + slopes[V_LEFT].k = -slopes[V_RIGHT].k; + first = FALSE; + } + + if (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1)) { + vertices[V_TOP].x -= dx; + vertices[V_TOP].y -= dy; + + vertices[V_LEFT].x -= dx; + vertices[V_LEFT].y -= dy; + + vertices[V_RIGHT].x = rdy; + vertices[V_RIGHT].y = -rdx; + + vertices[V_BOTTOM].x = -rdy; + vertices[V_BOTTOM].y = rdx; + + + if (projectRight) { + vertices[V_RIGHT].x += rdx; + vertices[V_RIGHT].y += rdy; + + vertices[V_BOTTOM].x += rdx; + vertices[V_BOTTOM].y += rdy; + slopes[V_RIGHT].k = vertices[V_RIGHT].x * + slopes[V_RIGHT].dy - vertices[V_RIGHT].y * slopes[V_RIGHT].dx; + } else + slopes[V_RIGHT].k = 0; + + if (!first && pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapProjecting) { + vertices[V_TOP].x -= rdx; + vertices[V_TOP].y -= rdy; + + vertices[V_LEFT].x -= rdx; + vertices[V_LEFT].y -= rdy; + slopes[V_LEFT].k = vertices[V_LEFT].x * + slopes[V_LEFT].dy - vertices[V_LEFT].y * slopes[V_LEFT].dx; + } else + slopes[V_LEFT].k += dx * dx + dy * dy; + + + y = miPolyBuildPoly (vertices, slopes, 4, x2, y2, left, right, &nleft, &nright, &h); + + foreground = (dashIndex & 1) == 0; + miFillPolyHelper (pGC, foreground, spanData, y, h, left, right, nleft, nright); + if (!first && pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapRound) { + lcapFace.x = x2; + lcapFace.y = y2; + if (dx < 0) { + lcapFace.xa = -vertices[V_LEFT].x; + lcapFace.ya = -vertices[V_LEFT].y; + lcapFace.k = slopes[V_LEFT].k; + } else { + lcapFace.xa = vertices[V_TOP].x; + lcapFace.ya = vertices[V_TOP].y; + lcapFace.k = -slopes[V_LEFT].k; + } + miLineArc (pGC, foreground, spanData, + &lcapFace, (LineFacePtr) NULL, rcenterx, rcentery, FALSE); + } + } + dashRemain = (int)(((double) dashRemain) - LRemain); + if (dashRemain == 0) { + dashIndex++; + if (dashIndex == pGC->numInDashList) + dashIndex = 0; + dashRemain = pDash[dashIndex]; + } + + leftFace->x = x1; + leftFace->y = y1; + leftFace->dx = dx; + leftFace->dy = dy; + leftFace->xa = rdy; + leftFace->ya = -rdx; + leftFace->k = k; + + rightFace->x = x2; + rightFace->y = y2; + rightFace->dx = -dx; + rightFace->dy = -dy; + rightFace->xa = -rdy; + rightFace->ya = rdx; + rightFace->k = k; + + *pDashIndex = dashIndex; + *pDashOffset = pDash[dashIndex] - dashRemain; +} + +void +miWideDash (GCPtr pGC, int mode, int npt, DDXPointPtr pPts) +{ + int x1, y1, x2, y2; + Boolean foreground; + Boolean projectLeft, projectRight; + LineFaceRec leftFace, rightFace, prevRightFace; + LineFaceRec firstFace; + int first; + int dashIndex, dashOffset; + int prevDashIndex; + SpanDataRec spanDataRec; + SpanDataPtr spanData; + Boolean somethingDrawn = FALSE; + Boolean selfJoin; + Boolean endIsFg = FALSE, startIsFg = FALSE; + Boolean firstIsFg = FALSE, prevIsFg = FALSE; + + if (npt == 0) + return; + spanData = miSetupSpanData (pGC, &spanDataRec, npt); + x2 = pPts->x; + y2 = pPts->y; + first = TRUE; + selfJoin = FALSE; + if (mode == CoordModePrevious) { + int nptTmp; + DDXPointPtr pPtsTmp; + + x1 = x2; + y1 = y2; + nptTmp = npt; + pPtsTmp = pPts + 1; + while (--nptTmp) { + x1 += pPtsTmp->x; + y1 += pPtsTmp->y; + ++pPtsTmp; + } + if (x2 == x1 && y2 == y1) + selfJoin = TRUE; + } else if (x2 == pPts[npt - 1].x && y2 == pPts[npt - 1].y) { + selfJoin = TRUE; + } + projectLeft = pGC->capStyle == CapProjecting && !selfJoin; + projectRight = FALSE; + dashIndex = 0; + dashOffset = 0; + miStepDash ((int) pGC->dashOffset, &dashIndex, + pGC->dash, (int) pGC->numInDashList, &dashOffset); + while (--npt) { + x1 = x2; + y1 = y2; + ++pPts; + x2 = pPts->x; + y2 = pPts->y; + if (mode == CoordModePrevious) { + x2 += x1; + y2 += y1; + } + if (x1 != x2 || y1 != y2) { + somethingDrawn = TRUE; + if (npt == 1 && pGC->capStyle == CapProjecting && (!selfJoin || !firstIsFg)) + projectRight = TRUE; + prevDashIndex = dashIndex; + miWideDashSegment (pGC, spanData, &dashOffset, &dashIndex, + x1, y1, x2, y2, projectLeft, projectRight, &leftFace, &rightFace); + startIsFg = !(prevDashIndex & 1); + endIsFg = (dashIndex & 1) ^ (dashOffset != 0); + if (pGC->lineStyle == LineDoubleDash || startIsFg) { + foreground = startIsFg; + if (first || (pGC->lineStyle == LineOnOffDash && !prevIsFg)) { + if (first && selfJoin) { + firstFace = leftFace; + firstIsFg = startIsFg; + } else if (pGC->capStyle == CapRound) + miLineArc (pGC, foreground, spanData, + &leftFace, (LineFacePtr) NULL, (double) 0.0, (double) 0.0, TRUE); + } else { + miLineJoin (pGC, foreground, spanData, &leftFace, &prevRightFace); + } + } + prevRightFace = rightFace; + prevIsFg = endIsFg; + first = FALSE; + projectLeft = FALSE; + } + if (npt == 1 && somethingDrawn) { + if (pGC->lineStyle == LineDoubleDash || endIsFg) { + foreground = endIsFg; + if (selfJoin && (pGC->lineStyle == LineDoubleDash || firstIsFg)) { + miLineJoin (pGC, foreground, spanData, &firstFace, &rightFace); + } else { + if (pGC->capStyle == CapRound) + miLineArc (pGC, foreground, spanData, + (LineFacePtr) NULL, &rightFace, + (double) 0.0, (double) 0.0, TRUE); + } + } else { + /* glue a cap to the start of the line if + * we're OnOffDash and ended on odd dash + */ + if (selfJoin && firstIsFg) { + foreground = TRUE; + if (pGC->capStyle == CapProjecting) + miLineProjectingCap (pGC, foreground, spanData, + &firstFace, TRUE, (double) 0.0, (double) 0.0, TRUE); + else if (pGC->capStyle == CapRound) + miLineArc (pGC, foreground, spanData, + &firstFace, (LineFacePtr) NULL, + (double) 0.0, (double) 0.0, TRUE); + } + } + } + } + /* handle crock where all points are coincident */ + if (!somethingDrawn && (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1))) { + /* not the same as endIsFg computation above */ + foreground = (dashIndex & 1) == 0; + switch (pGC->capStyle) { + case CapRound: + miLineArc (pGC, foreground, spanData, + (LineFacePtr) NULL, (LineFacePtr) NULL, (double) x2, (double) y2, FALSE); + break; + case CapProjecting: + x1 = pGC->lineWidth; + miFillRectPolyHelper (pGC, foreground, spanData, + x2 - (x1 >> 1), y2 - (x1 >> 1), x1, x1); + break; + } + } + if (spanData) + miCleanupSpanData (pGC, spanData); +} + +#undef ExchangeSpans +#define ExchangeSpans(a, b) \ +{ \ + DDXPointRec tpt; \ + int tw; \ + \ + tpt = spans[a]; spans[a] = spans[b]; spans[b] = tpt; \ + tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \ +} + +static void QuickSortSpans( + DDXPointRec spans[], + int widths[], + int numSpans) +{ + int y; + int i, j, m; + DDXPointPtr r; + + /* Always called with numSpans > 1 */ + /* Sorts only by y, doesn't bother to sort by x */ + + do + { + if (numSpans < 9) + { + /* Do insertion sort */ + int yprev; + + yprev = spans[0].y; + i = 1; + do + { /* while i != numSpans */ + y = spans[i].y; + if (yprev > y) + { + /* spans[i] is out of order. Move into proper location. */ + DDXPointRec tpt; + int tw, k; + + for (j = 0; y >= spans[j].y; j++) {} + tpt = spans[i]; + tw = widths[i]; + for (k = i; k != j; k--) + { + spans[k] = spans[k-1]; + widths[k] = widths[k-1]; + } + spans[j] = tpt; + widths[j] = tw; + y = spans[i].y; + } /* if out of order */ + yprev = y; + i++; + } while (i != numSpans); + return; + } + + /* Choose partition element, stick in location 0 */ + m = numSpans / 2; + if (spans[m].y > spans[0].y) ExchangeSpans(m, 0); + if (spans[m].y > spans[numSpans-1].y) ExchangeSpans(m, numSpans-1); + if (spans[m].y > spans[0].y) ExchangeSpans(m, 0); + y = spans[0].y; + + /* Partition array */ + i = 0; + j = numSpans; + do + { + r = &(spans[i]); + do + { + r++; + i++; + } while (i != numSpans && r->y < y); + r = &(spans[j]); + do + { + r--; + j--; + } while (y < r->y); + if (i < j) + ExchangeSpans(i, j); + } while (i < j); + + /* Move partition element back to middle */ + ExchangeSpans(0, j); + + /* Recurse */ + if (numSpans-j-1 > 1) + QuickSortSpans(&spans[j+1], &widths[j+1], numSpans-j-1); + numSpans = j; + } while (numSpans > 1); +} + +#define NextBand() \ +{ \ + clipy1 = pboxBandStart->y1; \ + clipy2 = pboxBandStart->y2; \ + pboxBandEnd = pboxBandStart + 1; \ + while (pboxBandEnd != pboxLast && pboxBandEnd->y1 == clipy1) { \ + pboxBandEnd++; \ + } \ + for (; ppt != pptLast && ppt->y < clipy1; ppt++, pwidth++) {} \ +} + +/* + Clip a list of scanlines to a region. The caller has allocated the + space. FSorted is non-zero if the scanline origins are in ascending + order. + returns the number of new, clipped scanlines. +*/ + +int spice_canvas_clip_spans(pixman_region32_t *prgnDst, + DDXPointPtr ppt, + int *pwidth, + int nspans, + DDXPointPtr pptNew, + int *pwidthNew, + int fSorted) +{ + DDXPointPtr pptLast; + int *pwidthNewStart; /* the vengeance of Xerox! */ + int y, x1, x2; + int numRects; + pixman_box32_t *pboxBandStart; + + pptLast = ppt + nspans; + pwidthNewStart = pwidthNew; + + pboxBandStart = pixman_region32_rectangles (prgnDst, &numRects); + + if (numRects == 1) { + /* Do special fast code with clip boundaries in registers(?) */ + /* It doesn't pay much to make use of fSorted in this case, + so we lump everything together. */ + + int clipx1, clipx2, clipy1, clipy2; + + clipx1 = pboxBandStart->x1; + clipy1 = pboxBandStart->y1; + clipx2 = pboxBandStart->x2; + clipy2 = pboxBandStart->y2; + + for (; ppt != pptLast; ppt++, pwidth++) { + y = ppt->y; + x1 = ppt->x; + if (clipy1 <= y && y < clipy2) { + x2 = x1 + *pwidth; + if (x1 < clipx1) + x1 = clipx1; + if (x2 > clipx2) + x2 = clipx2; + if (x1 < x2) { + /* part of span in clip rectangle */ + pptNew->x = x1; + pptNew->y = y; + *pwidthNew = x2 - x1; + pptNew++; + pwidthNew++; + } + } + } /* end for */ + } else if (numRects != 0) { + /* Have to clip against many boxes */ + pixman_box32_t *pboxBandEnd, *pbox, *pboxLast; + int clipy1, clipy2; + + /* In this case, taking advantage of sorted spans gains more than + the sorting costs. */ + if ((! fSorted) && (nspans > 1)) + QuickSortSpans(ppt, pwidth, nspans); + + pboxLast = pboxBandStart + numRects; + + NextBand(); + + for (; ppt != pptLast; ) { + y = ppt->y; + if (y < clipy2) { + /* span is in the current band */ + pbox = pboxBandStart; + x1 = ppt->x; + x2 = x1 + *pwidth; + do { /* For each box in band */ + int newx1, newx2; + + newx1 = x1; + newx2 = x2; + if (newx1 < pbox->x1) + newx1 = pbox->x1; + if (newx2 > pbox->x2) + newx2 = pbox->x2; + if (newx1 < newx2) { + /* Part of span in clip rectangle */ + pptNew->x = newx1; + pptNew->y = y; + *pwidthNew = newx2 - newx1; + pptNew++; + pwidthNew++; + } + pbox++; + } while (pbox != pboxBandEnd); + ppt++; + pwidth++; + } else { + /* Move to next band, adjust ppt as needed */ + pboxBandStart = pboxBandEnd; + if (pboxBandStart == pboxLast) + break; /* We're completely done */ + NextBand(); + } + } + } + return (pwidthNew - pwidthNewStart); +} diff -Nru spice-gtk-0.9/spice-common/common/lines.h spice-gtk-0.12/spice-common/common/lines.h --- spice-gtk-0.9/spice-common/common/lines.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/lines.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,136 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef LINES_H +#define LINES_H + +#include +#include +#include + +#include "pixman_utils.h" +#include "draw.h" + +SPICE_BEGIN_DECLS + +typedef struct lineGC lineGC; + +typedef struct { + void (*FillSpans)(lineGC * pGC, + int num_spans, SpicePoint * points, int *widths, + int sorted, int foreground); + void (*FillRects)(lineGC * pGC, + int nun_rects, pixman_rectangle32_t * rects, + int foreground); +} lineGCOps; + +struct lineGC { + int width; + int height; + unsigned char alu; + unsigned short lineWidth; + unsigned short dashOffset; + unsigned short numInDashList; + unsigned char *dash; + unsigned int lineStyle:2; + unsigned int capStyle:2; + unsigned int joinStyle:2; + lineGCOps *ops; +}; + +/* CoordinateMode for drawing routines */ + +#define CoordModeOrigin 0 /* relative to the origin */ +#define CoordModePrevious 1 /* relative to previous point */ + +/* LineStyle */ + +#define LineSolid 0 +#define LineOnOffDash 1 +#define LineDoubleDash 2 + +/* capStyle */ + +#define CapNotLast 0 +#define CapButt 1 +#define CapRound 2 +#define CapProjecting 3 + +/* joinStyle */ + +#define JoinMiter 0 +#define JoinRound 1 +#define JoinBevel 2 + +extern void spice_canvas_zero_line(lineGC *pgc, + int mode, + int num_points, + SpicePoint * points); +extern void spice_canvas_zero_dash_line(lineGC * pgc, + int mode, + int n_points, + SpicePoint * points); +extern void spice_canvas_wide_dash_line(lineGC * pGC, + int mode, + int num_points, + SpicePoint * points); +extern void spice_canvas_wide_line(lineGC *pGC, + int mode, + int num_points, + SpicePoint * points); +extern int spice_canvas_clip_spans(pixman_region32_t *clip_region, + SpicePoint *points, + int *widths, + int num_spans, + SpicePoint *new_points, + int *new_widths, + int sorted); + +SPICE_END_DECLS + +#endif /* LINES_H */ diff -Nru spice-gtk-0.9/spice-common/common/log.c spice-gtk-0.12/spice-common/common/log.c --- spice-gtk-0.9/spice-common/common/log.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/log.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,113 @@ +/* + Copyright (C) 2012 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include + +#include "log.h" +#include "backtrace.h" + +static int debug_level = -1; +static int abort_level = -1; + +static const char * spice_log_level_to_string(SpiceLogLevel level) +{ + static const char *to_string[] = { + [ SPICE_LOG_LEVEL_ERROR ] = "ERROR", + [ SPICE_LOG_LEVEL_CRITICAL ] = "CRITICAL", + [ SPICE_LOG_LEVEL_WARNING ] = "Warning", + [ SPICE_LOG_LEVEL_INFO ] = "Info", + [ SPICE_LOG_LEVEL_DEBUG ] = "Debug", + }; + const char *str = NULL; + + if (level < SPICE_N_ELEMENTS(to_string)) { + str = to_string[level]; + } + + return str; +} + +#ifndef SPICE_ABORT_LEVEL_DEFAULT +#ifdef SPICE_DISABLE_ABORT +#define SPICE_ABORT_LEVEL_DEFAULT -1 +#else +#define SPICE_ABORT_LEVEL_DEFAULT SPICE_LOG_LEVEL_CRITICAL +#endif +#endif + +void spice_logv(const char *log_domain, + SpiceLogLevel log_level, + const char *strloc, + const char *function, + const char *format, + va_list args) +{ + const char *level = spice_log_level_to_string(log_level); + + if (debug_level == -1) { + debug_level = getenv("SPICE_DEBUG_LEVEL") ? atoi(getenv("SPICE_DEBUG_LEVEL")) : SPICE_LOG_LEVEL_WARNING; + } + if (abort_level == -1) { + abort_level = getenv("SPICE_ABORT_LEVEL") ? atoi(getenv("SPICE_ABORT_LEVEL")) : SPICE_ABORT_LEVEL_DEFAULT; + } + + if (debug_level < log_level) + return; + + fprintf(stderr, "(%s:%d): ", getenv("_"), getpid()); + + if (log_domain) { + fprintf(stderr, "%s-", log_domain); + } + if (level) { + fprintf(stderr, "%s **: ", level); + } + if (strloc && function) { + fprintf(stderr, "%s:%s: ", strloc, function); + } + if (format) { + vfprintf(stderr, format, args); + } + + fprintf(stderr, "\n"); + + if (abort_level != -1 && abort_level >= log_level) { + spice_backtrace(); + abort(); + } +} + +void spice_log(const char *log_domain, + SpiceLogLevel log_level, + const char *strloc, + const char *function, + const char *format, + ...) +{ + va_list args; + + va_start (args, format); + spice_logv (log_domain, log_level, strloc, function, format, args); + va_end (args); +} diff -Nru spice-gtk-0.9/spice-common/common/log.h spice-gtk-0.12/spice-common/common/log.h --- spice-gtk-0.9/spice-common/common/log.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/log.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,145 @@ +/* + Copyright (C) 2012 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef H_SPICE_LOG +#define H_SPICE_LOG + +#include +#include +#include "macros.h" + +SPICE_BEGIN_DECLS + +#ifndef SPICE_LOG_DOMAIN +#define SPICE_LOG_DOMAIN "Spice" +#endif + +#define SPICE_STRINGIFY(x) SPICE_STRINGIFY_ARG (x) +#define SPICE_STRINGIFY_ARG(x) #x + +#define SPICE_STRLOC __FILE__ ":" SPICE_STRINGIFY (__LINE__) + +typedef enum { + SPICE_LOG_LEVEL_ERROR, + SPICE_LOG_LEVEL_CRITICAL, + SPICE_LOG_LEVEL_WARNING, + SPICE_LOG_LEVEL_INFO, + SPICE_LOG_LEVEL_DEBUG, +} SpiceLogLevel; + +void spice_logv(const char *log_domain, + SpiceLogLevel log_level, + const char *strloc, + const char *function, + const char *format, + va_list args) SPICE_ATTR_PRINTF(5, 0); + +void spice_log(const char *log_domain, + SpiceLogLevel log_level, + const char *strloc, + const char *function, + const char *format, + ...) SPICE_ATTR_PRINTF(5, 6); + +#ifndef spice_return_if_fail +#define spice_return_if_fail(x) SPICE_STMT_START { \ + if SPICE_LIKELY(x) { } else { \ + spice_log(SPICE_LOG_DOMAIN, SPICE_LOG_LEVEL_CRITICAL, SPICE_STRLOC, __FUNCTION__, "condition `%s' failed", #x); \ + return; \ + } \ +} SPICE_STMT_END +#endif + +#ifndef spice_return_val_if_fail +#define spice_return_val_if_fail(x, val) SPICE_STMT_START { \ + if SPICE_LIKELY(x) { } else { \ + spice_log(SPICE_LOG_DOMAIN, SPICE_LOG_LEVEL_CRITICAL, SPICE_STRLOC, __FUNCTION__, "condition `%s' failed", #x); \ + return (val); \ + } \ +} SPICE_STMT_END +#endif + +#ifndef spice_warn_if_reached +#define spice_warn_if_reached() SPICE_STMT_START { \ + spice_log(SPICE_LOG_DOMAIN, SPICE_LOG_LEVEL_WARNING, SPICE_STRLOC, __FUNCTION__, "should not be reached"); \ +} SPICE_STMT_END +#endif + +#ifndef spice_printerr +#define spice_printerr(format, ...) SPICE_STMT_START { \ + fprintf(stderr, "%s: " format "\n", __FUNCTION__, ## __VA_ARGS__); \ +} SPICE_STMT_END +#endif + +#ifndef spice_debug +#define spice_debug(format, ...) SPICE_STMT_START { \ + spice_log(SPICE_LOG_DOMAIN, SPICE_LOG_LEVEL_DEBUG, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \ +} SPICE_STMT_END +#endif + +#ifndef spice_warning +#define spice_warning(format, ...) SPICE_STMT_START { \ + spice_log(SPICE_LOG_DOMAIN, SPICE_LOG_LEVEL_WARNING, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \ +} SPICE_STMT_END +#endif + +#ifndef spice_critical +#define spice_critical(format, ...) SPICE_STMT_START { \ + spice_log(SPICE_LOG_DOMAIN, SPICE_LOG_LEVEL_CRITICAL, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \ +} SPICE_STMT_END +#endif + +#ifndef spice_error +#define spice_error(format, ...) SPICE_STMT_START { \ + spice_log(SPICE_LOG_DOMAIN, SPICE_LOG_LEVEL_ERROR, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \ +} SPICE_STMT_END +#endif + +#ifndef spice_warn_if_fail +#define spice_warn_if_fail(x) SPICE_STMT_START { \ + if SPICE_LIKELY(x) { } else { \ + spice_warning("condition `%s' failed", #x); \ + } \ +} SPICE_STMT_END +#endif + +#ifndef spice_warn_if +#define spice_warn_if(x) SPICE_STMT_START { \ + if SPICE_UNLIKELY(x) { \ + spice_warning("condition `%s' reached", #x); \ + } \ +} SPICE_STMT_END +#endif + +#ifndef spice_assert +#define spice_assert(x) SPICE_STMT_START { \ + if SPICE_LIKELY(x) { } else { \ + spice_error("assertion `%s' failed", #x); \ + } \ +} SPICE_STMT_END +#endif + +/* FIXME: improve that some day.. */ +#ifndef spice_static_assert +#define spice_static_assert(x) SPICE_STMT_START { \ + spice_assert(x); \ +} SPICE_STMT_END +#endif + +SPICE_END_DECLS + +#endif /* H_SPICE_LOG */ diff -Nru spice-gtk-0.9/spice-common/common/lz.c spice-gtk-0.12/spice-common/common/lz.c --- spice-gtk-0.9/spice-common/common/lz.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/lz.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,729 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + + Copyright (C) 2009 Red Hat, Inc. and/or its affiliates. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . + + This file incorporates work covered by the following copyright and + permission notice: + Copyright (C) 2007 Ariya Hidayat (ariya@kde.org) + Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) + Copyright (C) 2005 Ariya Hidayat (ariya@kde.org) + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "spice_common.h" +#include "lz.h" + +#define HASH_LOG 13 +#define HASH_SIZE (1 << HASH_LOG) +#define HASH_MASK (HASH_SIZE - 1) + + +typedef struct LzImageSegment LzImageSegment; +struct LzImageSegment { + uint8_t *lines; + uint8_t *lines_end; + unsigned int size_delta; // total size of the previous segments in units of + // pixels for rgb and bytes for plt. + LzImageSegment *next; +}; + +// TODO: pack? +typedef struct HashEntry { + LzImageSegment *image_seg; + uint8_t *ref; +} HashEntry; + +typedef struct Encoder { + LzUsrContext *usr; + + LzImageType type; + const SpicePalette *palette; // for decoding images with palettes to rgb + int stride; // stride is in bytes. For rgb must be equal to + // width*bytes_per_pix. + // For palettes stride can be bigger than width/pixels_per_byte by 1 only if + // width%pixels_per_byte != 0. + int height; + int width; // the original width (in pixels) + + LzImageSegment *head_image_segs; + LzImageSegment *tail_image_segs; + LzImageSegment *free_image_segs; + + // the dictionary hash table is composed (1) a pointer to the segment the word was found in + // (2) a pointer to the first byte in the segment that matches the word + HashEntry htab[HASH_SIZE]; + + uint8_t *io_start; + uint8_t *io_now; + uint8_t *io_end; + size_t io_bytes_count; + + uint8_t *io_last_copy; // pointer to the last byte in which copy count was written +} Encoder; + +/****************************************************/ +/* functions for managing the pool of image segments*/ +/****************************************************/ +static INLINE LzImageSegment *lz_alloc_image_seg(Encoder *encoder); +static void lz_reset_image_seg(Encoder *encoder); +static int lz_read_image_segments(Encoder *encoder, uint8_t *first_lines, + unsigned int num_first_lines); + + +// return a free image segment if one exists. Make allocation if needed. adds it to the +// tail of the image segments lists +static INLINE LzImageSegment *lz_alloc_image_seg(Encoder *encoder) +{ + LzImageSegment *ret; + + if (encoder->free_image_segs) { + ret = encoder->free_image_segs; + encoder->free_image_segs = ret->next; + } else { + if (!(ret = (LzImageSegment *)encoder->usr->malloc(encoder->usr, sizeof(*ret)))) { + return NULL; + } + } + + ret->next = NULL; + if (encoder->tail_image_segs) { + encoder->tail_image_segs->next = ret; + } + encoder->tail_image_segs = ret; + + if (!encoder->head_image_segs) { + encoder->head_image_segs = ret; + } + + return ret; +} + +// adding seg to the head of free segments (lz_reset_image_seg removes it from used ones) +static INLINE void __lz_free_image_seg(Encoder *encoder, LzImageSegment *seg) +{ + seg->next = encoder->free_image_segs; + encoder->free_image_segs = seg; +} + +// moves all the used image segments to the free pool +static void lz_reset_image_seg(Encoder *encoder) +{ + while (encoder->head_image_segs) { + LzImageSegment *seg = encoder->head_image_segs; + encoder->head_image_segs = seg->next; + __lz_free_image_seg(encoder, seg); + } + encoder->tail_image_segs = NULL; +} + +static void lz_dealloc_free_segments(Encoder *encoder) +{ + while (encoder->free_image_segs) { + LzImageSegment *seg = encoder->free_image_segs; + encoder->free_image_segs = seg->next; + encoder->usr->free(encoder->usr, seg); + } +} + +// return FALSE when operation fails (due to failure in allocation) +static int lz_read_image_segments(Encoder *encoder, uint8_t *first_lines, + unsigned int num_first_lines) +{ + LzImageSegment *image_seg; + uint32_t size_delta = 0; + unsigned int num_lines = num_first_lines; + uint8_t* lines = first_lines; + int row; + + spice_return_val_if_fail(!encoder->head_image_segs, FALSE); + + image_seg = lz_alloc_image_seg(encoder); + if (!image_seg) { + goto error_1; + } + + image_seg->lines = lines; + image_seg->lines_end = lines + num_lines * encoder->stride; + image_seg->size_delta = size_delta; + + size_delta += num_lines * encoder->stride / RGB_BYTES_PER_PIXEL[encoder->type]; + + for (row = num_first_lines; row < encoder->height; row += num_lines) { + num_lines = encoder->usr->more_lines(encoder->usr, &lines); + if (num_lines <= 0) { + encoder->usr->error(encoder->usr, "more lines failed\n"); + } + image_seg = lz_alloc_image_seg(encoder); + + if (!image_seg) { + goto error_1; + } + + image_seg->lines = lines; + image_seg->lines_end = lines + num_lines * encoder->stride; + image_seg->size_delta = size_delta; + + size_delta += num_lines * encoder->stride / RGB_BYTES_PER_PIXEL[encoder->type]; + } + + return TRUE; +error_1: + lz_reset_image_seg(encoder); + return FALSE; +} + +/************************************************************************** +* Handling encoding and decoding of a byte +***************************************************************************/ +static INLINE int more_io_bytes(Encoder *encoder) +{ + uint8_t *io_ptr; + int num_io_bytes = encoder->usr->more_space(encoder->usr, &io_ptr); + encoder->io_bytes_count += num_io_bytes; + encoder->io_now = io_ptr; + encoder->io_end = encoder->io_now + num_io_bytes; + return num_io_bytes; +} + +static INLINE void encode(Encoder *encoder, uint8_t byte) +{ + if (encoder->io_now == encoder->io_end) { + if (more_io_bytes(encoder) <= 0) { + encoder->usr->error(encoder->usr, "%s: no more bytes\n", __FUNCTION__); + } + spice_return_if_fail(encoder->io_now); + } + + spice_return_if_fail(encoder->io_now < encoder->io_end); + *(encoder->io_now++) = byte; +} + +static INLINE void encode_32(Encoder *encoder, unsigned int word) +{ + encode(encoder, (uint8_t)(word >> 24)); + encode(encoder, (uint8_t)(word >> 16) & 0x0000ff); + encode(encoder, (uint8_t)(word >> 8) & 0x0000ff); + encode(encoder, (uint8_t)(word & 0x0000ff)); +} + +static INLINE void encode_copy_count(Encoder *encoder, uint8_t copy_count) +{ + encode(encoder, copy_count); + encoder->io_last_copy = encoder->io_now - 1; // io_now cannot be the first byte of the buffer +} + +static INLINE void update_copy_count(Encoder *encoder, uint8_t copy_count) +{ + spice_return_if_fail(encoder->io_last_copy); + *(encoder->io_last_copy) = copy_count; +} + +static INLINE void encode_level(Encoder *encoder, uint8_t level_code) +{ + *(encoder->io_start) |= level_code; +} + +// decrease the io ptr by 1 +static INLINE void compress_output_prev(Encoder *encoder) +{ + // io_now cannot be the first byte of the buffer + encoder->io_now--; + // the function should be called only when copy count is written unnecessarily by lz_compress + spice_return_if_fail(encoder->io_now == encoder->io_last_copy); +} + +static int encoder_reset(Encoder *encoder, uint8_t *io_ptr, uint8_t *io_ptr_end) +{ + spice_return_val_if_fail(io_ptr <= io_ptr_end, FALSE); + + encoder->io_bytes_count = io_ptr_end - io_ptr; + encoder->io_start = io_ptr; + encoder->io_now = io_ptr; + encoder->io_end = io_ptr_end; + encoder->io_last_copy = NULL; + + return TRUE; +} + +static INLINE uint8_t decode(Encoder *encoder) +{ + if (encoder->io_now == encoder->io_end) { + int num_io_bytes = more_io_bytes(encoder); + if (num_io_bytes <= 0) { + encoder->usr->error(encoder->usr, "%s: no more bytes\n", __FUNCTION__); + } + spice_assert(encoder->io_now); + } + spice_assert(encoder->io_now < encoder->io_end); + return *(encoder->io_now++); +} + +static INLINE uint32_t decode_32(Encoder *encoder) +{ + uint32_t word = 0; + word |= decode(encoder); + word <<= 8; + word |= decode(encoder); + word <<= 8; + word |= decode(encoder); + word <<= 8; + word |= decode(encoder); + return word; +} + +static INLINE int is_io_to_decode_end(Encoder *encoder) +{ + if (encoder->io_now != encoder->io_end) { + return FALSE; + } else { + int num_io_bytes = more_io_bytes(encoder); //disable inline optimizations + return (num_io_bytes <= 0); + } +} + +/******************************************************************* +* intialization and finalization of lz +********************************************************************/ +static int init_encoder(Encoder *encoder, LzUsrContext *usr) +{ + encoder->usr = usr; + encoder->free_image_segs = NULL; + encoder->head_image_segs = NULL; + encoder->tail_image_segs = NULL; + return TRUE; +} + +LzContext *lz_create(LzUsrContext *usr) +{ + Encoder *encoder; + + if (!usr || !usr->error || !usr->warn || !usr->info || !usr->malloc || + !usr->free || !usr->more_space || !usr->more_lines) { + return NULL; + } + + if (!(encoder = (Encoder *)usr->malloc(usr, sizeof(Encoder)))) { + return NULL; + } + + if (!init_encoder(encoder, usr)) { + usr->free(usr, encoder); + return NULL; + } + return (LzContext *)encoder; +} + +void lz_destroy(LzContext *lz) +{ + Encoder *encoder = (Encoder *)lz; + + if (!lz) { + return; + } + + if (encoder->head_image_segs) { + encoder->usr->error(encoder->usr, "%s: used_image_segments not empty\n", __FUNCTION__); + lz_reset_image_seg(encoder); + } + lz_dealloc_free_segments(encoder); + + encoder->usr->free(encoder->usr, encoder); +} + +/******************************************************************* +* encoding and decoding the image +********************************************************************/ +/* + * Give hints to the compiler for branch prediction optimization. + */ +#if defined(__GNUC__) && (__GNUC__ > 2) +#define LZ_EXPECT_CONDITIONAL(c) (__builtin_expect((c), 1)) +#define LZ_UNEXPECT_CONDITIONAL(c) (__builtin_expect((c), 0)) +#else +#define LZ_EXPECT_CONDITIONAL(c) (c) +#define LZ_UNEXPECT_CONDITIONAL(c) (c) +#endif + + +#ifdef __GNUC__ +#define ATTR_PACKED __attribute__ ((__packed__)) +#else +#define ATTR_PACKED +#pragma pack(push) +#pragma pack(1) +#endif + + +/* the palette images will be treated as one byte pixels. Their width should be transformed + accordingly. +*/ +typedef struct ATTR_PACKED one_byte_pixel_t { + uint8_t a; +} one_byte_pixel_t; + +typedef struct ATTR_PACKED rgb32_pixel_t { + uint8_t b; + uint8_t g; + uint8_t r; + uint8_t pad; +} rgb32_pixel_t; + +typedef struct ATTR_PACKED rgb24_pixel_t { + uint8_t b; + uint8_t g; + uint8_t r; +} rgb24_pixel_t; + +typedef uint16_t rgb16_pixel_t; + +#ifndef __GNUC__ +#pragma pack(pop) +#endif + +#undef ATTR_PACKED + + +#define MAX_COPY 32 +#define MAX_LEN 264 /* 256 + 8 */ +#define BOUND_OFFSET 2 +#define LIMIT_OFFSET 6 +#define MIN_FILE_SIZE 4 +#define COMP_LEVEL_SIZE_LIMIT 65536 + +// TODO: implemented lz2. should lz1 be an option (no RLE + distance limitation of MAX_DISTANCE) +// TODO: I think MAX_FARDISTANCE can be changed easily to 2^29 +// (and maybe even more when pixel > byte). +// i.e. we can support 512M Bytes/Pixels distance instead of only ~68K. +#define MAX_DISTANCE 8191 // 2^13 +#define MAX_FARDISTANCE (65535 + MAX_DISTANCE - 1) // ~2^16+2^13 + + +#define LZ_PLT +#include "lz_compress_tmpl.c" +#define LZ_PLT +#include "lz_decompress_tmpl.c" + +#define LZ_PLT +#define PLT8 +#define TO_RGB32 +#include "lz_decompress_tmpl.c" + +#define LZ_PLT +#define PLT4_BE +#define TO_RGB32 +#include "lz_decompress_tmpl.c" + +#define LZ_PLT +#define PLT4_LE +#define TO_RGB32 +#include "lz_decompress_tmpl.c" + +#define LZ_PLT +#define PLT1_BE +#define TO_RGB32 +#include "lz_decompress_tmpl.c" + +#define LZ_PLT +#define PLT1_LE +#define TO_RGB32 +#include "lz_decompress_tmpl.c" + + +#define LZ_RGB16 +#include "lz_compress_tmpl.c" +#define LZ_RGB16 +#include "lz_decompress_tmpl.c" +#define LZ_RGB16 +#define TO_RGB32 +#include "lz_decompress_tmpl.c" + +#define LZ_RGB24 +#include "lz_compress_tmpl.c" +#define LZ_RGB24 +#include "lz_decompress_tmpl.c" + + +#define LZ_RGB32 +#include "lz_compress_tmpl.c" +#define LZ_RGB32 +#include "lz_decompress_tmpl.c" + +#define LZ_RGB_ALPHA +#include "lz_compress_tmpl.c" +#define LZ_RGB_ALPHA +#include "lz_decompress_tmpl.c" + +#undef LZ_UNEXPECT_CONDITIONAL +#undef LZ_EXPECT_CONDITIONAL + +int lz_encode(LzContext *lz, LzImageType type, int width, int height, int top_down, + uint8_t *lines, unsigned int num_lines, int stride, + uint8_t *io_ptr, unsigned int num_io_bytes) +{ + Encoder *encoder = (Encoder *)lz; + uint8_t *io_ptr_end = io_ptr + num_io_bytes; + + encoder->type = type; + encoder->width = width; + encoder->height = height; + encoder->stride = stride; + + if (IS_IMAGE_TYPE_PLT[encoder->type]) { + if (encoder->stride > (width / PLT_PIXELS_PER_BYTE[encoder->type])) { + if (((width % PLT_PIXELS_PER_BYTE[encoder->type]) == 0) || ( + (encoder->stride - (width / PLT_PIXELS_PER_BYTE[encoder->type])) > 1)) { + encoder->usr->error(encoder->usr, "stride overflows (plt)\n"); + } + } + } else { + if (encoder->stride != width * RGB_BYTES_PER_PIXEL[encoder->type]) { + encoder->usr->error(encoder->usr, "stride != width*bytes_per_pixel (rgb)\n"); + } + } + + // assign the output buffer + if (!encoder_reset(encoder, io_ptr, io_ptr_end)) { + encoder->usr->error(encoder->usr, "lz encoder io reset failed\n"); + } + + // first read the list of the image segments + if (!lz_read_image_segments(encoder, lines, num_lines)) { + encoder->usr->error(encoder->usr, "lz encoder reading image segments failed\n"); + } + + encode_32(encoder, LZ_MAGIC); + encode_32(encoder, LZ_VERSION); + encode_32(encoder, type); + encode_32(encoder, width); + encode_32(encoder, height); + encode_32(encoder, stride); + encode_32(encoder, top_down); // TODO: maybe compress type and top_down to one byte + + switch (encoder->type) { + case LZ_IMAGE_TYPE_PLT1_BE: + case LZ_IMAGE_TYPE_PLT1_LE: + case LZ_IMAGE_TYPE_PLT4_BE: + case LZ_IMAGE_TYPE_PLT4_LE: + case LZ_IMAGE_TYPE_PLT8: + lz_plt_compress(encoder); + break; + case LZ_IMAGE_TYPE_RGB16: + lz_rgb16_compress(encoder); + break; + case LZ_IMAGE_TYPE_RGB24: + lz_rgb24_compress(encoder); + break; + case LZ_IMAGE_TYPE_RGB32: + lz_rgb32_compress(encoder); + break; + case LZ_IMAGE_TYPE_RGBA: + lz_rgb32_compress(encoder); + lz_rgb_alpha_compress(encoder); + break; + case LZ_IMAGE_TYPE_XXXA: + lz_rgb_alpha_compress(encoder); + break; + case LZ_IMAGE_TYPE_INVALID: + default: + encoder->usr->error(encoder->usr, "bad image type\n"); + } + + // move all the used segments to the free ones + lz_reset_image_seg(encoder); + + encoder->io_bytes_count -= (encoder->io_end - encoder->io_now); + + return encoder->io_bytes_count; +} + +/* + initialize and read lz magic +*/ +void lz_decode_begin(LzContext *lz, uint8_t *io_ptr, unsigned int num_io_bytes, + LzImageType *out_type, int *out_width, int *out_height, + int *out_n_pixels, int *out_top_down, const SpicePalette *palette) +{ + Encoder *encoder = (Encoder *)lz; + uint8_t *io_ptr_end = io_ptr + num_io_bytes; + uint32_t magic; + uint32_t version; + + if (!encoder_reset(encoder, io_ptr, io_ptr_end)) { + encoder->usr->error(encoder->usr, "io reset failed"); + } + + magic = decode_32(encoder); + if (magic != LZ_MAGIC) { + encoder->usr->error(encoder->usr, "bad magic\n"); + } + + version = decode_32(encoder); + if (version != LZ_VERSION) { + encoder->usr->error(encoder->usr, "bad version\n"); + } + + encoder->type = (LzImageType)decode_32(encoder); + encoder->width = decode_32(encoder); + encoder->height = decode_32(encoder); + encoder->stride = decode_32(encoder); + *out_top_down = decode_32(encoder); + + *out_width = encoder->width; + *out_height = encoder->height; +// *out_stride = encoder->stride; + *out_type = encoder->type; + + // TODO: maybe instead of stride we can encode out_n_pixels + // (if stride is not necessary in decoding). + if (IS_IMAGE_TYPE_PLT[encoder->type]) { + encoder->palette = palette; + *out_n_pixels = encoder->stride * PLT_PIXELS_PER_BYTE[encoder->type] * encoder->height; + } else { + *out_n_pixels = encoder->width * encoder->height; + } +} + +void lz_decode(LzContext *lz, LzImageType to_type, uint8_t *buf) +{ + Encoder *encoder = (Encoder *)lz; + size_t out_size = 0; + size_t alpha_size = 0; + size_t size = 0; + if (IS_IMAGE_TYPE_PLT[encoder->type]) { + if (to_type == encoder->type) { + size = encoder->height * encoder->stride; + out_size = lz_plt_decompress(encoder, (one_byte_pixel_t *)buf, size); + } else if (to_type == LZ_IMAGE_TYPE_RGB32) { + size = encoder->height * encoder->stride * PLT_PIXELS_PER_BYTE[encoder->type]; + if (!encoder->palette) { + encoder->usr->error(encoder->usr, + "a palette is missing (for bpp to rgb decoding)\n"); + } + switch (encoder->type) { + case LZ_IMAGE_TYPE_PLT1_BE: + out_size = lz_plt1_be_to_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); + break; + case LZ_IMAGE_TYPE_PLT1_LE: + out_size = lz_plt1_le_to_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); + break; + case LZ_IMAGE_TYPE_PLT4_BE: + out_size = lz_plt4_be_to_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); + break; + case LZ_IMAGE_TYPE_PLT4_LE: + out_size = lz_plt4_le_to_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); + break; + case LZ_IMAGE_TYPE_PLT8: + out_size = lz_plt8_to_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); + break; + case LZ_IMAGE_TYPE_RGB16: + case LZ_IMAGE_TYPE_RGB24: + case LZ_IMAGE_TYPE_RGB32: + case LZ_IMAGE_TYPE_RGBA: + case LZ_IMAGE_TYPE_XXXA: + case LZ_IMAGE_TYPE_INVALID: + default: + encoder->usr->error(encoder->usr, "bad image type\n"); + } + } else { + encoder->usr->error(encoder->usr, "unsupported output format\n"); + } + } else { + size = encoder->height * encoder->width; + switch (encoder->type) { + case LZ_IMAGE_TYPE_RGB16: + if (encoder->type == to_type) { + out_size = lz_rgb16_decompress(encoder, (rgb16_pixel_t *)buf, size); + } else if (to_type == LZ_IMAGE_TYPE_RGB32) { + out_size = lz_rgb16_to_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); + } else { + encoder->usr->error(encoder->usr, "unsupported output format\n"); + } + break; + case LZ_IMAGE_TYPE_RGB24: + if (encoder->type == to_type) { + out_size = lz_rgb24_decompress(encoder, (rgb24_pixel_t *)buf, size); + } else if (to_type == LZ_IMAGE_TYPE_RGB32) { + out_size = lz_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); + } else { + encoder->usr->error(encoder->usr, "unsupported output format\n"); + } + break; + case LZ_IMAGE_TYPE_RGB32: + if (encoder->type == to_type) { + out_size = lz_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); + } else { + encoder->usr->error(encoder->usr, "unsupported output format\n"); + } + break; + case LZ_IMAGE_TYPE_RGBA: + if (encoder->type == to_type) { + out_size = lz_rgb32_decompress(encoder, (rgb32_pixel_t *)buf, size); + alpha_size = lz_rgb_alpha_decompress(encoder, (rgb32_pixel_t *)buf, size); + spice_assert(alpha_size == size); + } else { + encoder->usr->error(encoder->usr, "unsupported output format\n"); + } + break; + case LZ_IMAGE_TYPE_XXXA: + if (encoder->type == to_type) { + alpha_size = lz_rgb_alpha_decompress(encoder, (rgb32_pixel_t *)buf, size); + out_size = alpha_size; + } else { + encoder->usr->error(encoder->usr, "unsupported output format\n"); + } + break; + case LZ_IMAGE_TYPE_PLT1_LE: + case LZ_IMAGE_TYPE_PLT1_BE: + case LZ_IMAGE_TYPE_PLT4_LE: + case LZ_IMAGE_TYPE_PLT4_BE: + case LZ_IMAGE_TYPE_PLT8: + case LZ_IMAGE_TYPE_INVALID: + default: + encoder->usr->error(encoder->usr, "bad image type\n"); + } + } + + spice_assert(is_io_to_decode_end(encoder)); + spice_assert(out_size == size); + + if (out_size != size) { + encoder->usr->error(encoder->usr, "bad decode size\n"); + } +} diff -Nru spice-gtk-0.9/spice-common/common/lz_common.h spice-gtk-0.12/spice-common/common/lz_common.h --- spice-gtk-0.9/spice-common/common/lz_common.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/lz_common.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,67 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/*common header for encoder and decoder*/ + +#ifndef _LZ_COMMON_H +#define _LZ_COMMON_H + +#include + +SPICE_BEGIN_DECLS + +//#define DEBUG + +/* change the max window size will require change in the encoding format*/ +#define LZ_MAX_WINDOW_SIZE (1 << 25) +#define MAX_COPY 32 + +typedef enum { + LZ_IMAGE_TYPE_INVALID, + LZ_IMAGE_TYPE_PLT1_LE, + LZ_IMAGE_TYPE_PLT1_BE, // PLT stands for palette + LZ_IMAGE_TYPE_PLT4_LE, + LZ_IMAGE_TYPE_PLT4_BE, + LZ_IMAGE_TYPE_PLT8, + LZ_IMAGE_TYPE_RGB16, + LZ_IMAGE_TYPE_RGB24, + LZ_IMAGE_TYPE_RGB32, + LZ_IMAGE_TYPE_RGBA, + LZ_IMAGE_TYPE_XXXA +} LzImageType; + +#define LZ_IMAGE_TYPE_MASK 0x0f +#define LZ_IMAGE_TYPE_LOG 4 // number of bits required for coding the image type + +/* access to the arrays is based on the image types */ +static const int IS_IMAGE_TYPE_PLT[] = {0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}; +static const int IS_IMAGE_TYPE_RGB[] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}; +static const int PLT_PIXELS_PER_BYTE[] = {0, 8, 8, 2, 2, 1}; +static const int RGB_BYTES_PER_PIXEL[] = {0, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4}; + + +#define LZ_MAGIC (*(uint32_t *)"LZ ") +#define LZ_VERSION_MAJOR 1U +#define LZ_VERSION_MINOR 1U +#define LZ_VERSION ((LZ_VERSION_MAJOR << 16) | (LZ_VERSION_MINOR & 0xffff)) + +SPICE_END_DECLS + +#endif // _LZ_COMMON_H diff -Nru spice-gtk-0.9/spice-common/common/lz_compress_tmpl.c spice-gtk-0.12/spice-common/common/lz_compress_tmpl.c --- spice-gtk-0.9/spice-common/common/lz_compress_tmpl.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/lz_compress_tmpl.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,529 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + + Copyright (C) 2009 Red Hat, Inc. and/or its affiliates. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + This file incorporates work covered by the following copyright and + permission notice: + Copyright (C) 2007 Ariya Hidayat (ariya@kde.org) + Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) + Copyright (C) 2005 Ariya Hidayat (ariya@kde.org) + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#define DJB2_START 5381; +#define DJB2_HASH(hash, c) (hash = ((hash << 5) + hash) ^ (c)) //|{hash = ((hash << 5) + hash) + c;} + +/* + For each pixel type the following macros are defined: + PIXEL : input type + FNAME(name) + ENCODE_PIXEL(encoder, pixel) : writing a pixel to the compressed buffer (byte by byte) + SAME_PIXEL(pix1, pix2) : comparing two pixels + HASH_FUNC(value, pix_ptr) : hash func of 3 consecutive pixels +*/ + +#ifdef LZ_PLT +#define PIXEL one_byte_pixel_t +#define FNAME(name) lz_plt_##name +#define ENCODE_PIXEL(e, pix) encode(e, (pix).a) // gets the pixel and write only the needed bytes + // from the pixel +#define SAME_PIXEL(pix1, pix2) ((pix1).a == (pix2).a) +#define HASH_FUNC(v, p) { \ + v = DJB2_START; \ + DJB2_HASH(v, p[0].a); \ + DJB2_HASH(v, p[1].a); \ + DJB2_HASH(v, p[2].a); \ + v &= HASH_MASK; \ + } +#endif + +#ifdef LZ_RGB_ALPHA +//#undef LZ_RGB_ALPHA +#define PIXEL rgb32_pixel_t +#define FNAME(name) lz_rgb_alpha_##name +#define ENCODE_PIXEL(e, pix) {encode(e, (pix).pad);} +#define SAME_PIXEL(pix1, pix2) ((pix1).pad == (pix2).pad) +#define HASH_FUNC(v, p) { \ + v = DJB2_START; \ + DJB2_HASH(v, p[0].pad); \ + DJB2_HASH(v, p[1].pad); \ + DJB2_HASH(v, p[2].pad); \ + v &= HASH_MASK; \ + } +#endif + + +#ifdef LZ_RGB16 +#define PIXEL rgb16_pixel_t +#define FNAME(name) lz_rgb16_##name +#define GET_r(pix) (((pix) >> 10) & 0x1f) +#define GET_g(pix) (((pix) >> 5) & 0x1f) +#define GET_b(pix) ((pix) & 0x1f) +#define ENCODE_PIXEL(e, pix) {encode(e, (pix) >> 8); encode(e, (pix) & 0xff);} + +#define HASH_FUNC(v, p) { \ + v = DJB2_START; \ + DJB2_HASH(v, p[0] & (0x00ff)); \ + DJB2_HASH(v, (p[0] >> 8) & (0x007f)); \ + DJB2_HASH(v, p[1]&(0x00ff)); \ + DJB2_HASH(v, (p[1] >> 8) & (0x007f)); \ + DJB2_HASH(v, p[2] & (0x00ff)); \ + DJB2_HASH(v, (p[2] >> 8) & (0x007f)); \ + v &= HASH_MASK; \ +} +#endif + +#ifdef LZ_RGB24 +#define PIXEL rgb24_pixel_t +#define FNAME(name) lz_rgb24_##name +#define ENCODE_PIXEL(e, pix) {encode(e, (pix).b); encode(e, (pix).g); encode(e, (pix).r);} +#endif + +#ifdef LZ_RGB32 +#define PIXEL rgb32_pixel_t +#define FNAME(name) lz_rgb32_##name +#define ENCODE_PIXEL(e, pix) {encode(e, (pix).b); encode(e, (pix).g); encode(e, (pix).r);} +#endif + + +#if defined(LZ_RGB24) || defined(LZ_RGB32) +#define GET_r(pix) ((pix).r) +#define GET_g(pix) ((pix).g) +#define GET_b(pix) ((pix).b) +#define HASH_FUNC(v, p) { \ + v = DJB2_START; \ + DJB2_HASH(v, p[0].r); \ + DJB2_HASH(v, p[0].g); \ + DJB2_HASH(v, p[0].b); \ + DJB2_HASH(v, p[1].r); \ + DJB2_HASH(v, p[1].g); \ + DJB2_HASH(v, p[1].b); \ + DJB2_HASH(v, p[2].r); \ + DJB2_HASH(v, p[2].g); \ + DJB2_HASH(v, p[2].b); \ + v &= HASH_MASK; \ + } +#endif + +#if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32) +#define SAME_PIXEL(p1, p2) (GET_r(p1) == GET_r(p2) && GET_g(p1) == GET_g(p2) && \ + GET_b(p1) == GET_b(p2)) + +#endif + +#define PIXEL_ID(pix_ptr, seg_ptr) (pix_ptr - ((PIXEL *)seg_ptr->lines) + seg_ptr->size_delta) + +// when encoding, the ref can be in previous segment, and we should check that it doesn't +// exceeds its bounds. +// TODO: optimization: when only one chunk exists or when the reference is in the same segment, +// don't make checks if we reach end of segments +// TODO: optimize to continue match between segments? +// TODO: check hash function +// TODO: check times + +/* compresses one segment starting from 'from'.*/ +static void FNAME(compress_seg)(Encoder *encoder, LzImageSegment *seg, PIXEL *from, int copied) +{ + const PIXEL *ip = from; + const PIXEL *ip_bound = (PIXEL *)(seg->lines_end) - BOUND_OFFSET; + const PIXEL *ip_limit = (PIXEL *)(seg->lines_end) - LIMIT_OFFSET; + HashEntry *hslot; + int hval; + int copy = copied; + + if (copy == 0) { + encode_copy_count(encoder, MAX_COPY - 1); + } + + + while (LZ_EXPECT_CONDITIONAL(ip < ip_limit)) { // TODO: maybe change ip_limit and enabling + // moving to the next seg + const PIXEL *ref; + const PIXEL *ref_limit; + size_t distance; + + /* minimum match length */ +#if defined(LZ_PLT) || defined(LZ_RGB_ALPHA) + size_t len = 3; +#elif defined(LZ_RGB16) + size_t len = 2; +#else + size_t len = 1; +#endif + /* comparison starting-point */ + const PIXEL *anchor = ip; + + + + // TODO: RLE without checking if not first byte. + // TODO: optimize comparisons + + /* check for a run */ // TODO for RGB we can use less pixels + if (LZ_EXPECT_CONDITIONAL(ip > (PIXEL *)(seg->lines))) { + if (SAME_PIXEL(ip[-1], ip[0]) && SAME_PIXEL(ip[0], ip[1]) && SAME_PIXEL(ip[1], ip[2])) { + distance = 1; + ip += 3; + ref = anchor + 2; + ref_limit = (PIXEL *)(seg->lines_end); +#if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32) + len = 3; +#endif + goto match; + } + } + + /* find potential match */ + HASH_FUNC(hval, ip); + hslot = encoder->htab + hval; + ref = (PIXEL *)(hslot->ref); + ref_limit = (PIXEL *)(hslot->image_seg->lines_end); + + /* calculate distance to the match */ + distance = PIXEL_ID(anchor, seg) - PIXEL_ID(ref, hslot->image_seg); + + /* update hash table */ + hslot->image_seg = seg; + hslot->ref = (uint8_t *)anchor; + + /* is this a match? check the first 3 pixels */ + if (distance == 0 || (distance >= MAX_FARDISTANCE)) { + goto literal; + } + /* check if the hval key identical*/ + // no need to check ref limit here because the word size in the htab is 3 pixels + if (!SAME_PIXEL(*ref, *ip)) { + ref++; + ip++; + goto literal; + } + ref++; + ip++; + + /* minimum match length for rgb16 is 2 and for plt and alpha is 3 */ +#if defined(LZ_PLT) || defined(LZ_RGB_ALPHA) || defined(LZ_RGB16) + if (!SAME_PIXEL(*ref, *ip)) { + ref++; + ip++; + goto literal; + } + ref++; + ip++; +#endif + +#if defined(LZ_PLT) || defined(LZ_RGB_ALPHA) + if (!SAME_PIXEL(*ref, *ip)) { + ref++; + ip++; + goto literal; + } + ref++; + ip++; +#endif + /* far, needs at least 5-byte match */ + if (distance >= MAX_DISTANCE) { +#if defined(LZ_PLT) || defined(LZ_RGB_ALPHA) + if (ref >= (ref_limit - 1)) { + goto literal; + } +#else + if (ref > (ref_limit - 1)) { + goto literal; + } +#endif + if (!SAME_PIXEL(*ref, *ip)) { + ref++; + ip++; + goto literal; + } + ref++; + ip++; + len++; +#if defined(LZ_PLT) || defined(LZ_RGB_ALPHA) + if (!SAME_PIXEL(*ref, *ip)) { + ref++; + ip++; + goto literal; + } + ref++; + ip++; + len++; +#endif + } +match: // RLE or dictionary (both are encoded by distance from ref (-1) and length) + + /* distance is biased */ + distance--; + + // ip is located now at the position of the second mismatch. + // later it will be subtracted by 3 + + if (!distance) { + /* zero distance means a run */ + PIXEL x = *ref; + while ((ip < ip_bound) && (ref < ref_limit)) { // TODO: maybe separate a run from + // the same seg or from different + // ones in order to spare + // ref < ref_limit + if (!SAME_PIXEL(*ref, x)) { + ref++; + break; + } else { + ref++; + ip++; + } + } + } else { + // TODO: maybe separate a run from the same seg or from different ones in order + // to spare ref < ref_limit and that way we can also perform 8 calls of + // (ref++ != ip++) outside a loop + for (;;) { + while ((ip < ip_bound) && (ref < ref_limit)) { + if (!SAME_PIXEL(*ref, *ip)) { + ref++; + ip++; + break; + } else { + ref++; + ip++; + } + } + break; + } + } + + /* if we have copied something, adjust the copy count */ + if (copy) { + /* copy is biased, '0' means 1 byte copy */ + update_copy_count(encoder, copy - 1); + } else { + /* back, to overwrite the copy count */ + compress_output_prev(encoder); + } + + /* reset literal counter */ + copy = 0; + + /* length is biased, '1' means a match of 3 pixels for PLT and alpha*/ + /* for RGB 16 1 means 2 */ + /* for RGB24/32 1 means 1...*/ + ip -= 3; + len = ip - anchor; +#if defined(LZ_RGB16) + len++; +#elif defined(LZ_RGB24) || defined(LZ_RGB32) + len += 2; +#endif + /* encode the match (like fastlz level 2)*/ + if (distance < MAX_DISTANCE) { // MAX_DISTANCE is 2^13 - 1 + // when copy is performed, the byte that holds the copy count is smaller than 32. + // When there is a reference, the first byte is always larger then 32 + + // 3 bits = length, 5 bits = 5 MSB of distance, 8 bits = 8 LSB of distance + if (len < 7) { + encode(encoder, (uint8_t)((len << 5) + (distance >> 8))); + encode(encoder, (uint8_t)(distance & 255)); + } else { // more than 3 bits are needed for length + // 3 bits 7, 5 bits = 5 MSB of distance, next bytes are 255 till we + // receive a smaller number, last byte = 8 LSB of distance + encode(encoder, (uint8_t)((7 << 5) + (distance >> 8))); + for (len -= 7; len >= 255; len -= 255) { + encode(encoder, 255); + } + encode(encoder, (uint8_t)len); + encode(encoder, (uint8_t)(distance & 255)); + } + } else { + /* far away */ + if (len < 7) { // the max_far_distance is ~2^16+2^13 so two more bytes are needed + // 3 bits = length, 5 bits = 5 MSB of MAX_DISTANCE, 8 bits = 8 LSB of MAX_DISTANCE, + // 8 bits = 8 MSB distance-MAX_distance (smaller than 2^16),8 bits=8 LSB of + // distance-MAX_distance + distance -= MAX_DISTANCE; + encode(encoder, (uint8_t)((len << 5) + 31)); + encode(encoder, (uint8_t)255); + encode(encoder, (uint8_t)(distance >> 8)); + encode(encoder, (uint8_t)(distance & 255)); + } else { + // same as before, but the first byte is followed by the left overs of len + distance -= MAX_DISTANCE; + encode(encoder, (uint8_t)((7 << 5) + 31)); + for (len -= 7; len >= 255; len -= 255) { + encode(encoder, 255); + } + encode(encoder, (uint8_t)len); + encode(encoder, 255); + encode(encoder, (uint8_t)(distance >> 8)); + encode(encoder, (uint8_t)(distance & 255)); + } + } + + /* update the hash at match boundary */ +#if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32) + if (ip > anchor) { +#endif + HASH_FUNC(hval, ip); + encoder->htab[hval].ref = (uint8_t *)ip; + ip++; + encoder->htab[hval].image_seg = seg; +#if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32) + } else {ip++; + } +#endif +#if defined(LZ_RGB24) || defined(LZ_RGB32) + if (ip > anchor) { +#endif + HASH_FUNC(hval, ip); + encoder->htab[hval].ref = (uint8_t *)ip; + ip++; + encoder->htab[hval].image_seg = seg; +#if defined(LZ_RGB24) || defined(LZ_RGB32) + } else {ip++; + } +#endif + /* assuming literal copy */ + encode_copy_count(encoder, MAX_COPY - 1); + continue; + +literal: + ENCODE_PIXEL(encoder, *anchor); + anchor++; + ip = anchor; + copy++; + + if (LZ_UNEXPECT_CONDITIONAL(copy == MAX_COPY)) { + copy = 0; + encode_copy_count(encoder, MAX_COPY - 1); + } + } // END LOOP (ip < ip_limit) + + + /* left-over as literal copy */ + ip_bound++; + while (ip <= ip_bound) { + ENCODE_PIXEL(encoder, *ip); + ip++; + copy++; + if (copy == MAX_COPY) { + copy = 0; + encode_copy_count(encoder, MAX_COPY - 1); + } + } + + /* if we have copied something, adjust the copy length */ + if (copy) { + update_copy_count(encoder, copy - 1); + } else { + compress_output_prev(encoder); // in case we created a new buffer for copy, check that + // red_worker could handle size that do not contain the + // ne buffer + } +} + + +/* initializes the hash table. if the file is very small, copies it. + copies the first two pixels of the first segment, and sends the segments + one by one to compress_seg. + the number of bytes compressed are stored inside encoder. + */ +static void FNAME(compress)(Encoder *encoder) +{ + LzImageSegment *cur_seg = encoder->head_image_segs; + HashEntry *hslot; + PIXEL *ip; + + // fetch the first image segment that is not too small + while (cur_seg && ((((PIXEL *)cur_seg->lines_end) - ((PIXEL *)cur_seg->lines)) < 4)) { + // coping the segment + if (cur_seg->lines != cur_seg->lines_end) { + ip = (PIXEL *)cur_seg->lines; + // Note: we assume MAX_COPY > 3 + encode_copy_count(encoder, (uint8_t)( + (((PIXEL *)cur_seg->lines_end) - ((PIXEL *)cur_seg->lines)) - 1)); + while (ip < (PIXEL *)cur_seg->lines_end) { + ENCODE_PIXEL(encoder, *ip); + ip++; + } + } + cur_seg = cur_seg->next; + } + + if (!cur_seg) { + return; + } + + ip = (PIXEL *)cur_seg->lines; + + /* initialize hash table */ + for (hslot = encoder->htab; hslot < encoder->htab + HASH_SIZE; hslot++) { + hslot->ref = (uint8_t*)ip; + hslot->image_seg = cur_seg; + } + + encode_copy_count(encoder, MAX_COPY - 1); + ENCODE_PIXEL(encoder, *ip); + ip++; + ENCODE_PIXEL(encoder, *ip); + ip++; + + // compressing the first segment + FNAME(compress_seg)(encoder, cur_seg, ip, 2); + + // compressing the next segments + for (cur_seg = cur_seg->next; cur_seg; cur_seg = cur_seg->next) { + FNAME(compress_seg)(encoder, cur_seg, (PIXEL *)cur_seg->lines, 0); + } +} + +#undef FNAME +#undef PIXEL_ID +#undef PIXEL +#undef ENCODE_PIXEL +#undef SAME_PIXEL +#undef LZ_READU16 +#undef HASH_FUNC +#undef BYTES_TO_16 +#undef HASH_FUNC_16 +#undef GET_r +#undef GET_g +#undef GET_b +#undef GET_CODE +#undef LZ_PLT +#undef LZ_RGB_ALPHA +#undef LZ_RGB16 +#undef LZ_RGB24 +#undef LZ_RGB32 +#undef HASH_FUNC2 diff -Nru spice-gtk-0.9/spice-common/common/lz_config.h spice-gtk-0.12/spice-common/common/lz_config.h --- spice-gtk-0.9/spice-common/common/lz_config.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/lz_config.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,39 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef __LZ_CONFIG_H +#define __LZ_CONFIG_H + +#include +#include + +#ifdef __GNUC__ +#include +#else +#ifdef QXLDD +#include +#include "os_dep.h" +#else +#include +#include +#endif // QXLDD +#endif //__GNUC__ + +#endif //__LZ_CONFIG_H diff -Nru spice-gtk-0.9/spice-common/common/lz_decompress_tmpl.c spice-gtk-0.12/spice-common/common/lz_decompress_tmpl.c --- spice-gtk-0.9/spice-common/common/lz_decompress_tmpl.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/lz_decompress_tmpl.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,326 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + + Copyright (C) 2009 Red Hat, Inc. and/or its affiliates. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . + + This file incorporates work covered by the following copyright and + permission notice: + Copyright (C) 2007 Ariya Hidayat (ariya@kde.org) + Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) + Copyright (C) 2005 Ariya Hidayat (ariya@kde.org) + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +*/ + +// External defines: PLT, RGBX/PLTXX/ALPHA, TO_RGB32. +// If PLT4/1 and TO_RGB32 are defined, we need CAST_PLT_DISTANCE (because then the number of +// pixels differ from the units used in the compression) + +/* + For each output pixel type the following macros are defined: + OUT_PIXEL - the output pixel type + COPY_PIXEL(p, out) - assigns the pixel to the place pointed by out and increases + out. Used in RLE. Need special handling because in alpha we + copy only the pad byte. + COPY_REF_PIXEL(ref, out) - copies the pixel pointed by ref to the pixel pointed by out. + Increases ref and out. + COPY_COMP_PIXEL(encoder, out) - copies pixel from the compressed buffer to the decompressed + buffer. Increases out. +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#if !defined(LZ_RGB_ALPHA) +#define COPY_PIXEL(p, out) (*out++ = p) +#define COPY_REF_PIXEL(ref, out) (*out++ = *ref++) +#endif + + +// decompressing plt to plt +#ifdef LZ_PLT +#ifndef TO_RGB32 +#define OUT_PIXEL one_byte_pixel_t +#define FNAME(name) lz_plt_##name +#define COPY_COMP_PIXEL(encoder, out) {out->a = decode(encoder); out++;} +#else // TO_RGB32 +#define OUT_PIXEL rgb32_pixel_t +#define COPY_PLT_ENTRY(ent, out) { \ + (out)->b = ent; \ + (out)->g = (ent >> 8); \ + (out)->r = (ent >> 16); \ + (out)->pad = 0; \ +} +#ifdef PLT8 +#define FNAME(name) lz_plt8_to_rgb32_##name +#define COPY_COMP_PIXEL(encoder, out) { \ + uint32_t rgb = encoder->palette->ents[decode(encoder)]; \ + COPY_PLT_ENTRY(rgb, out); \ + out++;} +#elif defined(PLT4_BE) +#define FNAME(name) lz_plt4_be_to_rgb32_##name +#define COPY_COMP_PIXEL(encoder, out){ \ + uint8_t byte = decode(encoder); \ + uint32_t rgb = encoder->palette->ents[((byte >> 4) & 0x0f) % (encoder->palette->num_ents)]; \ + COPY_PLT_ENTRY(rgb, out); \ + out++; \ + rgb = encoder->palette->ents[(byte & 0x0f) % (encoder->palette->num_ents)]; \ + COPY_PLT_ENTRY(rgb, out); \ + out++; \ +} +#define CAST_PLT_DISTANCE(dist) (dist*2) +#elif defined(PLT4_LE) +#define FNAME(name) lz_plt4_le_to_rgb32_##name +#define COPY_COMP_PIXEL(encoder, out){ \ + uint8_t byte = decode(encoder); \ + uint32_t rgb = encoder->palette->ents[(byte & 0x0f) % (encoder->palette->num_ents)]; \ + COPY_PLT_ENTRY(rgb, out); \ + out++; \ + rgb = encoder->palette->ents[((byte >> 4) & 0x0f) % (encoder->palette->num_ents)]; \ + COPY_PLT_ENTRY(rgb, out); \ + out++; \ +} +#define CAST_PLT_DISTANCE(dist) (dist*2) +#elif defined(PLT1_BE) // TODO store palette entries for direct access +#define FNAME(name) lz_plt1_be_to_rgb32_##name +#define COPY_COMP_PIXEL(encoder, out){ \ + uint8_t byte = decode(encoder); \ + int i; \ + uint32_t fore = encoder->palette->ents[1]; \ + uint32_t back = encoder->palette->ents[0]; \ + for (i = 7; i >= 0; i--) \ + { \ + if ((byte >> i) & 1) { \ + COPY_PLT_ENTRY(fore, out); \ + } else { \ + COPY_PLT_ENTRY(back, out); \ + } \ + out++; \ + } \ +} +#define CAST_PLT_DISTANCE(dist) (dist*8) +#elif defined(PLT1_LE) +#define FNAME(name) lz_plt1_le_to_rgb32_##name +#define COPY_COMP_PIXEL(encoder, out){ \ + uint8_t byte = decode(encoder); \ + int i; \ + uint32_t fore = encoder->palette->ents[1]; \ + uint32_t back = encoder->palette->ents[0]; \ + for (i = 0; i < 8; i++) \ + { \ + if ((byte >> i) & 1) { \ + COPY_PLT_ENTRY(fore, out); \ + } else { \ + COPY_PLT_ENTRY(back, out); \ + } \ + out++; \ + } \ +} +#define CAST_PLT_DISTANCE(dist) (dist*8) +#endif // PLT Type +#endif // TO_RGB32 +#endif + +#ifdef LZ_RGB16 +#ifndef TO_RGB32 +#define OUT_PIXEL rgb16_pixel_t +#define FNAME(name) lz_rgb16_##name +#define COPY_COMP_PIXEL(e, out) {*out = ((decode(e) << 8) | decode(e)); out++;} +#else +#define OUT_PIXEL rgb32_pixel_t +#define FNAME(name) lz_rgb16_to_rgb32_##name +#define COPY_COMP_PIXEL(e, out) { \ + out->r = decode(e); \ + out->b = decode(e); \ + out->g = (((out->r) << 6) | ((out->b) >> 2)) & ~0x07; \ + out->g |= (out->g >> 5); \ + out->r = ((out->r << 1) & ~0x07)| ((out->r >> 4) & 0x07); \ + out->b = (out->b << 3) | ((out->b >> 2) & 0x07); \ + out->pad = 0; \ + out++; \ +} +#endif +#endif + +#ifdef LZ_RGB24 +#define OUT_PIXEL rgb24_pixel_t +#define FNAME(name) lz_rgb24_##name +#define COPY_COMP_PIXEL(e, out) {out->b = decode(e); out->g = decode(e); out->r = decode(e); out++;} +#endif + +#ifdef LZ_RGB32 +#define OUT_PIXEL rgb32_pixel_t +#define FNAME(name) lz_rgb32_##name +#define COPY_COMP_PIXEL(e, out) { \ + out->b = decode(e); \ + out->g = decode(e); \ + out->r = decode(e); \ + out->pad = 0; \ + out++; \ +} +#endif + +#ifdef LZ_RGB_ALPHA +#define OUT_PIXEL rgb32_pixel_t +#define FNAME(name) lz_rgb_alpha_##name +#define COPY_PIXEL(p, out) {out->pad = p.pad; out++;} +#define COPY_REF_PIXEL(ref, out) {out->pad = ref->pad; out++; ref++;} +#define COPY_COMP_PIXEL(e, out) {out->pad = decode(e); out++;} +#endif + +// return num of bytes in out_buf +static size_t FNAME(decompress)(Encoder *encoder, OUT_PIXEL *out_buf, int size) +{ + OUT_PIXEL *op = out_buf; + OUT_PIXEL *op_limit = out_buf + size; + uint32_t ctrl = decode(encoder); + int loop = TRUE; + + do { + const OUT_PIXEL *ref = op; + uint32_t len = ctrl >> 5; + uint32_t ofs = (ctrl & 31) << 8; // 5 MSb of distance + + if (ctrl >= MAX_COPY) { // reference (dictionary/RLE) + /* retrieving the reference and the match length */ + + uint8_t code; + len--; + //ref -= ofs; + if (len == 7 - 1) { // match length is bigger than 7 + do { + code = decode(encoder); + len += code; + } while (code == 255); // remaining of len + } + code = decode(encoder); + ofs += code; + + /* match from 16-bit distance */ + if (LZ_UNEXPECT_CONDITIONAL(code == 255)) { + if (LZ_EXPECT_CONDITIONAL((ofs - code) == (31 << 8))) { + ofs = decode(encoder) << 8; + ofs += decode(encoder); + ofs += MAX_DISTANCE; + } + } + +#if defined(LZ_PLT) || defined(LZ_RGB_ALPHA) + len += 3; // length is biased by 2 + 1 (fixing bias) +#elif defined(LZ_RGB16) + len += 2; // length is biased by 1 + 1 (fixing bias) +#else + len += 1; +#endif + ofs += 1; // offset is biased by 1 (fixing bias) + +#if defined(TO_RGB32) +#if defined(PLT4_BE) || defined(PLT4_LE) || defined(PLT1_BE) || defined(PLT1_LE) + ofs = CAST_PLT_DISTANCE(ofs); + len = CAST_PLT_DISTANCE(len); +#endif +#endif + ref -= ofs; + + spice_assert(op + len <= op_limit); + spice_assert(ref + len <= op_limit); + spice_assert(ref >= out_buf); + + // TODO: optimize by not calling loop at least 3 times when not PLT_TO_RGB32 (len is + // always >=3). in PLT_TO_RGB32 len >= 3*number_of_pixels_per_byte + + /* copying the match*/ + + if (ref == (op - 1)) { // run // TODO: this will never be called in PLT4/1_TO_RGB + // because the number of pixel copied is larger + // then one... + /* optimize copy for a run */ + OUT_PIXEL b = *ref; + for (; len; --len) { + COPY_PIXEL(b, op); + spice_assert(op <= op_limit); + } + } else { + for (; len; --len) { + COPY_REF_PIXEL(ref, op); + spice_assert(op <= op_limit); + } + } + } else { // copy + ctrl++; // copy count is biased by 1 +#if defined(TO_RGB32) && (defined(PLT4_BE) || defined(PLT4_LE) || defined(PLT1_BE) || \ + defined(PLT1_LE)) + spice_assert(op + CAST_PLT_DISTANCE(ctrl) <= op_limit); +#else + spice_assert(op + ctrl <= op_limit); +#endif + COPY_COMP_PIXEL(encoder, op); + + spice_assert(op <= op_limit); + + for (--ctrl; ctrl; ctrl--) { + COPY_COMP_PIXEL(encoder, op); + spice_assert(op <= op_limit); + } + } + + if (LZ_EXPECT_CONDITIONAL(op < op_limit)) { + ctrl = decode(encoder); + } else { + loop = FALSE; + } + } while (LZ_EXPECT_CONDITIONAL(loop)); + + return (op - out_buf); +} + +#undef LZ_PLT +#undef PLT8 +#undef PLT4_BE +#undef PLT4_LE +#undef PLT1_BE +#undef PLT1_LE +#undef LZ_RGB16 +#undef LZ_RGB24 +#undef LZ_RGB32 +#undef LZ_RGB_ALPHA +#undef TO_RGB32 +#undef OUT_PIXEL +#undef FNAME +#undef COPY_PIXEL +#undef COPY_REF_PIXEL +#undef COPY_COMP_PIXEL +#undef COPY_PLT_ENTRY +#undef CAST_PLT_DISTANCE diff -Nru spice-gtk-0.9/spice-common/common/lz.h spice-gtk-0.12/spice-common/common/lz.h --- spice-gtk-0.9/spice-common/common/lz.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/lz.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,81 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + dictionary compression for images based on fastlz (http://www.fastlz.org/) + (Distributed under MIT license). +*/ +#ifndef __LZ_H +#define __LZ_H + +#include + +#include "lz_common.h" +#include "lz_config.h" +#include "draw.h" +#include "macros.h" + +SPICE_BEGIN_DECLS + +typedef void *LzContext; + +typedef struct LzUsrContext LzUsrContext; +struct LzUsrContext { + SPICE_ATTR_PRINTF(2, 3) void (*error)(LzUsrContext *usr, const char *fmt, ...); + SPICE_ATTR_PRINTF(2, 3) void (*warn)(LzUsrContext *usr, const char *fmt, ...); + SPICE_ATTR_PRINTF(2, 3) void (*info)(LzUsrContext *usr, const char *fmt, ...); + void *(*malloc)(LzUsrContext *usr, int size); + void (*free)(LzUsrContext *usr, void *ptr); + int (*more_space)(LzUsrContext *usr, uint8_t **io_ptr); // get the next chunk of the + // compressed buffer. return + // number of bytes in the chunk. + int (*more_lines)(LzUsrContext *usr, uint8_t **lines); // get the next chunk of the + // original image. If the image + // is down to top, return it from + // the last line to the first one + // (stride should always be + // positive) +}; + +/* + assumes width is in pixels and stride is in bytes + return: the number of bytes in the compressed data + + TODO : determine size limit for the first segment and each chunk. check validity + of the segment or go to literal copy. + TODO : currently support only rgb images in which width*bytes_per_pixel = stride OR + palette images in which stride equals the min number of bytes to + hold a line. stride is not necessary for now. just for sanity check. + stride should be > 0 +*/ +int lz_encode(LzContext *lz, LzImageType type, int width, int height, int top_down, + uint8_t *lines, unsigned int num_lines, int stride, + uint8_t *io_ptr, unsigned int num_io_bytes); + +/* + prepare encoder and read lz magic. + out_n_pixels number of compressed pixels. May differ from Width*height in plt1/4. + Use it for allocation the decompressed buffer. + +*/ +void lz_decode_begin(LzContext *lz, uint8_t *io_ptr, unsigned int num_io_bytes, + LzImageType *out_type, int *out_width, int *out_height, + int *out_n_pixels, int *out_top_down, const SpicePalette *palette); + +/* + to_type = the image output type. + We assume the buffer is consecutive. i.e. width = stride + + Important: if the image is plt1/4 and to_type is rgb32, the image + will decompressed including the last bits in each line. This means buffer should be + larger than width*height if needed and you should use stride to fix it. + Note: If the image is down to top, set the stride in the sw surface to negative. + use alloc_lz_image_surface create the surface. +*/ +void lz_decode(LzContext *lz, LzImageType to_type, uint8_t *buf); + +LzContext *lz_create(LzUsrContext *usr); + +void lz_destroy(LzContext *lz); + +SPICE_END_DECLS + +#endif // __LZ_H diff -Nru spice-gtk-0.9/spice-common/common/macros.h spice-gtk-0.12/spice-common/common/macros.h --- spice-gtk-0.9/spice-common/common/macros.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/macros.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,37 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef __MACROS_H +#define __MACROS_H + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +#define SPICE_ATTR_PRINTF(a,b) \ + __attribute__((format(printf,a,b))) +#else +#define SPICE_ATTR_PRINTF(a,b) +#endif /* __GNUC__ */ + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5) +#define SPICE_ATTR_NORETURN \ + __attribute__((noreturn)) +#else +#define SPICE_ATTR_NORETURN +#endif /* __GNUC__ */ + + +#endif /* __MACROS_H */ diff -Nru spice-gtk-0.9/spice-common/common/Makefile.am spice-gtk-0.12/spice-common/common/Makefile.am --- spice-gtk-0.9/spice-common/common/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/Makefile.am 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,143 @@ +NULL = + +# Avoid need for python(pyparsing) by end users +CLIENT_MARSHALLERS = \ + $(srcdir)/generated_client_demarshallers.c \ + $(srcdir)/generated_client_demarshallers1.c \ + $(srcdir)/generated_client_marshallers.c \ + $(srcdir)/generated_client_marshallers1.c \ + $(NULL) + +SERVER_MARSHALLERS = \ + $(srcdir)/generated_server_demarshallers.c \ + $(srcdir)/generated_server_marshallers.c \ + $(srcdir)/generated_server_marshallers.h \ + $(NULL) + +BUILT_SOURCES = $(CLIENT_MARSHALLERS) $(SERVER_MARSHALLERS) + +noinst_LTLIBRARIES = libspice-common.la libspice-common-server.la libspice-common-client.la +libspice_common_la_SOURCES = \ + backtrace.c \ + backtrace.h \ + bitops.h \ + canvas_utils.c \ + canvas_utils.h \ + client_demarshallers.h \ + client_marshallers.h \ + draw.h \ + lines.c \ + lines.h \ + log.c \ + log.h \ + lz.c \ + lz.h \ + lz_common.h \ + lz_config.h \ + macros.h \ + marshaller.c \ + marshaller.h \ + mem.c \ + mem.h \ + messages.h \ + mutex.h \ + pixman_utils.c \ + pixman_utils.h \ + quic.c \ + quic.h \ + quic_config.h \ + rect.h \ + region.c \ + region.h \ + ring.h \ + rop3.c \ + rop3.h \ + spice_common.h \ + ssl_verify.c \ + ssl_verify.h \ + $(NULL) + +libspice_common_client_la_SOURCES = \ + $(CLIENT_MARSHALLERS) \ + $(NULL) + +libspice_common_server_la_SOURCES = \ + $(SERVER_MARSHALLERS) \ + $(NULL) + +libspice_common_server_la_CFLAGS = -DFIXME_SERVER_SMARTCARD + +if SUPPORT_GL +libspice_common_la_SOURCES += \ + gl_utils.h \ + glc.c \ + glc.h \ + ogl_ctx.c \ + ogl_ctx.h \ + $(NULL) +endif + +AM_CPPFLAGS = \ + $(GL_CFLAGS) \ + $(PIXMAN_CFLAGS) \ + $(PROTOCOL_CFLAGS) \ + $(SMARTCARD_CFLAGS) \ + $(VISIBILITY_HIDDEN_CFLAGS) \ + $(WARN_CFLAGS) \ + -std=gnu99 \ + $(NULL) + +MARSHALLERS_DEPS = \ + $(top_srcdir)/python_modules/__init__.py \ + $(top_srcdir)/python_modules/codegen.py \ + $(top_srcdir)/python_modules/demarshal.py \ + $(top_srcdir)/python_modules/marshal.py \ + $(top_srcdir)/python_modules/ptypes.py \ + $(top_srcdir)/python_modules/spice_parser.py \ + $(top_srcdir)/spice_codegen.py \ + Makefile \ + $(NULL) + +# Note despite being autogenerated these are not part of CLEANFILES, they are +# actually a part of EXTRA_DIST, to avoid the need for pyparser by end users +generated_client_demarshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS) + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include messages.h $< $@ >/dev/null + +generated_client_demarshallers1.c: $(top_srcdir)/spice1.proto $(MARSHALLERS_DEPS) + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include messages.h --prefix 1 --ptrsize 8 $< $@ >/dev/null + +generated_client_marshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS) + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include messages.h --include client_marshallers.h --client $< $@ >/dev/null + +generated_client_marshallers1.c: $(top_srcdir)/spice1.proto $(MARSHALLERS_DEPS) + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include messages.h --include client_marshallers.h --client --prefix 1 --ptrsize 8 $< $@ >/dev/null + +generated_server_demarshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS) + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --server --include messages.h $< $@ >/dev/null + +STRUCTS = -M String -M Rect -M Point -M DisplayBase -M Fill -M Opaque -M Copy -M Blend -M Blackness -M Whiteness -M Invers -M Rop3 -M Stroke -M Text -M Transparent -M AlphaBlend +generated_server_marshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS) + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers $(STRUCTS) --server --include messages.h $< $@ >/dev/null + +generated_server_marshallers.h: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS) + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers $(STRUCTS) --server --include messages.h -H $< $@ >/dev/null + +EXTRA_DIST = \ + $(CLIENT_MARSHALLERS) \ + $(SERVER_MARSHALLERS) \ + canvas_base.c \ + canvas_base.h \ + gdi_canvas.c \ + gdi_canvas.h \ + gl_canvas.c \ + gl_canvas.h \ + lz_compress_tmpl.c \ + lz_decompress_tmpl.c \ + quic_family_tmpl.c \ + quic_rgb_tmpl.c \ + quic_tmpl.c \ + sw_canvas.c \ + sw_canvas.h \ + $(NULL) + +-include $(top_srcdir)/git.mk diff -Nru spice-gtk-0.9/spice-common/common/Makefile.in spice-gtk-0.12/spice-common/common/Makefile.in --- spice-gtk-0.9/spice-common/common/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/Makefile.in 2012-04-24 11:20:55.000000000 +0000 @@ -0,0 +1,717 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@SUPPORT_GL_TRUE@am__append_1 = \ +@SUPPORT_GL_TRUE@ gl_utils.h \ +@SUPPORT_GL_TRUE@ glc.c \ +@SUPPORT_GL_TRUE@ glc.h \ +@SUPPORT_GL_TRUE@ ogl_ctx.c \ +@SUPPORT_GL_TRUE@ ogl_ctx.h \ +@SUPPORT_GL_TRUE@ $(NULL) + +subdir = common +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libspice_common_client_la_LIBADD = +am__objects_1 = +am__objects_2 = generated_client_demarshallers.lo \ + generated_client_demarshallers1.lo \ + generated_client_marshallers.lo \ + generated_client_marshallers1.lo $(am__objects_1) +am_libspice_common_client_la_OBJECTS = $(am__objects_2) \ + $(am__objects_1) +libspice_common_client_la_OBJECTS = \ + $(am_libspice_common_client_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +libspice_common_server_la_LIBADD = +am__objects_3 = \ + libspice_common_server_la-generated_server_demarshallers.lo \ + libspice_common_server_la-generated_server_marshallers.lo \ + $(am__objects_1) +am_libspice_common_server_la_OBJECTS = $(am__objects_3) \ + $(am__objects_1) +libspice_common_server_la_OBJECTS = \ + $(am_libspice_common_server_la_OBJECTS) +libspice_common_server_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libspice_common_server_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +libspice_common_la_LIBADD = +am__libspice_common_la_SOURCES_DIST = backtrace.c backtrace.h bitops.h \ + canvas_utils.c canvas_utils.h client_demarshallers.h \ + client_marshallers.h draw.h lines.c lines.h log.c log.h lz.c \ + lz.h lz_common.h lz_config.h macros.h marshaller.c \ + marshaller.h mem.c mem.h messages.h mutex.h pixman_utils.c \ + pixman_utils.h quic.c quic.h quic_config.h rect.h region.c \ + region.h ring.h rop3.c rop3.h spice_common.h ssl_verify.c \ + ssl_verify.h gl_utils.h glc.c glc.h ogl_ctx.c ogl_ctx.h +@SUPPORT_GL_TRUE@am__objects_4 = glc.lo ogl_ctx.lo $(am__objects_1) +am_libspice_common_la_OBJECTS = backtrace.lo canvas_utils.lo lines.lo \ + log.lo lz.lo marshaller.lo mem.lo pixman_utils.lo quic.lo \ + region.lo rop3.lo ssl_verify.lo $(am__objects_1) \ + $(am__objects_4) +libspice_common_la_OBJECTS = $(am_libspice_common_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libspice_common_client_la_SOURCES) \ + $(libspice_common_server_la_SOURCES) \ + $(libspice_common_la_SOURCES) +DIST_SOURCES = $(libspice_common_client_la_SOURCES) \ + $(libspice_common_server_la_SOURCES) \ + $(am__libspice_common_la_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PROTOCOL_CFLAGS = @PROTOCOL_CFLAGS@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SMARTCARD_CFLAGS = @SMARTCARD_CFLAGS@ +SMARTCARD_LIBS = @SMARTCARD_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = + +# Avoid need for python(pyparsing) by end users +CLIENT_MARSHALLERS = \ + $(srcdir)/generated_client_demarshallers.c \ + $(srcdir)/generated_client_demarshallers1.c \ + $(srcdir)/generated_client_marshallers.c \ + $(srcdir)/generated_client_marshallers1.c \ + $(NULL) + +SERVER_MARSHALLERS = \ + $(srcdir)/generated_server_demarshallers.c \ + $(srcdir)/generated_server_marshallers.c \ + $(srcdir)/generated_server_marshallers.h \ + $(NULL) + +BUILT_SOURCES = $(CLIENT_MARSHALLERS) $(SERVER_MARSHALLERS) +noinst_LTLIBRARIES = libspice-common.la libspice-common-server.la libspice-common-client.la +libspice_common_la_SOURCES = backtrace.c backtrace.h bitops.h \ + canvas_utils.c canvas_utils.h client_demarshallers.h \ + client_marshallers.h draw.h lines.c lines.h log.c log.h lz.c \ + lz.h lz_common.h lz_config.h macros.h marshaller.c \ + marshaller.h mem.c mem.h messages.h mutex.h pixman_utils.c \ + pixman_utils.h quic.c quic.h quic_config.h rect.h region.c \ + region.h ring.h rop3.c rop3.h spice_common.h ssl_verify.c \ + ssl_verify.h $(NULL) $(am__append_1) +libspice_common_client_la_SOURCES = \ + $(CLIENT_MARSHALLERS) \ + $(NULL) + +libspice_common_server_la_SOURCES = \ + $(SERVER_MARSHALLERS) \ + $(NULL) + +libspice_common_server_la_CFLAGS = -DFIXME_SERVER_SMARTCARD +AM_CPPFLAGS = \ + $(GL_CFLAGS) \ + $(PIXMAN_CFLAGS) \ + $(PROTOCOL_CFLAGS) \ + $(SMARTCARD_CFLAGS) \ + $(VISIBILITY_HIDDEN_CFLAGS) \ + $(WARN_CFLAGS) \ + -std=gnu99 \ + $(NULL) + +MARSHALLERS_DEPS = \ + $(top_srcdir)/python_modules/__init__.py \ + $(top_srcdir)/python_modules/codegen.py \ + $(top_srcdir)/python_modules/demarshal.py \ + $(top_srcdir)/python_modules/marshal.py \ + $(top_srcdir)/python_modules/ptypes.py \ + $(top_srcdir)/python_modules/spice_parser.py \ + $(top_srcdir)/spice_codegen.py \ + Makefile \ + $(NULL) + +STRUCTS = -M String -M Rect -M Point -M DisplayBase -M Fill -M Opaque -M Copy -M Blend -M Blackness -M Whiteness -M Invers -M Rop3 -M Stroke -M Text -M Transparent -M AlphaBlend +EXTRA_DIST = \ + $(CLIENT_MARSHALLERS) \ + $(SERVER_MARSHALLERS) \ + canvas_base.c \ + canvas_base.h \ + gdi_canvas.c \ + gdi_canvas.h \ + gl_canvas.c \ + gl_canvas.h \ + lz_compress_tmpl.c \ + lz_decompress_tmpl.c \ + quic_family_tmpl.c \ + quic_rgb_tmpl.c \ + quic_tmpl.c \ + sw_canvas.c \ + sw_canvas.h \ + $(NULL) + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign common/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign common/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libspice-common-client.la: $(libspice_common_client_la_OBJECTS) $(libspice_common_client_la_DEPENDENCIES) $(EXTRA_libspice_common_client_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libspice_common_client_la_OBJECTS) $(libspice_common_client_la_LIBADD) $(LIBS) +libspice-common-server.la: $(libspice_common_server_la_OBJECTS) $(libspice_common_server_la_DEPENDENCIES) $(EXTRA_libspice_common_server_la_DEPENDENCIES) + $(AM_V_CCLD)$(libspice_common_server_la_LINK) $(libspice_common_server_la_OBJECTS) $(libspice_common_server_la_LIBADD) $(LIBS) +libspice-common.la: $(libspice_common_la_OBJECTS) $(libspice_common_la_DEPENDENCIES) $(EXTRA_libspice_common_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libspice_common_la_OBJECTS) $(libspice_common_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/backtrace.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canvas_utils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generated_client_demarshallers.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generated_client_demarshallers1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generated_client_marshallers.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generated_client_marshallers1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libspice_common_server_la-generated_server_demarshallers.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libspice_common_server_la-generated_server_marshallers.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lines.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lz.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/marshaller.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogl_ctx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman_utils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quic.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/region.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rop3.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_verify.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +generated_client_demarshallers.lo: $(srcdir)/generated_client_demarshallers.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT generated_client_demarshallers.lo -MD -MP -MF $(DEPDIR)/generated_client_demarshallers.Tpo -c -o generated_client_demarshallers.lo `test -f '$(srcdir)/generated_client_demarshallers.c' || echo '$(srcdir)/'`$(srcdir)/generated_client_demarshallers.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/generated_client_demarshallers.Tpo $(DEPDIR)/generated_client_demarshallers.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/generated_client_demarshallers.c' object='generated_client_demarshallers.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o generated_client_demarshallers.lo `test -f '$(srcdir)/generated_client_demarshallers.c' || echo '$(srcdir)/'`$(srcdir)/generated_client_demarshallers.c + +generated_client_demarshallers1.lo: $(srcdir)/generated_client_demarshallers1.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT generated_client_demarshallers1.lo -MD -MP -MF $(DEPDIR)/generated_client_demarshallers1.Tpo -c -o generated_client_demarshallers1.lo `test -f '$(srcdir)/generated_client_demarshallers1.c' || echo '$(srcdir)/'`$(srcdir)/generated_client_demarshallers1.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/generated_client_demarshallers1.Tpo $(DEPDIR)/generated_client_demarshallers1.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/generated_client_demarshallers1.c' object='generated_client_demarshallers1.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o generated_client_demarshallers1.lo `test -f '$(srcdir)/generated_client_demarshallers1.c' || echo '$(srcdir)/'`$(srcdir)/generated_client_demarshallers1.c + +generated_client_marshallers.lo: $(srcdir)/generated_client_marshallers.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT generated_client_marshallers.lo -MD -MP -MF $(DEPDIR)/generated_client_marshallers.Tpo -c -o generated_client_marshallers.lo `test -f '$(srcdir)/generated_client_marshallers.c' || echo '$(srcdir)/'`$(srcdir)/generated_client_marshallers.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/generated_client_marshallers.Tpo $(DEPDIR)/generated_client_marshallers.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/generated_client_marshallers.c' object='generated_client_marshallers.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o generated_client_marshallers.lo `test -f '$(srcdir)/generated_client_marshallers.c' || echo '$(srcdir)/'`$(srcdir)/generated_client_marshallers.c + +generated_client_marshallers1.lo: $(srcdir)/generated_client_marshallers1.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT generated_client_marshallers1.lo -MD -MP -MF $(DEPDIR)/generated_client_marshallers1.Tpo -c -o generated_client_marshallers1.lo `test -f '$(srcdir)/generated_client_marshallers1.c' || echo '$(srcdir)/'`$(srcdir)/generated_client_marshallers1.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/generated_client_marshallers1.Tpo $(DEPDIR)/generated_client_marshallers1.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/generated_client_marshallers1.c' object='generated_client_marshallers1.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o generated_client_marshallers1.lo `test -f '$(srcdir)/generated_client_marshallers1.c' || echo '$(srcdir)/'`$(srcdir)/generated_client_marshallers1.c + +libspice_common_server_la-generated_server_demarshallers.lo: $(srcdir)/generated_server_demarshallers.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libspice_common_server_la_CFLAGS) $(CFLAGS) -MT libspice_common_server_la-generated_server_demarshallers.lo -MD -MP -MF $(DEPDIR)/libspice_common_server_la-generated_server_demarshallers.Tpo -c -o libspice_common_server_la-generated_server_demarshallers.lo `test -f '$(srcdir)/generated_server_demarshallers.c' || echo '$(srcdir)/'`$(srcdir)/generated_server_demarshallers.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libspice_common_server_la-generated_server_demarshallers.Tpo $(DEPDIR)/libspice_common_server_la-generated_server_demarshallers.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/generated_server_demarshallers.c' object='libspice_common_server_la-generated_server_demarshallers.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libspice_common_server_la_CFLAGS) $(CFLAGS) -c -o libspice_common_server_la-generated_server_demarshallers.lo `test -f '$(srcdir)/generated_server_demarshallers.c' || echo '$(srcdir)/'`$(srcdir)/generated_server_demarshallers.c + +libspice_common_server_la-generated_server_marshallers.lo: $(srcdir)/generated_server_marshallers.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libspice_common_server_la_CFLAGS) $(CFLAGS) -MT libspice_common_server_la-generated_server_marshallers.lo -MD -MP -MF $(DEPDIR)/libspice_common_server_la-generated_server_marshallers.Tpo -c -o libspice_common_server_la-generated_server_marshallers.lo `test -f '$(srcdir)/generated_server_marshallers.c' || echo '$(srcdir)/'`$(srcdir)/generated_server_marshallers.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libspice_common_server_la-generated_server_marshallers.Tpo $(DEPDIR)/libspice_common_server_la-generated_server_marshallers.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/generated_server_marshallers.c' object='libspice_common_server_la-generated_server_marshallers.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libspice_common_server_la_CFLAGS) $(CFLAGS) -c -o libspice_common_server_la-generated_server_marshallers.lo `test -f '$(srcdir)/generated_server_marshallers.c' || echo '$(srcdir)/'`$(srcdir)/generated_server_marshallers.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: all check install install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + + +# Note despite being autogenerated these are not part of CLEANFILES, they are +# actually a part of EXTRA_DIST, to avoid the need for pyparser by end users +generated_client_demarshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS) + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include messages.h $< $@ >/dev/null + +generated_client_demarshallers1.c: $(top_srcdir)/spice1.proto $(MARSHALLERS_DEPS) + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include messages.h --prefix 1 --ptrsize 8 $< $@ >/dev/null + +generated_client_marshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS) + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include messages.h --include client_marshallers.h --client $< $@ >/dev/null + +generated_client_marshallers1.c: $(top_srcdir)/spice1.proto $(MARSHALLERS_DEPS) + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include messages.h --include client_marshallers.h --client --prefix 1 --ptrsize 8 $< $@ >/dev/null + +generated_server_demarshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS) + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --server --include messages.h $< $@ >/dev/null +generated_server_marshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS) + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers $(STRUCTS) --server --include messages.h $< $@ >/dev/null + +generated_server_marshallers.h: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS) + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers $(STRUCTS) --server --include messages.h -H $< $@ >/dev/null + +-include $(top_srcdir)/git.mk + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru spice-gtk-0.9/spice-common/common/marshaller.c spice-gtk-0.12/spice-common/common/marshaller.c --- spice-gtk-0.9/spice-common/common/marshaller.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/marshaller.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,615 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2010 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "marshaller.h" +#include "mem.h" +#include +#include +#include + +#ifdef WORDS_BIGENDIAN +#define write_int8(ptr,v) (*((int8_t *)(ptr)) = v) +#define write_uint8(ptr,v) (*((uint8_t *)(ptr)) = v) +#define write_int16(ptr,v) (*((int16_t *)(ptr)) = SPICE_BYTESWAP16((uint16_t)(v))) +#define write_uint16(ptr,v) (*((uint16_t *)(ptr)) = SPICE_BYTESWAP16((uint16_t)(v))) +#define write_int32(ptr,v) (*((int32_t *)(ptr)) = SPICE_BYTESWAP32((uint32_t)(v))) +#define write_uint32(ptr,v) (*((uint32_t *)(ptr)) = SPICE_BYTESWAP32((uint32_t)(v))) +#define write_int64(ptr,v) (*((int64_t *)(ptr)) = SPICE_BYTESWAP64((uint64_t)(v))) +#define write_uint64(ptr,v) (*((uint64_t *)(ptr)) = SPICE_BYTESWAP64((uint64_t)(v))) +#else +#define write_int8(ptr,v) (*((int8_t *)(ptr)) = v) +#define write_uint8(ptr,v) (*((uint8_t *)(ptr)) = v) +#define write_int16(ptr,v) (*((int16_t *)(ptr)) = v) +#define write_uint16(ptr,v) (*((uint16_t *)(ptr)) = v) +#define write_int32(ptr,v) (*((int32_t *)(ptr)) = v) +#define write_uint32(ptr,v) (*((uint32_t *)(ptr)) = v) +#define write_int64(ptr,v) (*((int64_t *)(ptr)) = v) +#define write_uint64(ptr,v) (*((uint64_t *)(ptr)) = v) +#endif + +typedef struct { + uint8_t *data; + size_t len; + spice_marshaller_item_free_func free_data; + void *opaque; +} MarshallerItem; + +/* Try to fit in 4k page with 2*pointer-size overhead (next ptr and malloc size) */ +#define MARSHALLER_BUFFER_SIZE (4096 - sizeof(void *) * 2) + +typedef struct MarshallerBuffer MarshallerBuffer; +struct MarshallerBuffer { + MarshallerBuffer *next; + uint8_t data[MARSHALLER_BUFFER_SIZE]; +}; + +#define N_STATIC_ITEMS 4 + +typedef struct SpiceMarshallerData SpiceMarshallerData; + +typedef struct { + SpiceMarshaller *marshaller; + int item_nr; + int is_64bit; + size_t offset; +} MarshallerRef; + +struct SpiceMarshaller { + size_t total_size; + SpiceMarshallerData *data; + SpiceMarshaller *next; + + MarshallerRef pointer_ref; + + int n_items; + int items_size; /* number of items availible in items */ + MarshallerItem *items; + + MarshallerItem static_items[N_STATIC_ITEMS]; +}; + +struct SpiceMarshallerData { + size_t total_size; + size_t base; + SpiceMarshaller *marshallers; + SpiceMarshaller *last_marshaller; + + size_t current_buffer_position; + MarshallerBuffer *current_buffer; + MarshallerItem *current_buffer_item; + MarshallerBuffer *buffers; + + SpiceMarshaller static_marshaller; + MarshallerBuffer static_buffer; +}; + +static void spice_marshaller_init(SpiceMarshaller *m, + SpiceMarshallerData *data) +{ + m->data = data; + m->next = NULL; + m->total_size = 0; + m->pointer_ref.marshaller = NULL; + m->n_items = 0; + m->items_size = N_STATIC_ITEMS; + m->items = m->static_items; +} + +SpiceMarshaller *spice_marshaller_new(void) +{ + SpiceMarshallerData *d; + SpiceMarshaller *m; + + d = spice_new(SpiceMarshallerData, 1); + + d->last_marshaller = d->marshallers = &d->static_marshaller; + d->total_size = 0; + d->base = 0; + d->buffers = &d->static_buffer; + d->buffers->next = NULL; + d->current_buffer = d->buffers; + d->current_buffer_position = 0; + d->current_buffer_item = NULL; + + m = &d->static_marshaller; + spice_marshaller_init(m, d); + + return m; +} + +static void free_item_data(SpiceMarshaller *m) +{ + MarshallerItem *item; + int i; + + /* Free all user data */ + for (i = 0; i < m->n_items; i++) { + item = &m->items[i]; + if (item->free_data != NULL) { + item->free_data(item->data, item->opaque); + } + } +} + +static void free_items(SpiceMarshaller *m) +{ + if (m->items != m->static_items) { + free(m->items); + } +} + +void spice_marshaller_reset(SpiceMarshaller *m) +{ + SpiceMarshaller *m2, *next; + SpiceMarshallerData *d; + + /* Only supported for root marshaller */ + assert(m->data->marshallers == m); + + for (m2 = m; m2 != NULL; m2 = next) { + next = m2->next; + free_item_data(m2); + + /* Free non-root marshallers */ + if (m2 != m) { + free_items(m2); + free(m2); + } + } + + m->next = NULL; + m->n_items = 0; + m->total_size = 0; + + d = m->data; + d->last_marshaller = d->marshallers; + d->total_size = 0; + d->base = 0; + d->current_buffer_item = NULL; + d->current_buffer = d->buffers; + d->current_buffer_position = 0; +} + +void spice_marshaller_destroy(SpiceMarshaller *m) +{ + MarshallerBuffer *buf, *next; + SpiceMarshallerData *d; + + /* Only supported for root marshaller */ + assert(m->data->marshallers == m); + + spice_marshaller_reset(m); + + free_items(m); + + d = m->data; + + buf = d->buffers->next; + while (buf != NULL) { + next = buf->next; + free(buf); + buf = next; + } + + free(d); +} + +static MarshallerItem *spice_marshaller_add_item(SpiceMarshaller *m) +{ + MarshallerItem *item; + + if (m->n_items == m->items_size) { + int items_size = m->items_size * 2; + + if (m->items == m->static_items) { + m->items = spice_new(MarshallerItem, items_size); + memcpy(m->items, m->static_items, sizeof(MarshallerItem) * m->n_items); + } else { + m->items = spice_renew(MarshallerItem, m->items, items_size); + } + m->items_size = items_size; + } + item = &m->items[m->n_items++]; + item->free_data = NULL; + + return item; +} + +static size_t remaining_buffer_size(SpiceMarshallerData *d) +{ + return MARSHALLER_BUFFER_SIZE - d->current_buffer_position; +} + +uint8_t *spice_marshaller_reserve_space(SpiceMarshaller *m, size_t size) +{ + MarshallerItem *item; + SpiceMarshallerData *d; + uint8_t *res; + + if (size == 0) { + return NULL; + } + + d = m->data; + + /* Check current item */ + item = &m->items[m->n_items - 1]; + if (item == d->current_buffer_item && + remaining_buffer_size(d) >= size) { + assert(m->n_items >= 1); + /* We can piggy back on existing item+buffer */ + res = item->data + item->len; + item->len += size; + d->current_buffer_position += size; + d->total_size += size; + m->total_size += size; + return res; + } + + item = spice_marshaller_add_item(m); + + if (remaining_buffer_size(d) >= size) { + /* Fits in current buffer */ + item->data = d->current_buffer->data + d->current_buffer_position; + item->len = size; + d->current_buffer_position += size; + d->current_buffer_item = item; + } else if (size > MARSHALLER_BUFFER_SIZE / 2) { + /* Large item, allocate by itself */ + item->data = (uint8_t *)spice_malloc(size); + item->len = size; + item->free_data = (spice_marshaller_item_free_func)free; + item->opaque = NULL; + } else { + /* Use next buffer */ + if (d->current_buffer->next == NULL) { + d->current_buffer->next = spice_new(MarshallerBuffer, 1); + d->current_buffer->next->next = NULL; + } + d->current_buffer = d->current_buffer->next; + d->current_buffer_position = size; + d->current_buffer_item = item; + item->data = d->current_buffer->data; + item->len = size; + } + + d->total_size += size; + m->total_size += size; + return item->data; +} + +void spice_marshaller_unreserve_space(SpiceMarshaller *m, size_t size) +{ + MarshallerItem *item; + + if (size == 0) { + return; + } + + item = &m->items[m->n_items - 1]; + + assert(item->len >= size); + item->len -= size; +} + +uint8_t *spice_marshaller_add_ref_full(SpiceMarshaller *m, uint8_t *data, size_t size, + spice_marshaller_item_free_func free_data, void *opaque) +{ + MarshallerItem *item; + SpiceMarshallerData *d; + + if (data == NULL || size == 0) { + return NULL; + } + + item = spice_marshaller_add_item(m); + item->data = data; + item->len = size; + item->free_data = free_data; + item->opaque = opaque; + + d = m->data; + m->total_size += size; + d->total_size += size; + + return data; +} + +uint8_t *spice_marshaller_add(SpiceMarshaller *m, const uint8_t *data, size_t size) +{ + uint8_t *ptr; + + ptr = spice_marshaller_reserve_space(m, size); + memcpy(ptr, data, size); + return ptr; +} + +uint8_t *spice_marshaller_add_ref(SpiceMarshaller *m, uint8_t *data, size_t size) +{ + return spice_marshaller_add_ref_full(m, data, size, NULL, NULL); +} + +void spice_marshaller_add_ref_chunks(SpiceMarshaller *m, SpiceChunks *chunks) +{ + unsigned int i; + + for (i = 0; i < chunks->num_chunks; i++) { + spice_marshaller_add_ref(m, chunks->chunk[i].data, + chunks->chunk[i].len); + } +} + +SpiceMarshaller *spice_marshaller_get_submarshaller(SpiceMarshaller *m) +{ + SpiceMarshallerData *d; + SpiceMarshaller *m2; + + d = m->data; + + m2 = spice_new(SpiceMarshaller, 1); + spice_marshaller_init(m2, d); + + d->last_marshaller->next = m2; + d->last_marshaller = m2; + + return m2; +} + +SpiceMarshaller *spice_marshaller_get_ptr_submarshaller(SpiceMarshaller *m, int is_64bit) +{ + SpiceMarshaller *m2; + uint8_t *p; + int size; + + size = is_64bit ? 8 : 4; + + p = spice_marshaller_reserve_space(m, size); + memset(p, 0, size); + m2 = spice_marshaller_get_submarshaller(m); + m2->pointer_ref.marshaller = m; + m2->pointer_ref.item_nr = m->n_items - 1; + m2->pointer_ref.offset = m->items[m->n_items - 1].len - size; + m2->pointer_ref.is_64bit = is_64bit; + + return m2; +} + +static uint8_t *lookup_ref(MarshallerRef *ref) +{ + MarshallerItem *item; + + item = &ref->marshaller->items[ref->item_nr]; + return item->data + ref->offset; +} + + +void spice_marshaller_set_base(SpiceMarshaller *m, size_t base) +{ + /* Only supported for root marshaller */ + assert(m->data->marshallers == m); + + m->data->base = base; +} + +uint8_t *spice_marshaller_linearize(SpiceMarshaller *m, size_t skip_bytes, + size_t *len, int *free_res) +{ + MarshallerItem *item; + uint8_t *res, *p; + int i; + + /* Only supported for root marshaller */ + assert(m->data->marshallers == m); + + if (m->n_items == 1) { + *free_res = FALSE; + if (m->items[0].len <= skip_bytes) { + *len = 0; + return NULL; + } + *len = m->items[0].len - skip_bytes; + return m->items[0].data + skip_bytes; + } + + *free_res = TRUE; + res = (uint8_t *)spice_malloc(m->data->total_size - skip_bytes); + *len = m->data->total_size - skip_bytes; + p = res; + + do { + for (i = 0; i < m->n_items; i++) { + item = &m->items[i]; + + if (item->len <= skip_bytes) { + skip_bytes -= item->len; + continue; + } + memcpy(p, item->data + skip_bytes, item->len - skip_bytes); + p += item->len - skip_bytes; + skip_bytes = 0; + } + m = m->next; + } while (m != NULL); + + return res; +} + +uint8_t *spice_marshaller_get_ptr(SpiceMarshaller *m) +{ + return m->items[0].data; +} + +size_t spice_marshaller_get_offset(SpiceMarshaller *m) +{ + SpiceMarshaller *m2; + size_t offset; + + offset = 0; + m2 = m->data->marshallers; + while (m2 != m) { + offset += m2->total_size; + m2 = m2->next; + } + return offset - m->data->base; +} + +size_t spice_marshaller_get_size(SpiceMarshaller *m) +{ + return m->total_size; +} + +size_t spice_marshaller_get_total_size(SpiceMarshaller *m) +{ + return m->data->total_size; +} + +void spice_marshaller_flush(SpiceMarshaller *m) +{ + SpiceMarshaller *m2; + uint8_t *ptr_pos; + + /* Only supported for root marshaller */ + assert(m->data->marshallers == m); + + for (m2 = m; m2 != NULL; m2 = m2->next) { + if (m2->pointer_ref.marshaller != NULL && m2->total_size > 0) { + ptr_pos = lookup_ref(&m2->pointer_ref); + if (m2->pointer_ref.is_64bit) { + write_uint64(ptr_pos, + spice_marshaller_get_offset(m2)); + } else { + write_uint32(ptr_pos, + spice_marshaller_get_offset(m2)); + } + } + } +} + +#ifndef WIN32 +int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec, + int n_vec, size_t skip_bytes) +{ + MarshallerItem *item; + int v, i; + + /* Only supported for root marshaller */ + assert(m->data->marshallers == m); + + v = 0; + do { + for (i = 0; i < m->n_items; i++) { + item = &m->items[i]; + + if (item->len <= skip_bytes) { + skip_bytes -= item->len; + continue; + } + if (v == n_vec) { + return v; /* Not enough space in vec */ + } + vec[v].iov_base = (uint8_t *)item->data + skip_bytes; + vec[v].iov_len = item->len - skip_bytes; + skip_bytes = 0; + v++; + } + m = m->next; + } while (m != NULL); + + return v; +} +#endif + +void *spice_marshaller_add_uint64(SpiceMarshaller *m, uint64_t v) +{ + uint8_t *ptr; + + ptr = spice_marshaller_reserve_space(m, sizeof(uint64_t)); + write_uint64(ptr, v); + return (void *)ptr; +} + +void *spice_marshaller_add_int64(SpiceMarshaller *m, int64_t v) +{ + uint8_t *ptr; + + ptr = spice_marshaller_reserve_space(m, sizeof(int64_t)); + write_int64(ptr, v); + return (void *)ptr; +} + +void *spice_marshaller_add_uint32(SpiceMarshaller *m, uint32_t v) +{ + uint8_t *ptr; + + ptr = spice_marshaller_reserve_space(m, sizeof(uint32_t)); + write_uint32(ptr, v); + return (void *)ptr; +} + +void spice_marshaller_set_uint32(SpiceMarshaller *m, void *ref, uint32_t v) +{ + write_uint32((uint8_t *)ref, v); +} + +void *spice_marshaller_add_int32(SpiceMarshaller *m, int32_t v) +{ + uint8_t *ptr; + + ptr = spice_marshaller_reserve_space(m, sizeof(int32_t)); + write_int32(ptr, v); + return (void *)ptr; +} + +void *spice_marshaller_add_uint16(SpiceMarshaller *m, uint16_t v) +{ + uint8_t *ptr; + + ptr = spice_marshaller_reserve_space(m, sizeof(uint16_t)); + write_uint16(ptr, v); + return (void *)ptr; +} + +void *spice_marshaller_add_int16(SpiceMarshaller *m, int16_t v) +{ + uint8_t *ptr; + + ptr = spice_marshaller_reserve_space(m, sizeof(int16_t)); + write_int16(ptr, v); + return (void *)ptr; +} + +void *spice_marshaller_add_uint8(SpiceMarshaller *m, uint8_t v) +{ + uint8_t *ptr; + + ptr = spice_marshaller_reserve_space(m, sizeof(uint8_t)); + write_uint8(ptr, v); + return (void *)ptr; +} + +void *spice_marshaller_add_int8(SpiceMarshaller *m, int8_t v) +{ + uint8_t *ptr; + + ptr = spice_marshaller_reserve_space(m, sizeof(int8_t)); + write_int8(ptr, v); + return (void *)ptr; +} diff -Nru spice-gtk-0.9/spice-common/common/marshaller.h spice-gtk-0.12/spice-common/common/marshaller.h --- spice-gtk-0.9/spice-common/common/marshaller.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/marshaller.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,71 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2010 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H_MARSHALLER +#define _H_MARSHALLER + +#include +#include +#include "mem.h" +#ifndef WIN32 +#include +#endif + +SPICE_BEGIN_DECLS + +typedef struct SpiceMarshaller SpiceMarshaller; +typedef void (*spice_marshaller_item_free_func)(uint8_t *data, void *opaque); + +SpiceMarshaller *spice_marshaller_new(void); +void spice_marshaller_reset(SpiceMarshaller *m); +void spice_marshaller_destroy(SpiceMarshaller *m); +uint8_t *spice_marshaller_reserve_space(SpiceMarshaller *m, size_t size); +void spice_marshaller_unreserve_space(SpiceMarshaller *m, size_t size); +uint8_t *spice_marshaller_add(SpiceMarshaller *m, const uint8_t *data, size_t size); +uint8_t *spice_marshaller_add_ref(SpiceMarshaller *m, uint8_t *data, size_t size); +uint8_t *spice_marshaller_add_ref_full(SpiceMarshaller *m, uint8_t *data, size_t size, + spice_marshaller_item_free_func free_data, void *opaque); +void spice_marshaller_add_ref_chunks(SpiceMarshaller *m, SpiceChunks *chunks); +void spice_marshaller_flush(SpiceMarshaller *m); +void spice_marshaller_set_base(SpiceMarshaller *m, size_t base); +uint8_t *spice_marshaller_linearize(SpiceMarshaller *m, size_t skip, + size_t *len, int *free_res); +uint8_t *spice_marshaller_get_ptr(SpiceMarshaller *m); +size_t spice_marshaller_get_offset(SpiceMarshaller *m); +size_t spice_marshaller_get_size(SpiceMarshaller *m); +size_t spice_marshaller_get_total_size(SpiceMarshaller *m); +SpiceMarshaller *spice_marshaller_get_submarshaller(SpiceMarshaller *m); +SpiceMarshaller *spice_marshaller_get_ptr_submarshaller(SpiceMarshaller *m, int is_64bit); +#ifndef WIN32 +int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec, + int n_vec, size_t skip_bytes); +#endif +void *spice_marshaller_add_uint64(SpiceMarshaller *m, uint64_t v); +void *spice_marshaller_add_int64(SpiceMarshaller *m, int64_t v); +void *spice_marshaller_add_uint32(SpiceMarshaller *m, uint32_t v); +void *spice_marshaller_add_int32(SpiceMarshaller *m, int32_t v); +void *spice_marshaller_add_uint16(SpiceMarshaller *m, uint16_t v); +void *spice_marshaller_add_int16(SpiceMarshaller *m, int16_t v); +void *spice_marshaller_add_uint8(SpiceMarshaller *m, uint8_t v); +void *spice_marshaller_add_int8(SpiceMarshaller *m, int8_t v); + +void spice_marshaller_set_uint32(SpiceMarshaller *m, void *ref, uint32_t v); + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/mem.c spice-gtk-0.12/spice-common/common/mem.c --- spice-gtk-0.9/spice-common/common/mem.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/mem.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,296 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2010 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "spice_common.h" +#include "mem.h" + +#include +#include +#include + +#ifndef MALLOC_ERROR +#define MALLOC_ERROR(format, ...) SPICE_STMT_START { \ + spice_error(format, ## __VA_ARGS__); \ + abort(); \ +} SPICE_STMT_END +#endif + +size_t spice_strnlen(const char *str, size_t max_len) +{ + size_t len = 0; + + while (len < max_len && *str != 0) { + len++; + str++; + } + + return len; +} + +char *spice_strdup(const char *str) +{ + char *copy; + + if (str == NULL) { + return NULL; + } + + copy = (char *)spice_malloc(strlen(str) + 1); + strcpy(copy, str); + return copy; +} + +char *spice_strndup(const char *str, size_t n_bytes) +{ + char *copy; + + if (str == NULL) { + return NULL; + } + + copy = (char *)spice_malloc(n_bytes + 1); + strncpy(copy, str, n_bytes); + copy[n_bytes] = 0; + return copy; +} + +void *spice_memdup(const void *mem, size_t n_bytes) +{ + void *copy; + + if (mem == NULL) { + return NULL; + } + + copy = spice_malloc(n_bytes); + memcpy(copy, mem, n_bytes); + return copy; +} + +void *spice_malloc(size_t n_bytes) +{ + void *mem; + + if (SPICE_LIKELY(n_bytes)) { + mem = malloc(n_bytes); + + if (SPICE_LIKELY(mem != NULL)) { + return mem; + } + + MALLOC_ERROR("unable to allocate %lu bytes", (unsigned long)n_bytes); + } + return NULL; +} + +void *spice_malloc0(size_t n_bytes) +{ + void *mem; + + if (SPICE_LIKELY(n_bytes)) { + mem = calloc(1, n_bytes); + + if (SPICE_LIKELY(mem != NULL)) { + return mem; + } + + MALLOC_ERROR("unable to allocate %lu bytes", (unsigned long)n_bytes); + } + return NULL; +} + +void *spice_realloc(void *mem, size_t n_bytes) +{ + if (SPICE_LIKELY(n_bytes)) { + mem = realloc(mem, n_bytes); + + if (SPICE_LIKELY(mem != NULL)) { + return mem; + } + + MALLOC_ERROR("unable to allocate %lu bytes", (unsigned long)n_bytes); + } + + free(mem); + + return NULL; +} + +#define SIZE_OVERFLOWS(a,b) (SPICE_UNLIKELY ((a) > SIZE_MAX / (b))) + +void *spice_malloc_n(size_t n_blocks, size_t n_block_bytes) +{ + if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) { + MALLOC_ERROR("overflow allocating %lu*%lu bytes", + (unsigned long)n_blocks, (unsigned long)n_block_bytes); + } + + return spice_malloc(n_blocks * n_block_bytes); +} + +void *spice_malloc_n_m(size_t n_blocks, size_t n_block_bytes, size_t extra_size) +{ + size_t size1, size2; + if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) { + MALLOC_ERROR("spice_malloc_n: overflow allocating %lu*%lu + %lubytes", + (unsigned long)n_blocks, (unsigned long)n_block_bytes, (unsigned long)extra_size); + } + size1 = n_blocks * n_block_bytes; + size2 = size1 + extra_size; + if (size2 < size1) { + MALLOC_ERROR("spice_malloc_n: overflow allocating %lu*%lu + %lubytes", + (unsigned long)n_blocks, (unsigned long)n_block_bytes, (unsigned long)extra_size); + } + return spice_malloc(size2); +} + + +void *spice_malloc0_n(size_t n_blocks, size_t n_block_bytes) +{ + if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) { + MALLOC_ERROR("spice_malloc0_n: overflow allocating %lu*%lu bytes", + (unsigned long)n_blocks, (unsigned long)n_block_bytes); + } + + return spice_malloc0 (n_blocks * n_block_bytes); +} + +void *spice_realloc_n(void *mem, size_t n_blocks, size_t n_block_bytes) +{ + if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) { + MALLOC_ERROR("spice_realloc_n: overflow allocating %lu*%lu bytes", + (unsigned long)n_blocks, (unsigned long)n_block_bytes); + } + + return spice_realloc(mem, n_blocks * n_block_bytes); +} + +SpiceChunks *spice_chunks_new(uint32_t count) +{ + SpiceChunks *chunks; + + chunks = (SpiceChunks *)spice_malloc_n_m(count, sizeof(SpiceChunk), sizeof(SpiceChunks)); + chunks->flags = 0; + chunks->num_chunks = count; + + return chunks; +} + +SpiceChunks *spice_chunks_new_linear(uint8_t *data, uint32_t len) +{ + SpiceChunks *chunks; + + chunks = spice_chunks_new(1); + chunks->data_size = chunks->chunk[0].len = len; + chunks->chunk[0].data = data; + return chunks; +} + +void spice_chunks_destroy(SpiceChunks *chunks) +{ + unsigned int i; + + if (chunks->flags & SPICE_CHUNKS_FLAGS_FREE) { + for (i = 0; i < chunks->num_chunks; i++) { + free(chunks->chunk[i].data); + } + } + + free(chunks); +} + +void spice_chunks_linearize(SpiceChunks *chunks) +{ + uint8_t *data, *p; + unsigned int i; + + if (chunks->num_chunks > 1) { + data = (uint8_t*)spice_malloc(chunks->data_size); + for (p = data, i = 0; i < chunks->num_chunks; i++) { + memcpy(p, chunks->chunk[i].data, + chunks->chunk[i].len); + p += chunks->chunk[i].len; + } + if (chunks->flags & SPICE_CHUNKS_FLAGS_FREE) { + for (i = 0; i < chunks->num_chunks; i++) { + free(chunks->chunk[i].data); + } + } + chunks->num_chunks = 1; + chunks->flags |= SPICE_CHUNKS_FLAGS_FREE; + chunks->flags &= ~SPICE_CHUNKS_FLAGS_UNSTABLE; + chunks->chunk[0].data = data; + chunks->chunk[0].len = chunks->data_size; + } +} + +void spice_buffer_reserve(SpiceBuffer *buffer, size_t len) +{ + if ((buffer->capacity - buffer->offset) < len) { + buffer->capacity += (len + 1024); + buffer->buffer = (uint8_t*)spice_realloc(buffer->buffer, buffer->capacity); + } +} + +int spice_buffer_empty(SpiceBuffer *buffer) +{ + return buffer->offset == 0; +} + +uint8_t *spice_buffer_end(SpiceBuffer *buffer) +{ + return buffer->buffer + buffer->offset; +} + +void spice_buffer_reset(SpiceBuffer *buffer) +{ + buffer->offset = 0; +} + +void spice_buffer_free(SpiceBuffer *buffer) +{ + free(buffer->buffer); + buffer->offset = 0; + buffer->capacity = 0; + buffer->buffer = NULL; +} + +void spice_buffer_append(SpiceBuffer *buffer, const void *data, size_t len) +{ + spice_buffer_reserve(buffer, len); + memcpy(buffer->buffer + buffer->offset, data, len); + buffer->offset += len; +} + +size_t spice_buffer_copy(SpiceBuffer *buffer, void *dest, size_t len) +{ + len = MIN(buffer->offset, len); + memcpy(dest, buffer->buffer, len); + return len; +} + +size_t spice_buffer_remove(SpiceBuffer *buffer, size_t len) +{ + len = MIN(buffer->offset, len); + memmove(buffer->buffer, buffer->buffer + len, buffer->offset - len); + buffer->offset -= len; + return len; +} diff -Nru spice-gtk-0.9/spice-common/common/mem.h spice-gtk-0.12/spice-common/common/mem.h --- spice-gtk-0.9/spice-common/common/mem.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/mem.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,159 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2010 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H_MEM +#define _H_MEM + +#include +#include + +#ifdef HAVE_CONFIG_H +# include +#endif + +SPICE_BEGIN_DECLS + +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif defined __GNUC__ +#if !defined alloca +# define alloca __builtin_alloca +#endif +#elif defined _AIX +# define alloca __alloca +#elif defined _MSC_VER +# include +# define alloca _alloca +#else +# ifndef HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + +typedef struct SpiceChunk { + uint8_t *data; + uint32_t len; +} SpiceChunk; + +enum { + SPICE_CHUNKS_FLAGS_UNSTABLE = (1<<0), + SPICE_CHUNKS_FLAGS_FREE = (1<<1) +}; + +typedef struct SpiceChunks { + uint32_t data_size; + uint32_t num_chunks; + uint32_t flags; + SpiceChunk chunk[0]; +} SpiceChunks; + +typedef struct SpiceBuffer +{ + size_t capacity; + size_t offset; + uint8_t *buffer; +} SpiceBuffer; + +char *spice_strdup(const char *str) SPICE_GNUC_MALLOC; +char *spice_strndup(const char *str, size_t n_bytes) SPICE_GNUC_MALLOC; +void *spice_memdup(const void *mem, size_t n_bytes) SPICE_GNUC_MALLOC; +void *spice_malloc(size_t n_bytes) SPICE_GNUC_MALLOC SPICE_GNUC_ALLOC_SIZE(1); +void *spice_malloc0(size_t n_bytes) SPICE_GNUC_MALLOC SPICE_GNUC_ALLOC_SIZE(1); +void *spice_realloc(void *mem, size_t n_bytes) SPICE_GNUC_WARN_UNUSED_RESULT; +void *spice_malloc_n(size_t n_blocks, size_t n_block_bytes) SPICE_GNUC_MALLOC SPICE_GNUC_ALLOC_SIZE2(1,2); +void *spice_malloc_n_m(size_t n_blocks, size_t n_block_bytes, size_t extra_size) SPICE_GNUC_MALLOC; +void *spice_malloc0_n(size_t n_blocks, size_t n_block_bytes) SPICE_GNUC_MALLOC SPICE_GNUC_ALLOC_SIZE2(1,2); +void *spice_realloc_n(void *mem, size_t n_blocks, size_t n_block_bytes) SPICE_GNUC_WARN_UNUSED_RESULT; +SpiceChunks *spice_chunks_new(uint32_t count) SPICE_GNUC_MALLOC; +SpiceChunks *spice_chunks_new_linear(uint8_t *data, uint32_t len) SPICE_GNUC_MALLOC; +void spice_chunks_destroy(SpiceChunks *chunks); +void spice_chunks_linearize(SpiceChunks *chunks); + +size_t spice_strnlen(const char *str, size_t max_len); + +/* Optimize: avoid the call to the (slower) _n function if we can + * determine at compile-time that no overflow happens. + */ +#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) +# define _SPICE_NEW(struct_type, n_structs, func) \ + (struct_type *) (__extension__ ({ \ + size_t __n = (size_t) (n_structs); \ + size_t __s = sizeof (struct_type); \ + void *__p; \ + if (__s == 1) \ + __p = spice_##func (__n); \ + else if (__builtin_constant_p (__n) && \ + __n <= SIZE_MAX / __s) \ + __p = spice_##func (__n * __s); \ + else \ + __p = spice_##func##_n (__n, __s); \ + __p; \ + })) +# define _SPICE_RENEW(struct_type, mem, n_structs, func) \ + (struct_type *) (__extension__ ({ \ + size_t __n = (size_t) (n_structs); \ + size_t __s = sizeof (struct_type); \ + void *__p = (void *) (mem); \ + if (__s == 1) \ + __p = spice_##func (__p, __n); \ + else if (__builtin_constant_p (__n) && \ + __n <= SIZE_MAX / __s) \ + __p = spice_##func (__p, __n * __s); \ + else \ + __p = spice_##func##_n (__p, __n, __s); \ + __p; \ + })) +#else + +/* Unoptimized version: always call the _n() function. */ + +#define _SPICE_NEW(struct_type, n_structs, func) \ + ((struct_type *) spice_##func##_n ((n_structs), sizeof (struct_type))) +#define _SPICE_RENEW(struct_type, mem, n_structs, func) \ + ((struct_type *) spice_##func##_n (mem, (n_structs), sizeof (struct_type))) + +#endif + +#define spice_new(struct_type, n_structs) _SPICE_NEW(struct_type, n_structs, malloc) +#define spice_new0(struct_type, n_structs) _SPICE_NEW(struct_type, n_structs, malloc0) +#define spice_renew(struct_type, mem, n_structs) _SPICE_RENEW(struct_type, mem, n_structs, realloc) + +/* Buffer management */ +void spice_buffer_reserve(SpiceBuffer *buffer, size_t len); +int spice_buffer_empty(SpiceBuffer *buffer); +uint8_t *spice_buffer_end(SpiceBuffer *buffer); +void spice_buffer_reset(SpiceBuffer *buffer); +void spice_buffer_free(SpiceBuffer *buffer); +void spice_buffer_append(SpiceBuffer *buffer, const void *data, size_t len); +size_t spice_buffer_copy(SpiceBuffer *buffer, void *dest, size_t len); +size_t spice_buffer_remove(SpiceBuffer *buffer, size_t len); + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/messages.h spice-gtk-0.12/spice-common/common/messages.h --- spice-gtk-0.9/spice-common/common/messages.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/messages.h 2012-04-21 18:50:39.000000000 +0000 @@ -0,0 +1,549 @@ +/* + Copyright (C) 2009-2010 Red Hat, Inc. + + 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 copyright holder 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 HOLDER 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 + HOLDER OR CONTRIBUTORS 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. +*/ + +#ifndef _H_MESSAGES +#define _H_MESSAGES + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#ifdef USE_SMARTCARD +#include +#endif + +#include "draw.h" + +SPICE_BEGIN_DECLS + +typedef struct SpiceMsgData { + uint32_t data_size; + uint8_t data[0]; +} SpiceMsgData; + +typedef struct SpiceMsgEmpty { +} SpiceMsgEmpty; + +typedef struct SpiceMsgInputsInit { + uint32_t keyboard_modifiers; +} SpiceMsgInputsInit; + +typedef struct SpiceMsgInputsKeyModifiers { + uint32_t modifiers; +} SpiceMsgInputsKeyModifiers; + +typedef struct SpiceMsgMainMultiMediaTime { + uint32_t time; +} SpiceMsgMainMultiMediaTime; + +typedef struct SpiceMsgMainMigrationBegin { + uint16_t port; + uint16_t sport; + uint32_t host_size; + uint8_t *host_data; + uint16_t pub_key_type; + uint32_t pub_key_size; + uint8_t *pub_key_data; + uint32_t cert_subject_size; + uint8_t *cert_subject_data; +} SpiceMsgMainMigrationBegin; + +typedef struct SpiceMsgMainMigrationSwitchHost { + uint16_t port; + uint16_t sport; + uint32_t host_size; + uint8_t *host_data; + uint32_t cert_subject_size; + uint8_t *cert_subject_data; +} SpiceMsgMainMigrationSwitchHost; + + +typedef struct SpiceMsgMigrate { + uint32_t flags; +} SpiceMsgMigrate; + +typedef struct SpiceResourceID { + uint8_t type; + uint64_t id; +} SpiceResourceID; + +typedef struct SpiceResourceList { + uint16_t count; + SpiceResourceID resources[0]; +} SpiceResourceList; + +typedef struct SpiceMsgSetAck { + uint32_t generation; + uint32_t window; +} SpiceMsgSetAck; + +typedef struct SpiceMsgcAckSync { + uint32_t generation; +} SpiceMsgcAckSync; + +typedef struct SpiceWaitForChannel { + uint8_t channel_type; + uint8_t channel_id; + uint64_t message_serial; +} SpiceWaitForChannel; + +typedef struct SpiceMsgWaitForChannels { + uint8_t wait_count; + SpiceWaitForChannel wait_list[0]; +} SpiceMsgWaitForChannels; + +typedef struct SpiceChannelId { + uint8_t type; + uint8_t id; +} SpiceChannelId; + +typedef struct SpiceMsgMainInit { + uint32_t session_id; + uint32_t display_channels_hint; + uint32_t supported_mouse_modes; + uint32_t current_mouse_mode; + uint32_t agent_connected; + uint32_t agent_tokens; + uint32_t multi_media_time; + uint32_t ram_hint; +} SpiceMsgMainInit; + +typedef struct SpiceMsgDisconnect { + uint64_t time_stamp; + uint32_t reason; // SPICE_ERR_? +} SpiceMsgDisconnect; + +typedef struct SpiceMsgNotify { + uint64_t time_stamp; + uint32_t severity; + uint32_t visibilty; + uint32_t what; + uint32_t message_len; + uint8_t message[0]; +} SpiceMsgNotify; + +typedef struct SpiceMsgChannels { + uint32_t num_of_channels; + SpiceChannelId channels[0]; +} SpiceMsgChannels; + +typedef struct SpiceMsgMainName { + uint32_t name_len; + uint8_t name[0]; +} SpiceMsgMainName; + +typedef struct SpiceMsgMainUuid { + uint8_t uuid[16]; +} SpiceMsgMainUuid; + +typedef struct SpiceMsgMainMouseMode { + uint32_t supported_modes; + uint32_t current_mode; +} SpiceMsgMainMouseMode; + +typedef struct SpiceMsgPing { + uint32_t id; + uint64_t timestamp; + void *data; + uint32_t data_len; +} SpiceMsgPing; + +typedef struct SpiceMsgMainAgentDisconnect { + uint32_t error_code; // SPICE_ERR_? +} SpiceMsgMainAgentDisconnect; + +#define SPICE_AGENT_MAX_DATA_SIZE 2048 + +typedef struct SpiceMsgMainAgentTokens { + uint32_t num_tokens; +} SpiceMsgMainAgentTokens, SpiceMsgcMainAgentTokens, SpiceMsgcMainAgentStart; + +typedef struct SpiceMsgcClientInfo { + uint64_t cache_size; +} SpiceMsgcClientInfo; + +typedef struct SpiceMsgcMainMouseModeRequest { + uint32_t mode; +} SpiceMsgcMainMouseModeRequest; + +typedef struct SpiceCursor { + uint32_t flags; + SpiceCursorHeader header; + uint32_t data_size; + uint8_t *data; +} SpiceCursor; + +typedef struct SpiceMsgDisplayMode { + uint32_t x_res; + uint32_t y_res; + uint32_t bits; +} SpiceMsgDisplayMode; + +typedef struct SpiceMsgSurfaceCreate { + uint32_t surface_id; + uint32_t width; + uint32_t height; + uint32_t format; + uint32_t flags; +} SpiceMsgSurfaceCreate; + +typedef struct SpiceMsgSurfaceDestroy { + uint32_t surface_id; +} SpiceMsgSurfaceDestroy; + +typedef struct SpiceMsgDisplayBase { + uint32_t surface_id; + SpiceRect box; + SpiceClip clip; +} SpiceMsgDisplayBase; + +typedef struct SpiceMsgDisplayDrawFill { + SpiceMsgDisplayBase base; + SpiceFill data; +} SpiceMsgDisplayDrawFill; + +typedef struct SpiceMsgDisplayDrawOpaque { + SpiceMsgDisplayBase base; + SpiceOpaque data; +} SpiceMsgDisplayDrawOpaque; + +typedef struct SpiceMsgDisplayDrawCopy { + SpiceMsgDisplayBase base; + SpiceCopy data; +} SpiceMsgDisplayDrawCopy; + +typedef struct SpiceMsgDisplayDrawTransparent { + SpiceMsgDisplayBase base; + SpiceTransparent data; +} SpiceMsgDisplayDrawTransparent; + +typedef struct SpiceMsgDisplayDrawAlphaBlend { + SpiceMsgDisplayBase base; + SpiceAlphaBlend data; +} SpiceMsgDisplayDrawAlphaBlend; + +typedef struct SpiceMsgDisplayCopyBits { + SpiceMsgDisplayBase base; + SpicePoint src_pos; +} SpiceMsgDisplayCopyBits; + +typedef SpiceMsgDisplayDrawCopy SpiceMsgDisplayDrawBlend; + +typedef struct SpiceMsgDisplayDrawRop3 { + SpiceMsgDisplayBase base; + SpiceRop3 data; +} SpiceMsgDisplayDrawRop3; + +typedef struct SpiceMsgDisplayDrawBlackness { + SpiceMsgDisplayBase base; + SpiceBlackness data; +} SpiceMsgDisplayDrawBlackness; + +typedef struct SpiceMsgDisplayDrawWhiteness { + SpiceMsgDisplayBase base; + SpiceWhiteness data; +} SpiceMsgDisplayDrawWhiteness; + +typedef struct SpiceMsgDisplayDrawInvers { + SpiceMsgDisplayBase base; + SpiceInvers data; +} SpiceMsgDisplayDrawInvers; + +typedef struct SpiceMsgDisplayDrawStroke { + SpiceMsgDisplayBase base; + SpiceStroke data; +} SpiceMsgDisplayDrawStroke; + +typedef struct SpiceMsgDisplayDrawText { + SpiceMsgDisplayBase base; + SpiceText data; +} SpiceMsgDisplayDrawText; + +typedef struct SpiceMsgDisplayInvalOne { + uint64_t id; +} SpiceMsgDisplayInvalOne; + +typedef struct SpiceMsgDisplayStreamCreate { + uint32_t surface_id; + uint32_t id; + uint32_t flags; + uint32_t codec_type; + uint64_t stamp; + uint32_t stream_width; + uint32_t stream_height; + uint32_t src_width; + uint32_t src_height; + SpiceRect dest; + SpiceClip clip; +} SpiceMsgDisplayStreamCreate; + +typedef struct SpiceMsgDisplayStreamData { + uint32_t id; + uint32_t multi_media_time; + uint32_t data_size; + uint8_t data[0]; +} SpiceMsgDisplayStreamData; + +typedef struct SpiceMsgDisplayStreamClip { + uint32_t id; + SpiceClip clip; +} SpiceMsgDisplayStreamClip; + +typedef struct SpiceMsgDisplayStreamDestroy { + uint32_t id; +} SpiceMsgDisplayStreamDestroy; + +typedef struct SpiceMsgCursorInit { + SpicePoint16 position; + uint16_t trail_length; + uint16_t trail_frequency; + uint8_t visible; + SpiceCursor cursor; +} SpiceMsgCursorInit; + +typedef struct SpiceMsgCursorSet { + SpicePoint16 position; + uint8_t visible; + SpiceCursor cursor; +} SpiceMsgCursorSet; + +typedef struct SpiceMsgCursorMove { + SpicePoint16 position; +} SpiceMsgCursorMove; + +typedef struct SpiceMsgCursorTrail { + uint16_t length; + uint16_t frequency; +} SpiceMsgCursorTrail; + +typedef struct SpiceMsgcDisplayInit { + uint8_t pixmap_cache_id; + int64_t pixmap_cache_size; //in pixels + uint8_t glz_dictionary_id; + int32_t glz_dictionary_window_size; // in pixels +} SpiceMsgcDisplayInit; + +typedef struct SpiceMsgcKeyDown { + uint32_t code; +} SpiceMsgcKeyDown; + +typedef struct SpiceMsgcKeyUp { + uint32_t code; +} SpiceMsgcKeyUp; + +typedef struct SpiceMsgcKeyModifiers { + uint32_t modifiers; +} SpiceMsgcKeyModifiers; + +typedef struct SpiceMsgcMouseMotion { + int32_t dx; + int32_t dy; + uint32_t buttons_state; +} SpiceMsgcMouseMotion; + +typedef struct SpiceMsgcMousePosition { + uint32_t x; + uint32_t y; + uint32_t buttons_state; + uint8_t display_id; +} SpiceMsgcMousePosition; + +typedef struct SpiceMsgcMousePress { + int32_t button; + int32_t buttons_state; +} SpiceMsgcMousePress; + +typedef struct SpiceMsgcMouseRelease { + int32_t button; + int32_t buttons_state; +} SpiceMsgcMouseRelease; + +typedef struct SpiceMsgAudioVolume { + uint8_t nchannels; + uint16_t volume[0]; +} SpiceMsgAudioVolume; + +typedef struct SpiceMsgAudioMute { + uint8_t mute; +} SpiceMsgAudioMute; + +typedef struct SpiceMsgPlaybackMode { + uint32_t time; + uint32_t mode; //SPICE_AUDIO_DATA_MODE_? + uint8_t *data; + uint32_t data_size; +} SpiceMsgPlaybackMode, SpiceMsgcRecordMode; + +typedef struct SpiceMsgPlaybackStart { + uint32_t channels; + uint32_t format; //SPICE_AUDIO_FMT_? + uint32_t frequency; + uint32_t time; +} SpiceMsgPlaybackStart; + +typedef struct SpiceMsgPlaybackPacket { + uint32_t time; + uint8_t *data; + uint32_t data_size; +} SpiceMsgPlaybackPacket, SpiceMsgcRecordPacket; + +typedef struct SpiceMsgRecordStart { + uint32_t channels; + uint32_t format; //SPICE_AUDIO_FMT_? + uint32_t frequency; +} SpiceMsgRecordStart; + +typedef struct SpiceMsgcRecordStartMark { + uint32_t time; +} SpiceMsgcRecordStartMark; + +typedef struct SpiceMsgTunnelInit { + uint16_t max_num_of_sockets; + uint32_t max_socket_data_size; +} SpiceMsgTunnelInit; + +typedef uint8_t SpiceTunnelIPv4[4]; + +typedef struct SpiceMsgTunnelIpInfo { + uint16_t type; + union { + SpiceTunnelIPv4 ipv4; + } u; + uint8_t data[0]; +} SpiceMsgTunnelIpInfo; + +typedef struct SpiceMsgTunnelServiceIpMap { + uint32_t service_id; + SpiceMsgTunnelIpInfo virtual_ip; +} SpiceMsgTunnelServiceIpMap; + +typedef struct SpiceMsgTunnelSocketOpen { + uint16_t connection_id; + uint32_t service_id; + uint32_t tokens; +} SpiceMsgTunnelSocketOpen; + +/* connection id must be the first field in msgs directed to a specific connection */ + +typedef struct SpiceMsgTunnelSocketFin { + uint16_t connection_id; +} SpiceMsgTunnelSocketFin; + +typedef struct SpiceMsgTunnelSocketClose { + uint16_t connection_id; +} SpiceMsgTunnelSocketClose; + +typedef struct SpiceMsgTunnelSocketData { + uint16_t connection_id; + uint8_t data[0]; +} SpiceMsgTunnelSocketData; + +typedef struct SpiceMsgTunnelSocketTokens { + uint16_t connection_id; + uint32_t num_tokens; +} SpiceMsgTunnelSocketTokens; + +typedef struct SpiceMsgTunnelSocketClosedAck { + uint16_t connection_id; +} SpiceMsgTunnelSocketClosedAck; + +typedef struct SpiceMsgcTunnelAddGenericService { + uint32_t type; + uint32_t id; + uint32_t group; + uint32_t port; + uint64_t name; + uint64_t description; + union { + SpiceMsgTunnelIpInfo ip; + } u; +} SpiceMsgcTunnelAddGenericService; + +typedef struct SpiceMsgcTunnelRemoveService { + uint32_t id; +} SpiceMsgcTunnelRemoveService; + +/* connection id must be the first field in msgs directed to a specific connection */ + +typedef struct SpiceMsgcTunnelSocketOpenAck { + uint16_t connection_id; + uint32_t tokens; +} SpiceMsgcTunnelSocketOpenAck; + +typedef struct SpiceMsgcTunnelSocketOpenNack { + uint16_t connection_id; +} SpiceMsgcTunnelSocketOpenNack; + +typedef struct SpiceMsgcTunnelSocketData { + uint16_t connection_id; + uint8_t data[0]; +} SpiceMsgcTunnelSocketData; + +typedef struct SpiceMsgcTunnelSocketFin { + uint16_t connection_id; +} SpiceMsgcTunnelSocketFin; + +typedef struct SpiceMsgcTunnelSocketClosed { + uint16_t connection_id; +} SpiceMsgcTunnelSocketClosed; + +typedef struct SpiceMsgcTunnelSocketClosedAck { + uint16_t connection_id; +} SpiceMsgcTunnelSocketClosedAck; + +typedef struct SpiceMsgcTunnelSocketTokens { + uint16_t connection_id; + uint32_t num_tokens; +} SpiceMsgcTunnelSocketTokens; + +#ifdef USE_SMARTCARD +typedef struct SpiceMsgSmartcard { + VSCMsgType type; + uint32_t length; + uint32_t reader_id; + uint8_t data[0]; +} SpiceMsgSmartcard; + +typedef struct SpiceMsgcSmartcard { + VSCMsgHeader header; + union { + VSCMsgError error; + VSCMsgATR atr_data; + VSCMsgReaderAdd add; + }; +} SpiceMsgcSmartcard; +#endif + +SPICE_END_DECLS + +#endif /* _H_SPICE_PROTOCOL */ diff -Nru spice-gtk-0.9/spice-common/common/mutex.h spice-gtk-0.12/spice-common/common/mutex.h --- spice-gtk-0.9/spice-common/common/mutex.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/mutex.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,42 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H_MUTEX +#define _H_MUTEX + +#include + +SPICE_BEGIN_DECLS + +#ifdef _WIN32 +#include +typedef CRITICAL_SECTION mutex_t; +#define MUTEX_INIT(mutex) InitializeCriticalSection(&mutex) +#define MUTEX_LOCK(mutex) EnterCriticalSection(&mutex) +#define MUTEX_UNLOCK(mutex) LeaveCriticalSection(&mutex) +#else +#include +typedef pthread_mutex_t mutex_t; +#define MUTEX_INIT(mutex) pthread_mutex_init(&mutex, NULL); +#define MUTEX_LOCK(mutex) pthread_mutex_lock(&mutex) +#define MUTEX_UNLOCK(mutex) pthread_mutex_unlock(&mutex) +#endif + +SPICE_END_DECLS + +#endif // _H_MUTEX diff -Nru spice-gtk-0.9/spice-common/common/ogl_ctx.c spice-gtk-0.12/spice-common/common/ogl_ctx.c --- spice-gtk-0.9/spice-common/common/ogl_ctx.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/ogl_ctx.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,251 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include + +#include "ogl_ctx.h" +#include "spice_common.h" + +enum { + OGLCTX_TYPE_PBUF, + OGLCTX_TYPE_PIXMAP, +}; + +struct OGLCtx { + int type; + Display *x_display; + GLXContext glx_context; + GLXDrawable drawable; +}; + +typedef struct OGLPixmapCtx { + OGLCtx base; + Pixmap pixmap; +} OGLPixmapCtx; + + + +const char *oglctx_type_str(OGLCtx *ctx) +{ + static const char *pbuf_str = "pbuf"; + static const char *pixmap_str = "pixmap"; + static const char *invalid_str = "invalid"; + + switch (ctx->type) { + case OGLCTX_TYPE_PBUF: + return pbuf_str; + case OGLCTX_TYPE_PIXMAP: + return pixmap_str; + default: + return invalid_str; + } +} + +void oglctx_make_current(OGLCtx *ctx) +{ + if (!glXMakeCurrent(ctx->x_display, ctx->drawable, ctx->glx_context)) { + printf("%s: failed\n", __FUNCTION__); + } +} + +OGLCtx *pbuf_create(int width, int heigth) +{ + OGLCtx *ctx; + Display *x_display; + int num_configs; + GLXFBConfig *fb_config; + GLXPbuffer glx_pbuf; + GLXContext glx_context; + + const int glx_attributes[] = { GLX_RENDER_TYPE, GLX_RGBA_BIT, + GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT, + GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, + GLX_ALPHA_SIZE, 8, + GLX_STENCIL_SIZE, 4, + 0 }; + + int pbuf_attrib[] = { GLX_PRESERVED_CONTENTS, True, + GLX_PBUFFER_WIDTH, width, + GLX_PBUFFER_HEIGHT, heigth, + GLX_LARGEST_PBUFFER, False, + 0, 0 }; + + if (!(ctx = calloc(1, sizeof(*ctx)))) { + printf("%s: alloc pbuf failed\n", __FUNCTION__); + return NULL; + } + + if (!(x_display = XOpenDisplay(NULL))) { + printf("%s: open display failed\n", __FUNCTION__); + goto error_1; + } + + if (!(fb_config = glXChooseFBConfig(x_display, 0, glx_attributes, &num_configs)) || + !num_configs) { + printf("%s: choose fb config failed\n", __FUNCTION__); + goto error_2; + } + + if (!(glx_pbuf = glXCreatePbuffer(x_display, fb_config[0], pbuf_attrib))) { + goto error_3; + } + + if (!(glx_context = glXCreateNewContext(x_display, fb_config[0], GLX_RGBA_TYPE, NULL, True))) { + printf("%s: create context failed\n", __FUNCTION__); + goto error_4; + } + + XFree(fb_config); + + ctx->type = OGLCTX_TYPE_PBUF; + ctx->drawable = glx_pbuf; + ctx->glx_context = glx_context; + ctx->x_display = x_display; + + return ctx; + +error_4: + glXDestroyPbuffer(x_display, glx_pbuf); + +error_3: + XFree(fb_config); + +error_2: + XCloseDisplay(x_display); + +error_1: + free(ctx); + + return NULL; +} + +OGLCtx *pixmap_create(int width, int heigth) +{ + Display *x_display; + int num_configs; + GLXFBConfig *fb_config; + GLXPixmap glx_pixmap; + GLXContext glx_context; + Pixmap pixmap; + int screen; + Window root_window; + OGLPixmapCtx *pix; + + const int glx_attributes[] = { GLX_RENDER_TYPE, GLX_RGBA_BIT, + GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT, + GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, + GLX_ALPHA_SIZE, 8, + GLX_STENCIL_SIZE, 4, + 0 }; + + if (!(pix = calloc(1, sizeof(*pix)))) { + printf("%s: alloc pix failed\n", __FUNCTION__); + return NULL; + } + + if (!(x_display = XOpenDisplay(NULL))) { + printf("%s: open display failed\n", __FUNCTION__); + goto error_1; + } + + screen = DefaultScreen(x_display); + root_window = RootWindow(x_display, screen); + + if (!(fb_config = glXChooseFBConfig(x_display, 0, glx_attributes, &num_configs)) || + !num_configs) { + printf("%s: choose fb config failed\n", __FUNCTION__); + goto error_2; + } + + if (!(pixmap = XCreatePixmap(x_display, root_window, width, heigth, 32 /*use fb config*/))) { + printf("%s: create x pixmap failed\n", __FUNCTION__); + goto error_3; + } + + if (!(glx_pixmap = glXCreatePixmap(x_display, fb_config[0], pixmap, NULL))) { + printf("%s: create glx pixmap failed\n", __FUNCTION__); + goto error_4; + } + + + if (!(glx_context = glXCreateNewContext(x_display, fb_config[0], GLX_RGBA_TYPE, NULL, True))) { + printf("%s: create context failed\n", __FUNCTION__); + goto error_5; + } + + XFree(fb_config); + + pix->base.type = OGLCTX_TYPE_PIXMAP; + pix->base.x_display = x_display; + pix->base.drawable = glx_pixmap; + pix->base.glx_context = glx_context; + pix->pixmap = pixmap; + + return &pix->base; + +error_5: + glXDestroyPixmap(x_display, glx_pixmap); + +error_4: + XFreePixmap(x_display, pixmap); + +error_3: + XFree(fb_config); + +error_2: + XCloseDisplay(x_display); + +error_1: + free(pix); + + return NULL; +} + +void oglctx_destroy(OGLCtx *ctx) +{ + if (!ctx) { + return; + } + // test is current ? + + glXDestroyContext(ctx->x_display, ctx->glx_context); + switch (ctx->type) { + case OGLCTX_TYPE_PBUF: + glXDestroyPbuffer(ctx->x_display, ctx->drawable); + break; + case OGLCTX_TYPE_PIXMAP: + glXDestroyPixmap(ctx->x_display, ctx->drawable); + XFreePixmap(ctx->x_display, ((OGLPixmapCtx *)ctx)->pixmap); + break; + default: + spice_error("invalid ogl ctx type"); + } + + XCloseDisplay(ctx->x_display); + free(ctx); +} diff -Nru spice-gtk-0.9/spice-common/common/ogl_ctx.h spice-gtk-0.12/spice-common/common/ogl_ctx.h --- spice-gtk-0.9/spice-common/common/ogl_ctx.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/ogl_ctx.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,36 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H_GLCTX +#define _H_GLCTX + +#include + +SPICE_BEGIN_DECLS + +typedef struct OGLCtx OGLCtx; + +const char *oglctx_type_str(OGLCtx *ctx); +void oglctx_make_current(OGLCtx *ctx); +OGLCtx *pbuf_create(int width, int heigth); +OGLCtx *pixmap_create(int width, int heigth); +void oglctx_destroy(OGLCtx *ctx); + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/pixman_utils.c spice-gtk-0.12/spice-common/common/pixman_utils.c --- spice-gtk-0.9/spice-common/common/pixman_utils.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/pixman_utils.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,1599 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "pixman_utils.h" +#include "spice_common.h" +#include + +#include +#include +#include +#include "mem.h" + +#define SOLID_RASTER_OP(_name, _size, _type, _equation) \ +static void \ +solid_rop_ ## _name ## _ ## _size (_type *ptr, int len, _type src) \ +{ \ + while (len--) { \ + _type dst = *ptr; \ + if (dst) /* avoid unused warning */{}; \ + *ptr = (_type)(_equation); \ + ptr++; \ + } \ +} \ + +#define TILED_RASTER_OP(_name, _size, _type, _equation) \ +static void \ +tiled_rop_ ## _name ## _ ## _size (_type *ptr, int len, _type *tile, _type *tile_end, int tile_width) \ +{ \ + while (len--) { \ + _type src = *tile; \ + _type dst = *ptr; \ + if (src) /* avoid unused warning */{}; \ + if (dst) /* avoid unused warning */{}; \ + *ptr = (_type)(_equation); \ + ptr++; \ + tile++; \ + if (tile == tile_end) \ + tile -= tile_width; \ + } \ +} \ + +#define COPY_RASTER_OP(_name, _size, _type, _equation) \ +static void \ + copy_rop_ ## _name ## _ ## _size (_type *ptr, _type *src_line, int len) \ +{ \ + while (len--) { \ + _type src = *src_line; \ + _type dst = *ptr; \ + if (src) /* avoid unused warning */ {}; \ + if (dst) /* avoid unused warning */{}; \ + *ptr = (_type)(_equation); \ + ptr++; \ + src_line++; \ + } \ +} \ + +#define RASTER_OP(name, equation) \ + SOLID_RASTER_OP(name, 8, uint8_t, equation) \ + SOLID_RASTER_OP(name, 16, uint16_t, equation) \ + SOLID_RASTER_OP(name, 32, uint32_t, equation) \ + TILED_RASTER_OP(name, 8, uint8_t, equation) \ + TILED_RASTER_OP(name, 16, uint16_t, equation) \ + TILED_RASTER_OP(name, 32, uint32_t, equation) \ + COPY_RASTER_OP(name, 8, uint8_t, equation) \ + COPY_RASTER_OP(name, 16, uint16_t, equation) \ + COPY_RASTER_OP(name, 32, uint32_t, equation) + +RASTER_OP(clear, 0x0) +RASTER_OP(and, src & dst) +RASTER_OP(and_reverse, src & ~dst) +RASTER_OP(copy, src) +RASTER_OP(and_inverted, ~src & dst) +RASTER_OP(noop, dst) +RASTER_OP(xor, src ^ dst) +RASTER_OP(or, src | dst) +RASTER_OP(nor, ~src & ~dst) +RASTER_OP(equiv, ~src ^ dst) +RASTER_OP(invert, ~dst) +RASTER_OP(or_reverse, src | ~dst) +RASTER_OP(copy_inverted, ~src) +RASTER_OP(or_inverted, ~src | dst) +RASTER_OP(nand, ~src | ~dst) +RASTER_OP(set, 0xffffffff) + +typedef void (*solid_rop_8_func_t)(uint8_t *ptr, int len, uint8_t src); +typedef void (*solid_rop_16_func_t)(uint16_t *ptr, int len, uint16_t src); +typedef void (*solid_rop_32_func_t)(uint32_t *ptr, int len, uint32_t src); +typedef void (*tiled_rop_8_func_t)(uint8_t *ptr, int len, + uint8_t *tile, uint8_t *tile_end, int tile_width); +typedef void (*tiled_rop_16_func_t)(uint16_t *ptr, int len, + uint16_t *tile, uint16_t *tile_end, int tile_width); +typedef void (*tiled_rop_32_func_t)(uint32_t *ptr, int len, + uint32_t *tile, uint32_t *tile_end, int tile_width); +typedef void (*copy_rop_8_func_t)(uint8_t *ptr, uint8_t *src, int len); +typedef void (*copy_rop_16_func_t)(uint16_t *ptr, uint16_t *src, int len); +typedef void (*copy_rop_32_func_t)(uint32_t *ptr, uint32_t *src, int len); + +#define ROP_TABLE(_type, _size) \ +static void (*solid_rops_ ## _size[16]) (_type *ptr, int len, _type src) = { \ + solid_rop_clear_ ## _size, \ + solid_rop_and_ ## _size, \ + solid_rop_and_reverse_ ## _size, \ + solid_rop_copy_ ## _size, \ + solid_rop_and_inverted_ ## _size, \ + solid_rop_noop_ ## _size, \ + solid_rop_xor_ ## _size, \ + solid_rop_or_ ## _size, \ + solid_rop_nor_ ## _size, \ + solid_rop_equiv_ ## _size, \ + solid_rop_invert_ ## _size, \ + solid_rop_or_reverse_ ## _size, \ + solid_rop_copy_inverted_ ## _size, \ + solid_rop_or_inverted_ ## _size, \ + solid_rop_nand_ ## _size, \ + solid_rop_set_ ## _size \ +}; \ +static void (*tiled_rops_ ## _size[16]) (_type *ptr, int len, _type *tile, _type *tile_end, int tile_width) = { \ + tiled_rop_clear_ ## _size, \ + tiled_rop_and_ ## _size, \ + tiled_rop_and_reverse_ ## _size, \ + tiled_rop_copy_ ## _size, \ + tiled_rop_and_inverted_ ## _size, \ + tiled_rop_noop_ ## _size, \ + tiled_rop_xor_ ## _size, \ + tiled_rop_or_ ## _size, \ + tiled_rop_nor_ ## _size, \ + tiled_rop_equiv_ ## _size, \ + tiled_rop_invert_ ## _size, \ + tiled_rop_or_reverse_ ## _size, \ + tiled_rop_copy_inverted_ ## _size, \ + tiled_rop_or_inverted_ ## _size, \ + tiled_rop_nand_ ## _size, \ + tiled_rop_set_ ## _size \ +}; \ +static void (*copy_rops_ ## _size[16]) (_type *ptr, _type *tile, int len) = { \ + copy_rop_clear_ ## _size, \ + copy_rop_and_ ## _size, \ + copy_rop_and_reverse_ ## _size, \ + copy_rop_copy_ ## _size, \ + copy_rop_and_inverted_ ## _size, \ + copy_rop_noop_ ## _size, \ + copy_rop_xor_ ## _size, \ + copy_rop_or_ ## _size, \ + copy_rop_nor_ ## _size, \ + copy_rop_equiv_ ## _size, \ + copy_rop_invert_ ## _size, \ + copy_rop_or_reverse_ ## _size, \ + copy_rop_copy_inverted_ ## _size, \ + copy_rop_or_inverted_ ## _size, \ + copy_rop_nand_ ## _size, \ + copy_rop_set_ ## _size \ +}; + +ROP_TABLE(uint8_t, 8) +ROP_TABLE(uint16_t, 16) +ROP_TABLE(uint32_t, 32) + +/* We can't get the real bits per pixel info from pixman_image_t, + only the DEPTH which is the sum of all a+r+g+b bits, which + is e.g. 24 for 32bit xRGB. We really want the bpp, so + we have this ugly conversion thing */ +int spice_pixman_image_get_bpp(pixman_image_t *image) +{ + int depth; + + depth = pixman_image_get_depth(image); + if (depth == 24) { + return 32; + } + if (depth == 15) { + return 16; + } + return depth; +} + +void spice_pixman_fill_rect(pixman_image_t *dest, + int x, int y, + int width, int height, + uint32_t value) +{ + uint32_t *bits; + int stride, depth; + uint32_t byte_width; + uint8_t *byte_line; + + bits = pixman_image_get_data(dest); + stride = pixman_image_get_stride(dest); + depth = spice_pixman_image_get_bpp(dest); + /* stride is in bytes, depth in bits */ + + spice_assert(x >= 0); + spice_assert(y >= 0); + spice_assert(width > 0); + spice_assert(height > 0); + spice_assert(x + width <= pixman_image_get_width(dest)); + spice_assert(y + height <= pixman_image_get_height(dest)); + + if (pixman_fill(bits, + stride / 4, + depth, + x, y, + width, height, + value)) { + return; + } + + if (depth == 8) { + byte_line = ((uint8_t *)bits) + stride * y + x; + byte_width = width; + value = (value & 0xff) * 0x01010101; + } else if (depth == 16) { + byte_line = ((uint8_t *)bits) + stride * y + x * 2; + byte_width = 2 * width; + value = (value & 0xffff) * 0x00010001; + } else { + spice_assert (depth == 32); + byte_line = ((uint8_t *)bits) + stride * y + x * 4; + byte_width = 4 * width; + } + + while (height--) { + int w; + uint8_t *d = byte_line; + + byte_line += stride; + w = byte_width; + + while (w >= 1 && ((uintptr_t)d & 1)) { + *(uint8_t *)d = (value & 0xff); + w--; + d++; + } + + while (w >= 2 && ((uintptr_t)d & 3)) { + *(uint16_t *)d = value; + w -= 2; + d += 2; + } + + while (w >= 4 && ((uintptr_t)d & 7)) { + *(uint32_t *)d = value; + + w -= 4; + d += 4; + } + + while (w >= 4) { + *(uint32_t *)d = value; + + w -= 4; + d += 4; + } + + while (w >= 2) { + *(uint16_t *)d = value; + w -= 2; + d += 2; + } + + while (w >= 1) { + *(uint8_t *)d = (value & 0xff); + w--; + d++; + } + } +} + +void spice_pixman_fill_rect_rop(pixman_image_t *dest, + int x, int y, + int width, int height, + uint32_t value, + SpiceROP rop) +{ + uint32_t *bits; + int stride, depth; + uint8_t *byte_line; + + bits = pixman_image_get_data(dest); + stride = pixman_image_get_stride(dest); + depth = spice_pixman_image_get_bpp(dest); + /* stride is in bytes, depth in bits */ + + spice_assert(x >= 0); + spice_assert(y >= 0); + spice_assert(width > 0); + spice_assert(height > 0); + spice_assert(x + width <= pixman_image_get_width(dest)); + spice_assert(y + height <= pixman_image_get_height(dest)); + spice_assert(rop < 16); + + if (depth == 8) { + solid_rop_8_func_t rop_func = solid_rops_8[rop]; + + byte_line = ((uint8_t *)bits) + stride * y + x; + while (height--) { + rop_func((uint8_t *)byte_line, width, (uint8_t)value); + byte_line += stride; + } + + } else if (depth == 16) { + solid_rop_16_func_t rop_func = solid_rops_16[rop]; + + byte_line = ((uint8_t *)bits) + stride * y + x * 2; + while (height--) { + rop_func((uint16_t *)byte_line, width, (uint16_t)value); + byte_line += stride; + } + } else { + solid_rop_32_func_t rop_func = solid_rops_32[rop]; + + byte_line = ((uint8_t *)bits) + stride * y + x * 4; + while (height--) { + rop_func((uint32_t *)byte_line, width, (uint32_t)value); + byte_line += stride; + } + } +} + +void spice_pixman_tile_rect(pixman_image_t *dest, + int x, int y, + int width, int height, + pixman_image_t *tile, + int offset_x, + int offset_y) +{ + uint32_t *bits, *tile_bits; + int stride, depth; + int tile_width, tile_height, tile_stride; + uint8_t *byte_line; + uint8_t *tile_line; + int tile_start_x, tile_start_y, tile_end_dx; + + bits = pixman_image_get_data(dest); + stride = pixman_image_get_stride(dest); + depth = spice_pixman_image_get_bpp(dest); + /* stride is in bytes, depth in bits */ + + tile_bits = pixman_image_get_data(tile); + tile_stride = pixman_image_get_stride(tile); + tile_width = pixman_image_get_width(tile); + tile_height = pixman_image_get_height(tile); + + spice_assert(x >= 0); + spice_assert(y >= 0); + spice_assert(width > 0); + spice_assert(height > 0); + spice_assert(x + width <= pixman_image_get_width(dest)); + spice_assert(y + height <= pixman_image_get_height(dest)); + spice_assert(depth == spice_pixman_image_get_bpp(tile)); + + tile_start_x = (x - offset_x) % tile_width; + if (tile_start_x < 0) { + tile_start_x += tile_width; + } + tile_start_y = (y - offset_y) % tile_height; + if (tile_start_y < 0) { + tile_start_y += tile_height; + } + tile_end_dx = tile_width - tile_start_x; + + if (depth == 8) { + byte_line = ((uint8_t *)bits) + stride * y + x; + tile_line = ((uint8_t *)tile_bits) + tile_stride * tile_start_y + tile_start_x; + while (height--) { + tiled_rop_copy_8((uint8_t *)byte_line, width, + (uint8_t *)tile_line, (uint8_t *)tile_line + tile_end_dx, + tile_width); + byte_line += stride; + tile_line += tile_stride; + if (++tile_start_y == tile_height) { + tile_line -= tile_height * tile_stride; + tile_start_y = 0; + } + } + + } else if (depth == 16) { + byte_line = ((uint8_t *)bits) + stride * y + x * 2; + tile_line = ((uint8_t *)tile_bits) + tile_stride * tile_start_y + tile_start_x * 2; + while (height--) { + tiled_rop_copy_16((uint16_t *)byte_line, width, + (uint16_t *)tile_line, (uint16_t *)tile_line + tile_end_dx, + tile_width); + byte_line += stride; + tile_line += tile_stride; + if (++tile_start_y == tile_height) { + tile_line -= tile_height * tile_stride; + tile_start_y = 0; + } + } + } else { + spice_assert (depth == 32); + + byte_line = ((uint8_t *)bits) + stride * y + x * 4; + tile_line = ((uint8_t *)tile_bits) + tile_stride * tile_start_y + tile_start_x * 4; + while (height--) { + tiled_rop_copy_32((uint32_t *)byte_line, width, + (uint32_t *)tile_line, (uint32_t *)tile_line + tile_end_dx, + tile_width); + byte_line += stride; + tile_line += tile_stride; + if (++tile_start_y == tile_height) { + tile_line -= tile_height * tile_stride; + tile_start_y = 0; + } + } + } +} + +void spice_pixman_tile_rect_rop(pixman_image_t *dest, + int x, int y, + int width, int height, + pixman_image_t *tile, + int offset_x, + int offset_y, + SpiceROP rop) +{ + uint32_t *bits, *tile_bits; + int stride, depth; + int tile_width, tile_height, tile_stride; + uint8_t *byte_line; + uint8_t *tile_line; + int tile_start_x, tile_start_y, tile_end_dx; + + bits = pixman_image_get_data(dest); + stride = pixman_image_get_stride(dest); + depth = spice_pixman_image_get_bpp(dest); + /* stride is in bytes, depth in bits */ + + tile_bits = pixman_image_get_data(tile); + tile_stride = pixman_image_get_stride(tile); + tile_width = pixman_image_get_width(tile); + tile_height = pixman_image_get_height(tile); + + spice_assert(x >= 0); + spice_assert(y >= 0); + spice_assert(width > 0); + spice_assert(height > 0); + spice_assert(x + width <= pixman_image_get_width(dest)); + spice_assert(y + height <= pixman_image_get_height(dest)); + spice_assert(rop < 16); + spice_assert(depth == spice_pixman_image_get_bpp(tile)); + + tile_start_x = (x - offset_x) % tile_width; + if (tile_start_x < 0) { + tile_start_x += tile_width; + } + tile_start_y = (y - offset_y) % tile_height; + if (tile_start_y < 0) { + tile_start_y += tile_height; + } + tile_end_dx = tile_width - tile_start_x; + + if (depth == 8) { + tiled_rop_8_func_t rop_func = tiled_rops_8[rop]; + + byte_line = ((uint8_t *)bits) + stride * y + x; + tile_line = ((uint8_t *)tile_bits) + tile_stride * tile_start_y + tile_start_x; + while (height--) { + rop_func((uint8_t *)byte_line, width, + (uint8_t *)tile_line, (uint8_t *)tile_line + tile_end_dx, + tile_width); + byte_line += stride; + tile_line += tile_stride; + if (++tile_start_y == tile_height) { + tile_line -= tile_height * tile_stride; + tile_start_y = 0; + } + } + + } else if (depth == 16) { + tiled_rop_16_func_t rop_func = tiled_rops_16[rop]; + + byte_line = ((uint8_t *)bits) + stride * y + x * 2; + tile_line = ((uint8_t *)tile_bits) + tile_stride * tile_start_y + tile_start_x * 2; + while (height--) { + rop_func((uint16_t *)byte_line, width, + (uint16_t *)tile_line, (uint16_t *)tile_line + tile_end_dx, + tile_width); + byte_line += stride; + tile_line += tile_stride; + if (++tile_start_y == tile_height) { + tile_line -= tile_height * tile_stride; + tile_start_y = 0; + } + } + } else { + tiled_rop_32_func_t rop_func = tiled_rops_32[rop]; + + spice_assert (depth == 32); + + byte_line = ((uint8_t *)bits) + stride * y + x * 4; + tile_line = ((uint8_t *)tile_bits) + tile_stride * tile_start_y + tile_start_x * 4; + while (height--) { + rop_func((uint32_t *)byte_line, width, + (uint32_t *)tile_line, (uint32_t *)tile_line + tile_end_dx, + tile_width); + byte_line += stride; + tile_line += tile_stride; + if (++tile_start_y == tile_height) { + tile_line -= tile_height * tile_stride; + tile_start_y = 0; + } + } + } +} + + +void spice_pixman_blit(pixman_image_t *dest, + pixman_image_t *src, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height) +{ + uint32_t *bits, *src_bits; + int stride, depth, src_depth; + int src_width, src_height, src_stride; + uint8_t *byte_line; + uint8_t *src_line; + int byte_width; + + if (!src) { + fprintf(stderr, "missing src!"); + return; + } + + bits = pixman_image_get_data(dest); + stride = pixman_image_get_stride(dest); + depth = spice_pixman_image_get_bpp(dest); + /* stride is in bytes, depth in bits */ + + src_bits = pixman_image_get_data(src); + src_stride = pixman_image_get_stride(src); + src_width = pixman_image_get_width(src); + src_height = pixman_image_get_height(src); + src_depth = spice_pixman_image_get_bpp(src); + + /* Clip source */ + if (src_x < 0) { + width += src_x; + dest_x -= src_x; + src_x = 0; + } + if (src_y < 0) { + height += src_y; + dest_y -= src_y; + src_y = 0; + } + if (src_x + width > src_width) { + width = src_width - src_x; + } + if (src_y + height > src_height) { + height = src_height - src_y; + } + + if (width <= 0 || height <= 0) { + return; + } + + spice_assert(src_x >= 0); + spice_assert(src_y >= 0); + spice_assert(dest_x >= 0); + spice_assert(dest_y >= 0); + spice_assert(width > 0); + spice_assert(height > 0); + spice_assert(dest_x + width <= pixman_image_get_width(dest)); + spice_assert(dest_y + height <= pixman_image_get_height(dest)); + spice_assert(src_x + width <= pixman_image_get_width(src)); + spice_assert(src_y + height <= pixman_image_get_height(src)); + spice_assert(depth == src_depth); + + if (pixman_blt(src_bits, + bits, + src_stride / 4, + stride / 4, + depth, depth, + src_x, src_y, + dest_x, dest_y, + width, height)) { + return; + } + + if (depth == 8) { + byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x; + byte_width = width; + src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x; + } else if (depth == 16) { + byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 2; + byte_width = width * 2; + src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 2; + } else { + spice_assert (depth == 32); + byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 4; + byte_width = width * 4; + src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 4; + } + + while (height--) { + memcpy(byte_line, src_line, byte_width); + byte_line += stride; + src_line += src_stride; + } +} + +void spice_pixman_blit_rop (pixman_image_t *dest, + pixman_image_t *src, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height, + SpiceROP rop) +{ + uint32_t *bits, *src_bits; + int stride, depth, src_depth; + int src_width, src_height, src_stride; + uint8_t *byte_line; + uint8_t *src_line; + + bits = pixman_image_get_data(dest); + stride = pixman_image_get_stride(dest); + depth = spice_pixman_image_get_bpp(dest); + /* stride is in bytes, depth in bits */ + + src_bits = pixman_image_get_data(src); + src_stride = pixman_image_get_stride(src); + src_width = pixman_image_get_width(src); + src_height = pixman_image_get_height(src); + src_depth = spice_pixman_image_get_bpp(src); + + /* Clip source */ + if (src_x < 0) { + width += src_x; + dest_x -= src_x; + src_x = 0; + } + if (src_y < 0) { + height += src_y; + dest_y -= src_y; + src_y = 0; + } + if (src_x + width > src_width) { + width = src_width - src_x; + } + if (src_y + height > src_height) { + height = src_height - src_y; + } + + if (width <= 0 || height <= 0) { + return; + } + + spice_assert(src_x >= 0); + spice_assert(src_y >= 0); + spice_assert(dest_x >= 0); + spice_assert(dest_y >= 0); + spice_assert(width > 0); + spice_assert(height > 0); + spice_assert(dest_x + width <= pixman_image_get_width(dest)); + spice_assert(dest_y + height <= pixman_image_get_height(dest)); + spice_assert(src_x + width <= pixman_image_get_width(src)); + spice_assert(src_y + height <= pixman_image_get_height(src)); + spice_assert(depth == src_depth); + + if (depth == 8) { + copy_rop_8_func_t rop_func = copy_rops_8[rop]; + + byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x; + src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x; + + while (height--) { + rop_func((uint8_t *)byte_line, (uint8_t *)src_line, width); + byte_line += stride; + src_line += src_stride; + } + } else if (depth == 16) { + copy_rop_16_func_t rop_func = copy_rops_16[rop]; + + byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 2; + src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 2; + + while (height--) { + rop_func((uint16_t *)byte_line, (uint16_t *)src_line, width); + byte_line += stride; + src_line += src_stride; + } + } else { + copy_rop_32_func_t rop_func = copy_rops_32[rop]; + + spice_assert (depth == 32); + byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 4; + src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 4; + + while (height--) { + rop_func((uint32_t *)byte_line, (uint32_t *)src_line, width); + byte_line += stride; + src_line += src_stride; + } + } + +} + +void spice_pixman_blit_colorkey (pixman_image_t *dest, + pixman_image_t *src, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height, + uint32_t transparent_color) +{ + uint32_t *bits, *src_bits; + int stride, depth; + int src_width, src_height, src_stride; + uint8_t *byte_line; + uint8_t *src_line; + int x; + + bits = pixman_image_get_data(dest); + stride = pixman_image_get_stride(dest); + depth = spice_pixman_image_get_bpp(dest); + /* stride is in bytes, depth in bits */ + + src_bits = pixman_image_get_data(src); + src_stride = pixman_image_get_stride(src); + src_width = pixman_image_get_width(src); + src_height = pixman_image_get_height(src); + + /* Clip source */ + if (src_x < 0) { + width += src_x; + dest_x -= src_x; + src_x = 0; + } + if (src_y < 0) { + height += src_y; + dest_y -= src_y; + src_y = 0; + } + if (src_x + width > src_width) { + width = src_width - src_x; + } + if (src_y + height > src_height) { + height = src_height - src_y; + } + + if (width <= 0 || height <= 0) { + return; + } + + spice_assert(src_x >= 0); + spice_assert(src_y >= 0); + spice_assert(dest_x >= 0); + spice_assert(dest_y >= 0); + spice_assert(width > 0); + spice_assert(height > 0); + spice_assert(dest_x + width <= pixman_image_get_width(dest)); + spice_assert(dest_y + height <= pixman_image_get_height(dest)); + spice_assert(src_x + width <= pixman_image_get_width(src)); + spice_assert(src_y + height <= pixman_image_get_height(src)); + spice_assert(depth == spice_pixman_image_get_bpp(src)); + + if (depth == 8) { + byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x; + src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x; + + while (height--) { + uint8_t *d = (uint8_t *)byte_line; + uint8_t *s = (uint8_t *)src_line; + for (x = 0; x < width; x++) { + uint8_t val = *s; + if (val != (uint8_t)transparent_color) { + *d = val; + } + s++; d++; + } + + byte_line += stride; + src_line += src_stride; + } + } else if (depth == 16) { + byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 2; + src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 2; + + while (height--) { + uint16_t *d = (uint16_t *)byte_line; + uint16_t *s = (uint16_t *)src_line; + + for (x = 0; x < width; x++) { + uint16_t val = *s; + if (val != (uint16_t)transparent_color) { + *d = val; + } + s++; d++; + } + + byte_line += stride; + src_line += src_stride; + } + } else { + spice_assert (depth == 32); + byte_line = ((uint8_t *)bits) + stride * dest_y + dest_x * 4; + src_line = ((uint8_t *)src_bits) + src_stride * src_y + src_x * 4; + + while (height--) { + uint32_t *d = (uint32_t *)byte_line; + uint32_t *s = (uint32_t *)src_line; + + transparent_color &= 0xffffff; + for (x = 0; x < width; x++) { + uint32_t val = *s; + if ((0xffffff & val) != transparent_color) { + *d = val; + } + s++; d++; + } + + byte_line += stride; + src_line += src_stride; + } + } +} + +static void copy_bits_up(uint8_t *data, const int stride, int bpp, + const int src_x, const int src_y, + const int width, const int height, + const int dest_x, const int dest_y) +{ + uint8_t *src = data + src_y * stride + src_x * bpp; + uint8_t *dest = data + dest_y * stride + dest_x * bpp; + uint8_t *end = dest + height * stride; + for (; dest != end; dest += stride, src += stride) { + memcpy(dest, src, width * bpp); + } +} + +static void copy_bits_down(uint8_t *data, const int stride, int bpp, + const int src_x, const int src_y, + const int width, const int height, + const int dest_x, const int dest_y) +{ + uint8_t *src = data + (src_y + height - 1) * stride + src_x * bpp; + uint8_t *end = data + (dest_y - 1) * stride + dest_x * bpp; + uint8_t *dest = end + height * stride; + + for (; dest != end; dest -= stride, src -= stride) { + memcpy(dest, src, width * bpp); + } +} + +static void copy_bits_same_line(uint8_t *data, const int stride, int bpp, + const int src_x, const int src_y, + const int width, const int height, + const int dest_x, const int dest_y) +{ + uint8_t *src = data + src_y * stride + src_x * bpp; + uint8_t *dest = data + dest_y * stride + dest_x * bpp; + uint8_t *end = dest + height * stride; + for (; dest != end; dest += stride, src += stride) { + memmove(dest, src, width * bpp); + } +} + +void spice_pixman_copy_rect (pixman_image_t *image, + int src_x, int src_y, + int width, int height, + int dest_x, int dest_y) +{ + uint8_t *data; + int stride; + int bpp; + + data = (uint8_t *)pixman_image_get_data(image); + stride = pixman_image_get_stride(image); + bpp = spice_pixman_image_get_bpp(image) / 8; + + if (dest_y > src_y) { + copy_bits_down(data, stride, bpp, + src_x, src_y, + width, height, + dest_x, dest_y); + } else if (dest_y < src_y) { + copy_bits_up(data, stride, bpp, + src_x, src_y, + width, height, + dest_x, dest_y); + } else { + copy_bits_same_line(data, stride, bpp, + src_x, src_y, + width, height, + dest_x, dest_y); + } +} + +pixman_bool_t spice_pixman_region32_init_rects (pixman_region32_t *region, + const SpiceRect *rects, + int count) +{ + /* These types are compatible, so just cast */ + return pixman_region32_init_rects(region, (pixman_box32_t *)rects, count); +} + +pixman_format_code_t spice_surface_format_to_pixman(uint32_t surface_format) +{ + switch (surface_format) { + case SPICE_SURFACE_FMT_1_A: + return PIXMAN_a1; + case SPICE_SURFACE_FMT_8_A: + return PIXMAN_a8; + case SPICE_SURFACE_FMT_16_555: + return PIXMAN_x1r5g5b5; + case SPICE_SURFACE_FMT_16_565: + return PIXMAN_r5g6b5; + case SPICE_SURFACE_FMT_32_xRGB: + return PIXMAN_x8r8g8b8; + case SPICE_SURFACE_FMT_32_ARGB: + return PIXMAN_a8r8g8b8; + default: + printf("Unknown surface format %d\n", surface_format); + spice_abort(); + break; + } + return (pixman_format_code_t)0; /* Not reached */ +} + +/* Returns the "spice native" pixman version of a specific bitmap format. + * This isn't bitwise the same as the bitmap format, for instance we + * typically convert indexed to real color modes and use the standard + * surface modes rather than weird things like 24bit + */ +pixman_format_code_t spice_bitmap_format_to_pixman(int bitmap_format, + uint32_t palette_surface_format) +{ + switch (bitmap_format) { + case SPICE_BITMAP_FMT_1BIT_LE: + case SPICE_BITMAP_FMT_1BIT_BE: + case SPICE_BITMAP_FMT_4BIT_LE: + case SPICE_BITMAP_FMT_4BIT_BE: + case SPICE_BITMAP_FMT_8BIT: + /* Indexed mode palettes are the same as their destination canvas format */ + return spice_surface_format_to_pixman(palette_surface_format); + + case SPICE_BITMAP_FMT_16BIT: + return PIXMAN_x1r5g5b5; + + case SPICE_BITMAP_FMT_24BIT: + case SPICE_BITMAP_FMT_32BIT: + return PIXMAN_x8r8g8b8; + + case SPICE_BITMAP_FMT_RGBA: + return PIXMAN_a8r8g8b8; + + case SPICE_BITMAP_FMT_INVALID: + default: + printf("Unknown bitmap format %d\n", bitmap_format); + spice_abort(); + return PIXMAN_a8r8g8b8; + } +} + +/* Tries to view a spice bitmap as a pixman_image_t without copying, + * will often fail due to unhandled formats or strides. + */ +pixman_image_t *spice_bitmap_try_as_pixman(int src_format, + int flags, + int width, + int height, + uint8_t *data, + int stride) +{ + pixman_format_code_t pixman_format; + + /* Pixman stride must be multiple of 4 */ + if (stride % 4 != 0) { + return NULL; + } + + switch (src_format) { + case SPICE_BITMAP_FMT_32BIT: +#ifdef WORDS_BIGENDIAN + pixman_format = PIXMAN_b8g8r8x8; +#else + pixman_format = PIXMAN_x8r8g8b8; +#endif + break; + case SPICE_BITMAP_FMT_RGBA: +#ifdef WORDS_BIGENDIAN + pixman_format = PIXMAN_b8g8r8a8; +#else + pixman_format = PIXMAN_a8r8g8b8; +#endif + break; + case SPICE_BITMAP_FMT_24BIT: +#ifdef WORDS_BIGENDIAN + pixman_format = PIXMAN_b8g8r8; +#else + pixman_format = PIXMAN_r8g8b8; +#endif + break; + case SPICE_BITMAP_FMT_16BIT: +#ifdef WORDS_BIGENDIAN + return NULL; +#else + pixman_format = PIXMAN_x1r5g5b5; +#endif + break; + + default: + return NULL; + } + + if (!(flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) { + data += stride * (height - 1); + stride = -stride; + } + + return pixman_image_create_bits (pixman_format, + width, + height, + (uint32_t *)data, + stride); +} + +#ifdef WORDS_BIGENDIAN +#define UINT16_FROM_LE(x) SPICE_BYTESWAP16(x) +#define UINT32_FROM_LE(x) SPICE_BYTESWAP32(x) +#else +#define UINT16_FROM_LE(x) (x) +#define UINT32_FROM_LE(x) (x) +#endif + +static INLINE uint32_t rgb_16_555_to_32(uint16_t color) +{ + uint32_t ret; + + ret = ((color & 0x001f) << 3) | ((color & 0x001c) >> 2); + ret |= ((color & 0x03e0) << 6) | ((color & 0x0380) << 1); + ret |= ((color & 0x7c00) << 9) | ((color & 0x7000) << 4); + + return ret; +} + +static INLINE uint16_t rgb_32_to_16_555(uint32_t color) +{ + return + (((color) >> 3) & 0x001f) | + (((color) >> 6) & 0x03e0) | + (((color) >> 9) & 0x7c00); +} + + +static void bitmap_32_to_32(uint8_t* dest, int dest_stride, + uint8_t* src, int src_stride, + int width, uint8_t* end) +{ +#ifdef WORDS_BIGENDIAN + for (; src != end; src += src_stride, dest += dest_stride) { + uint32_t* src_line = (uint32_t *)src; + uint32_t* src_line_end = src_line + width; + uint32_t* dest_line = (uint32_t *)dest; + + for (; src_line < src_line_end; ++dest_line, ++src_line) { + *dest_line = UINT32_FROM_LE(*src_line); + } + } +#else + for (; src != end; src += src_stride, dest += dest_stride) { + memcpy(dest, src, width * 4); + } +#endif +} + +static void bitmap_24_to_32(uint8_t* dest, int dest_stride, + uint8_t* src, int src_stride, + int width, uint8_t* end) +{ + for (; src != end; src += src_stride, dest += dest_stride) { + uint8_t* src_line = src; + uint8_t* src_line_end = src_line + width * 3; + uint32_t* dest_line = (uint32_t *)dest; + + for (; src_line < src_line_end; ++dest_line) { + uint32_t r, g, b; + b = *(src_line++); + g = *(src_line++); + r = *(src_line++); + *dest_line = (r << 16) | (g << 8) | (b); + } + } +} + +static void bitmap_16_to_16_555(uint8_t* dest, int dest_stride, + uint8_t* src, int src_stride, + int width, uint8_t* end) +{ +#ifdef WORDS_BIGENDIAN + for (; src != end; src += src_stride, dest += dest_stride) { + uint16_t* src_line = (uint16_t *)src; + uint16_t* src_line_end = src_line + width; + uint16_t* dest_line = (uint16_t *)dest; + + for (; src_line < src_line_end; ++dest_line, ++src_line) { + *dest_line = UINT16_FROM_LE(*src_line); + } + } +#else + for (; src != end; src += src_stride, dest += dest_stride) { + memcpy(dest, src, width * 2); + } +#endif +} + +static void bitmap_8_32_to_32(uint8_t *dest, int dest_stride, + uint8_t *src, int src_stride, + int width, uint8_t *end, + SpicePalette *palette) +{ + uint32_t local_ents[256]; + uint32_t *ents; + int n_ents; +#ifdef WORDS_BIGENDIAN + int i; +#endif + + if (!palette) { + spice_error("No palette"); + return; + } + + n_ents = MIN(palette->num_ents, 256); + ents = palette->ents; + + if (n_ents < 255 +#ifdef WORDS_BIGENDIAN + || TRUE +#endif + ) { + memcpy(local_ents, ents, n_ents*4); + ents = local_ents; + +#ifdef WORDS_BIGENDIAN + for (i = 0; i < n_ents; i++) { + ents[i] = UINT32_FROM_LE(ents[i]); + } +#endif + } + + for (; src != end; src += src_stride, dest += dest_stride) { + uint32_t *dest_line = (uint32_t*)dest; + uint8_t *src_line = src; + uint8_t *src_line_end = src_line + width; + + while (src_line < src_line_end) { + *(dest_line++) = ents[*(src_line++)]; + } + } +} + +static void bitmap_8_16_to_16_555(uint8_t *dest, int dest_stride, + uint8_t *src, int src_stride, + int width, uint8_t *end, + SpicePalette *palette) +{ + uint32_t local_ents[256]; + uint32_t *ents; + int n_ents; +#ifdef WORDS_BIGENDIAN + int i; +#endif + + if (!palette) { + spice_error("No palette"); + return; + } + + n_ents = MIN(palette->num_ents, 256); + ents = palette->ents; + + if (n_ents < 255 +#ifdef WORDS_BIGENDIAN + || TRUE +#endif + ) { + memcpy(local_ents, ents, n_ents*4); + ents = local_ents; + +#ifdef WORDS_BIGENDIAN + for (i = 0; i < n_ents; i++) { + ents[i] = UINT32_FROM_LE(ents[i]); + } +#endif + } + + for (; src != end; src += src_stride, dest += dest_stride) { + uint16_t *dest_line = (uint16_t*)dest; + uint8_t *src_line = src; + uint8_t *src_line_end = src_line + width; + + while (src_line < src_line_end) { + *(dest_line++) = ents[*(src_line++)]; + } + } +} + +static void bitmap_4be_32_to_32(uint8_t* dest, int dest_stride, + uint8_t* src, int src_stride, + int width, uint8_t* end, + SpicePalette *palette) +{ + uint32_t local_ents[16]; + uint32_t *ents; + int n_ents; +#ifdef WORDS_BIGENDIAN + int i; +#endif + + if (!palette) { + spice_error("No palette"); + return; + } + + n_ents = MIN(palette->num_ents, 16); + ents = palette->ents; + + if (n_ents < 16 +#ifdef WORDS_BIGENDIAN + || TRUE +#endif + ) { + memcpy(local_ents, ents, n_ents*4); + ents = local_ents; + +#ifdef WORDS_BIGENDIAN + for (i = 0; i < n_ents; i++) { + ents[i] = UINT32_FROM_LE(ents[i]); + } +#endif + } + + for (; src != end; src += src_stride, dest += dest_stride) { + uint32_t *dest_line = (uint32_t *)dest; + uint8_t *row = src; + int i; + + for (i = 0; i < (width >> 1); i++) { + *(dest_line++) = ents[(*row >> 4) & 0x0f]; + *(dest_line++) = ents[*(row++) & 0x0f]; + } + if (width & 1) { + *(dest_line) = ents[(*row >> 4) & 0x0f]; + } + } +} + +static void bitmap_4be_16_to_16_555(uint8_t* dest, int dest_stride, + uint8_t* src, int src_stride, + int width, uint8_t* end, + SpicePalette *palette) +{ + uint32_t local_ents[16]; + uint32_t *ents; + int n_ents; +#ifdef WORDS_BIGENDIAN + int i; +#endif + + if (!palette) { + spice_error("No palette"); + return; + } + + n_ents = MIN(palette->num_ents, 16); + ents = palette->ents; + + if (n_ents < 16 +#ifdef WORDS_BIGENDIAN + || TRUE +#endif + ) { + memcpy(local_ents, ents, n_ents*4); + ents = local_ents; + +#ifdef WORDS_BIGENDIAN + for (i = 0; i < n_ents; i++) { + ents[i] = UINT32_FROM_LE(ents[i]); + } +#endif + } + + for (; src != end; src += src_stride, dest += dest_stride) { + uint16_t *dest_line = (uint16_t *)dest; + uint8_t *row = src; + int i; + + for (i = 0; i < (width >> 1); i++) { + *(dest_line++) = ents[(*row >> 4) & 0x0f]; + *(dest_line++) = ents[*(row++) & 0x0f]; + } + if (width & 1) { + *(dest_line) = ents[(*row >> 4) & 0x0f]; + } + } +} + +static INLINE int test_bit_be(void* addr, int bit) +{ + return !!(((uint8_t*)addr)[bit >> 3] & (0x80 >> (bit & 0x07))); +} + +static void bitmap_1be_32_to_32(uint8_t* dest, int dest_stride, + uint8_t* src, int src_stride, + int width, uint8_t* end, + SpicePalette *palette) +{ + uint32_t fore_color; + uint32_t back_color; + + spice_assert(palette != NULL); + + if (!palette) { + return; + } + + fore_color = UINT32_FROM_LE(palette->ents[1]); + back_color = UINT32_FROM_LE(palette->ents[0]); + + for (; src != end; src += src_stride, dest += dest_stride) { + uint32_t* dest_line = (uint32_t*)dest; + int i; + + for (i = 0; i < width; i++) { + if (test_bit_be(src, i)) { + *(dest_line++) = fore_color; + } else { + *(dest_line++) = back_color; + } + } + } +} + + +static void bitmap_1be_16_to_16_555(uint8_t* dest, int dest_stride, + uint8_t* src, int src_stride, + int width, uint8_t* end, + SpicePalette *palette) +{ + uint16_t fore_color; + uint16_t back_color; + + spice_assert(palette != NULL); + + if (!palette) { + return; + } + + fore_color = (uint16_t) UINT32_FROM_LE(palette->ents[1]); + back_color = (uint16_t) UINT32_FROM_LE(palette->ents[0]); + + for (; src != end; src += src_stride, dest += dest_stride) { + uint16_t* dest_line = (uint16_t*)dest; + int i; + + for (i = 0; i < width; i++) { + if (test_bit_be(src, i)) { + *(dest_line++) = fore_color; + } else { + *(dest_line++) = back_color; + } + } + } +} + +#ifdef NOT_USED_ATM + +static void bitmap_16_to_32(uint8_t* dest, int dest_stride, + uint8_t* src, int src_stride, + int width, uint8_t* end) +{ + for (; src != end; src += src_stride, dest += dest_stride) { + uint16_t* src_line = (uint16_t*)src; + uint16_t* src_line_end = src_line + width; + uint32_t* dest_line = (uint32_t*)dest; + + for (; src_line < src_line_end; ++dest_line, src_line++) { + *dest_line = rgb_16_555_to_32(UINT16_FROM_LE(*src_line)); + } + } +} + +static void bitmap_32_to_16_555(uint8_t* dest, int dest_stride, + uint8_t* src, int src_stride, + int width, uint8_t* end) +{ + for (; src != end; src += src_stride, dest += dest_stride) { + uint32_t* src_line = (uint32_t *)src; + uint32_t* src_line_end = src_line + width; + uint16_t* dest_line = (uint16_t *)dest; + + for (; src_line < src_line_end; ++dest_line, ++src_line) { + *dest_line = rgb_32_to_16_555(UINT16_FROM_LE(*src_line)); + } + } +} + + +static void bitmap_24_to_16_555(uint8_t* dest, int dest_stride, + uint8_t* src, int src_stride, + int width, uint8_t* end) +{ + for (; src != end; src += src_stride, dest += dest_stride) { + uint8_t* src_line = src; + uint8_t* src_line_end = src_line + width * 3; + uint16_t* dest_line = (uint16_t *)dest; + + for (; src_line < src_line_end; ++dest_line) { + uint8_t r, g, b; + b = *(src_line++); + g = *(src_line++); + r = *(src_line++); + *dest_line = rgb_32_to_16_555(r << 24 | g << 16 | b); + } + } +} + +#endif + +/* This assumes that the dest, if set is the same format as + spice_bitmap_format_to_pixman would have picked */ +pixman_image_t *spice_bitmap_to_pixman(pixman_image_t *dest_image, + int src_format, + int flags, + int width, + int height, + uint8_t *src, + int src_stride, + uint32_t palette_surface_format, + SpicePalette *palette) +{ + uint8_t* dest; + int dest_stride; + uint8_t* end; + + if (dest_image == NULL) { + pixman_format_code_t dest_format; + + dest_format = spice_bitmap_format_to_pixman(src_format, + palette_surface_format); + dest_image = pixman_image_create_bits (dest_format, + width, height, + NULL, 0); + } + + dest = (uint8_t *)pixman_image_get_data(dest_image); + dest_stride = pixman_image_get_stride(dest_image); + if (!(flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) { + spice_assert(height > 0); + dest += dest_stride * (height - 1); + dest_stride = -dest_stride; + } + end = src + (height * src_stride); + + switch (src_format) { + case SPICE_BITMAP_FMT_32BIT: + case SPICE_BITMAP_FMT_RGBA: + bitmap_32_to_32(dest, dest_stride, src, src_stride, width, end); + break; + case SPICE_BITMAP_FMT_24BIT: + bitmap_24_to_32(dest, dest_stride, src, src_stride, width, end); + break; + case SPICE_BITMAP_FMT_16BIT: + bitmap_16_to_16_555(dest, dest_stride, src, src_stride, width, end); + break; + case SPICE_BITMAP_FMT_8BIT: + if (palette_surface_format == SPICE_SURFACE_FMT_32_ARGB || + palette_surface_format == SPICE_SURFACE_FMT_32_xRGB) { + bitmap_8_32_to_32(dest, dest_stride, src, src_stride, width, end, palette); + } else if (palette_surface_format == SPICE_SURFACE_FMT_16_555) { + bitmap_8_16_to_16_555(dest, dest_stride, src, src_stride, width, end, palette); + } else { + spice_error("Unsupported palette format"); + } + break; + case SPICE_BITMAP_FMT_4BIT_BE: + if (palette_surface_format == SPICE_SURFACE_FMT_32_ARGB || + palette_surface_format == SPICE_SURFACE_FMT_32_xRGB) { + bitmap_4be_32_to_32(dest, dest_stride, src, src_stride, width, end, palette); + } else if (palette_surface_format == SPICE_SURFACE_FMT_16_555) { + bitmap_4be_16_to_16_555(dest, dest_stride, src, src_stride, width, end, palette); + } else { + spice_error("Unsupported palette format"); + } + break; + case SPICE_BITMAP_FMT_1BIT_BE: + if (palette_surface_format == SPICE_SURFACE_FMT_32_ARGB || + palette_surface_format == SPICE_SURFACE_FMT_32_xRGB) { + bitmap_1be_32_to_32(dest, dest_stride, src, src_stride, width, end, palette); + } else if (palette_surface_format == SPICE_SURFACE_FMT_16_555) { + bitmap_1be_16_to_16_555(dest, dest_stride, src, src_stride, width, end, palette); + } else { + spice_error("Unsupported palette format"); + } + break; + default: + spice_error("Unsupported bitmap format"); + break; + } + + return dest_image; +} + +static int pixman_format_compatible (pixman_format_code_t dest_format, + pixman_format_code_t src_format) +{ + if (dest_format == src_format) { + return TRUE; + } + + if (src_format == PIXMAN_a8r8g8b8 && + dest_format == PIXMAN_x8r8g8b8) { + /* This is the same, we just ignore the alphas */ + return TRUE; + } + + return FALSE; +} + +pixman_image_t *spice_bitmap_convert_to_pixman(pixman_format_code_t dest_format, + pixman_image_t *dest_image, + int src_format, + int flags, + int width, + int height, + uint8_t *src, + int src_stride, + uint32_t palette_surface_format, + SpicePalette *palette) +{ + pixman_image_t *src_image; + pixman_format_code_t native_format; + + if (dest_image == NULL) { + dest_image = pixman_image_create_bits (dest_format, + width, height, + NULL, 0); + } + + native_format = + spice_bitmap_format_to_pixman(src_format, palette_surface_format); + + if (pixman_format_compatible (dest_format, native_format)) { + return spice_bitmap_to_pixman(dest_image, + src_format, + flags, width,height, + src, src_stride, + palette_surface_format, palette); + } + + src_image = spice_bitmap_try_as_pixman(src_format, + flags, width,height, + src, src_stride); + + /* Can't convert directly, need a temporary copy + * Hopefully most bitmap reads should not need conversion (i.e. + * hit the spice_bitmap_to_pixmap case above) or work with the + * try_as_pixmap case, but in case some specific combination + * shows up here commonly we might want to add non-temporary + * conversion special casing here */ + if (src_image == NULL) { + src_image = spice_bitmap_to_pixman(NULL, + src_format, + flags, width,height, + src, src_stride, + palette_surface_format, palette); + } + + pixman_image_composite32 (PIXMAN_OP_SRC, + src_image, NULL, dest_image, + 0, 0, + 0, 0, + 0, 0, + width, height); + + pixman_image_unref (src_image); + + return dest_image; +} diff -Nru spice-gtk-0.9/spice-common/common/pixman_utils.h spice-gtk-0.12/spice-common/common/pixman_utils.h --- spice-gtk-0.9/spice-common/common/pixman_utils.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/pixman_utils.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,133 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H__PIXMAN_UTILS +#define _H__PIXMAN_UTILS + +#include +#include +#include +#define PIXMAN_DONT_DEFINE_STDINT +#include + +#include "draw.h" + +SPICE_BEGIN_DECLS + +/* This lists all possible 2 argument binary raster ops. + * This enum has the same values as the X11 GXcopy type + * and same as the GL constants (GL_AND etc) if you + * or it with 0x1500. However it is not exactly the + * same as the win32 ROP2 type (they use another order). + */ +typedef enum { + SPICE_ROP_CLEAR, /* 0x0 0 */ + SPICE_ROP_AND, /* 0x1 src AND dst */ + SPICE_ROP_AND_REVERSE, /* 0x2 src AND NOT dst */ + SPICE_ROP_COPY, /* 0x3 src */ + SPICE_ROP_AND_INVERTED, /* 0x4 (NOT src) AND dst */ + SPICE_ROP_NOOP, /* 0x5 dst */ + SPICE_ROP_XOR, /* 0x6 src XOR dst */ + SPICE_ROP_OR, /* 0x7 src OR dst */ + SPICE_ROP_NOR, /* 0x8 (NOT src) AND (NOT dst) */ + SPICE_ROP_EQUIV, /* 0x9 (NOT src) XOR dst */ + SPICE_ROP_INVERT, /* 0xa NOT dst */ + SPICE_ROP_OR_REVERSE, /* 0xb src OR (NOT dst) */ + SPICE_ROP_COPY_INVERTED, /* 0xc NOT src */ + SPICE_ROP_OR_INVERTED, /* 0xd (NOT src) OR dst */ + SPICE_ROP_NAND, /* 0xe (NOT src) OR (NOT dst) */ + SPICE_ROP_SET /* 0xf 1 */ +} SpiceROP; + + +int spice_pixman_image_get_bpp(pixman_image_t *image); + +pixman_format_code_t spice_surface_format_to_pixman(uint32_t surface_format); +pixman_format_code_t spice_bitmap_format_to_pixman(int bitmap_format, + uint32_t palette_surface_format); +pixman_image_t *spice_bitmap_try_as_pixman(int src_format, int flags, + int width, int height, + uint8_t *data, int stride); +pixman_image_t *spice_bitmap_to_pixman(pixman_image_t *dest_image, + int src_format, int flags, + int width, int height, + uint8_t *src, int src_stride, + uint32_t palette_surface_format, + SpicePalette *palette); +pixman_image_t *spice_bitmap_convert_to_pixman(pixman_format_code_t dest_format, + pixman_image_t *dest_image, + int src_format, int flags, + int width, int height, + uint8_t *src, int src_stride, + uint32_t palette_surface_format, + SpicePalette *palette); + +void spice_pixman_region32_init_from_bitmap(pixman_region32_t *region, + uint32_t *data, + int width, int height, + int stride); +pixman_bool_t spice_pixman_region32_init_rects(pixman_region32_t *region, + const SpiceRect *rects, + int count); +void spice_pixman_fill_rect(pixman_image_t *dest, + int x, int y, + int w, int h, + uint32_t value); +void spice_pixman_fill_rect_rop(pixman_image_t *dest, + int x, int y, + int w, int h, + uint32_t value, + SpiceROP rop); +void spice_pixman_tile_rect(pixman_image_t *dest, + int x, int y, + int w, int h, + pixman_image_t *tile, + int offset_x, + int offset_y); +void spice_pixman_tile_rect_rop(pixman_image_t *dest, + int x, int y, + int w, int h, + pixman_image_t *tile, + int offset_x, + int offset_y, + SpiceROP rop); +void spice_pixman_blit(pixman_image_t *dest, + pixman_image_t *src, + int src_x, int src_y, + int dest_x, int dest_y, + int w, int h); +void spice_pixman_blit_rop(pixman_image_t *dest, + pixman_image_t *src, + int src_x, int src_y, + int dest_x, int dest_y, + int w, int h, + SpiceROP rop); +void spice_pixman_blit_colorkey(pixman_image_t *dest, + pixman_image_t *src, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height, + uint32_t transparent_color); +void spice_pixman_copy_rect(pixman_image_t *image, + int src_x, int src_y, + int w, int h, + int dest_x, int dest_y); + +SPICE_END_DECLS + +#endif /* _H__PIXMAN_UTILS */ diff -Nru spice-gtk-0.9/spice-common/common/quic.c spice-gtk-0.12/spice-common/common/quic.c --- spice-gtk-0.9/spice-common/common/quic.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/quic.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,1689 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +// Red Hat image compression based on SFALIC by Roman Starosolski +// http://sun.iinf.polsl.gliwice.pl/~rstaros/sfalic/index.html + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "quic.h" +#include "spice_common.h" +#include "bitops.h" + +#define RLE +#define RLE_STAT +#define PRED_1 +//#define RLE_PRED_1 +#define RLE_PRED_2 +//#define RLE_PRED_3 +#define QUIC_RGB + +#define QUIC_MAGIC (*(uint32_t *)"QUIC") +#define QUIC_VERSION_MAJOR 0U +#define QUIC_VERSION_MINOR 1U +#define QUIC_VERSION ((QUIC_VERSION_MAJOR << 16) | (QUIC_VERSION_MAJOR & 0xffff)) + +typedef uint8_t BYTE; + +/* maximum number of codes in family */ +#define MAXNUMCODES 8 + +/* model evolution, warning: only 1,3 and 5 allowed */ +#define DEFevol 3 +#define MINevol 0 +#define MAXevol 5 + +/* starting wait mask index */ +#define DEFwmistart 0 +#define MINwmistart 0 + +/* codeword length limit */ +#define DEFmaxclen 26 + +/* target wait mask index */ +#define DEFwmimax 6 + +/* number of symbols to encode before increasing wait mask index */ +#define DEFwminext 2048 +#define MINwminext 1 +#define MAXwminext 100000000 + +typedef struct QuicFamily { + unsigned int nGRcodewords[MAXNUMCODES]; /* indexed by code number, contains number of + unmodified GR codewords in the code */ + unsigned int notGRcwlen[MAXNUMCODES]; /* indexed by code number, contains codeword + length of the not-GR codeword */ + unsigned int notGRprefixmask[MAXNUMCODES]; /* indexed by code number, contains mask to + determine if the codeword is GR or not-GR */ + unsigned int notGRsuffixlen[MAXNUMCODES]; /* indexed by code number, contains suffix + length of the not-GR codeword */ + + /* array for translating distribution U to L for depths up to 8 bpp, + initialized by decorelateinit() */ + BYTE xlatU2L[256]; + + /* array for translating distribution L to U for depths up to 8 bpp, + initialized by corelateinit() */ + unsigned int xlatL2U[256]; +} QuicFamily; + +static QuicFamily family_8bpc; +static QuicFamily family_5bpc; + +typedef unsigned COUNTER; /* counter in the array of counters in bucket of the data model */ + +typedef struct s_bucket { + COUNTER *pcounters; /* pointer to array of counters */ + unsigned int bestcode; /* best code so far */ +} s_bucket; + +typedef struct Encoder Encoder; + +typedef struct CommonState { + Encoder *encoder; + + unsigned int waitcnt; + unsigned int tabrand_seed; + unsigned int wm_trigger; + unsigned int wmidx; + unsigned int wmileft; + +#ifdef RLE_STAT + int melcstate; /* index to the state array */ + + int melclen; /* contents of the state array location + indexed by melcstate: the "expected" + run length is 2^melclen, shorter runs are + encoded by a 1 followed by the run length + in binary representation, wit a fixed length + of melclen bits */ + + unsigned long melcorder; /* 2^ melclen */ +#endif +} CommonState; + + +#define MAX_CHANNELS 4 + +typedef struct FamilyStat { + s_bucket **buckets_ptrs; + s_bucket *buckets_buf; + COUNTER *counters; +} FamilyStat; + +typedef struct Channel { + Encoder *encoder; + + int correlate_row_width; + BYTE *correlate_row; + + s_bucket **_buckets_ptrs; + + FamilyStat family_stat_8bpc; + FamilyStat family_stat_5bpc; + + CommonState state; +} Channel; + +struct Encoder { + QuicUsrContext *usr; + QuicImageType type; + unsigned int width; + unsigned int height; + unsigned int num_channels; + + unsigned int n_buckets_8bpc; + unsigned int n_buckets_5bpc; + + unsigned int io_available_bits; + uint32_t io_word; + uint32_t io_next_word; + uint32_t *io_now; + uint32_t *io_end; + uint32_t io_words_count; + + int rows_completed; + + Channel channels[MAX_CHANNELS]; + + CommonState rgb_state; +}; + +/* target wait mask index */ +static int wmimax = DEFwmimax; + +/* number of symbols to encode before increasing wait mask index */ +static int wminext = DEFwminext; + +/* model evolution mode */ +static int evol = DEFevol; + +/* bppmask[i] contains i ones as lsb-s */ +static const unsigned long int bppmask[33] = { + 0x00000000, /* [0] */ + 0x00000001, 0x00000003, 0x00000007, 0x0000000f, + 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff, + 0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff, + 0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff, + 0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff, + 0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff, + 0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff, + 0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff /* [32] */ +}; + +static const unsigned int bitat[32] = { + 0x00000001, 0x00000002, 0x00000004, 0x00000008, + 0x00000010, 0x00000020, 0x00000040, 0x00000080, + 0x00000100, 0x00000200, 0x00000400, 0x00000800, + 0x00001000, 0x00002000, 0x00004000, 0x00008000, + 0x00010000, 0x00020000, 0x00040000, 0x00080000, + 0x00100000, 0x00200000, 0x00400000, 0x00800000, + 0x01000000, 0x02000000, 0x04000000, 0x08000000, + 0x10000000, 0x20000000, 0x40000000, 0x80000000 /* [31]*/ +}; + + +#define TABRAND_TABSIZE 256 +#define TABRAND_SEEDMASK 0x0ff + +static const unsigned int tabrand_chaos[TABRAND_TABSIZE] = { + 0x02c57542, 0x35427717, 0x2f5a2153, 0x9244f155, 0x7bd26d07, 0x354c6052, 0x57329b28, 0x2993868e, + 0x6cd8808c, 0x147b46e0, 0x99db66af, 0xe32b4cac, 0x1b671264, 0x9d433486, 0x62a4c192, 0x06089a4b, + 0x9e3dce44, 0xdaabee13, 0x222425ea, 0xa46f331d, 0xcd589250, 0x8bb81d7f, 0xc8b736b9, 0x35948d33, + 0xd7ac7fd0, 0x5fbe2803, 0x2cfbc105, 0x013dbc4e, 0x7a37820f, 0x39f88e9e, 0xedd58794, 0xc5076689, + 0xfcada5a4, 0x64c2f46d, 0xb3ba3243, 0x8974b4f9, 0x5a05aebd, 0x20afcd00, 0x39e2b008, 0x88a18a45, + 0x600bde29, 0xf3971ace, 0xf37b0a6b, 0x7041495b, 0x70b707ab, 0x06beffbb, 0x4206051f, 0xe13c4ee3, + 0xc1a78327, 0x91aa067c, 0x8295f72a, 0x732917a6, 0x1d871b4d, 0x4048f136, 0xf1840e7e, 0x6a6048c1, + 0x696cb71a, 0x7ff501c3, 0x0fc6310b, 0x57e0f83d, 0x8cc26e74, 0x11a525a2, 0x946934c7, 0x7cd888f0, + 0x8f9d8604, 0x4f86e73b, 0x04520316, 0xdeeea20c, 0xf1def496, 0x67687288, 0xf540c5b2, 0x22401484, + 0x3478658a, 0xc2385746, 0x01979c2c, 0x5dad73c8, 0x0321f58b, 0xf0fedbee, 0x92826ddf, 0x284bec73, + 0x5b1a1975, 0x03df1e11, 0x20963e01, 0xa17cf12b, 0x740d776e, 0xa7a6bf3c, 0x01b5cce4, 0x1118aa76, + 0xfc6fac0a, 0xce927e9b, 0x00bf2567, 0x806f216c, 0xbca69056, 0x795bd3e9, 0xc9dc4557, 0x8929b6c2, + 0x789d52ec, 0x3f3fbf40, 0xb9197368, 0xa38c15b5, 0xc3b44fa8, 0xca8333b0, 0xb7e8d590, 0xbe807feb, + 0xbf5f8360, 0xd99e2f5c, 0x372928e1, 0x7c757c4c, 0x0db5b154, 0xc01ede02, 0x1fc86e78, 0x1f3985be, + 0xb4805c77, 0x00c880fa, 0x974c1b12, 0x35ab0214, 0xb2dc840d, 0x5b00ae37, 0xd313b026, 0xb260969d, + 0x7f4c8879, 0x1734c4d3, 0x49068631, 0xb9f6a021, 0x6b863e6f, 0xcee5debf, 0x29f8c9fb, 0x53dd6880, + 0x72b61223, 0x1f67a9fd, 0x0a0f6993, 0x13e59119, 0x11cca12e, 0xfe6b6766, 0x16b6effc, 0x97918fc4, + 0xc2b8a563, 0x94f2f741, 0x0bfa8c9a, 0xd1537ae8, 0xc1da349c, 0x873c60ca, 0x95005b85, 0x9b5c080e, + 0xbc8abbd9, 0xe1eab1d2, 0x6dac9070, 0x4ea9ebf1, 0xe0cf30d4, 0x1ef5bd7b, 0xd161043e, 0x5d2fa2e2, + 0xff5d3cae, 0x86ed9f87, 0x2aa1daa1, 0xbd731a34, 0x9e8f4b22, 0xb1c2c67a, 0xc21758c9, 0xa182215d, + 0xccb01948, 0x8d168df7, 0x04238cfe, 0x368c3dbc, 0x0aeadca5, 0xbad21c24, 0x0a71fee5, 0x9fc5d872, + 0x54c152c6, 0xfc329483, 0x6783384a, 0xeddb3e1c, 0x65f90e30, 0x884ad098, 0xce81675a, 0x4b372f7d, + 0x68bf9a39, 0x43445f1e, 0x40f8d8cb, 0x90d5acb6, 0x4cd07282, 0x349eeb06, 0x0c9d5332, 0x520b24ef, + 0x80020447, 0x67976491, 0x2f931ca3, 0xfe9b0535, 0xfcd30220, 0x61a9e6cc, 0xa487d8d7, 0x3f7c5dd1, + 0x7d0127c5, 0x48f51d15, 0x60dea871, 0xc9a91cb7, 0x58b53bb3, 0x9d5e0b2d, 0x624a78b4, 0x30dbee1b, + 0x9bdf22e7, 0x1df5c299, 0x2d5643a7, 0xf4dd35ff, 0x03ca8fd6, 0x53b47ed8, 0x6f2c19aa, 0xfeb0c1f4, + 0x49e54438, 0x2f2577e6, 0xbf876969, 0x72440ea9, 0xfa0bafb8, 0x74f5b3a0, 0x7dd357cd, 0x89ce1358, + 0x6ef2cdda, 0x1e7767f3, 0xa6be9fdb, 0x4f5f88f8, 0xba994a3a, 0x08ca6b65, 0xe0893818, 0x9e00a16a, + 0xf42bfc8f, 0x9972eedc, 0x749c8b51, 0x32c05f5e, 0xd706805f, 0x6bfbb7cf, 0xd9210a10, 0x31a1db97, + 0x923a9559, 0x37a7a1f6, 0x059f8861, 0xca493e62, 0x65157e81, 0x8f6467dd, 0xab85ff9f, 0x9331aff2, + 0x8616b9f5, 0xedbd5695, 0xee7e29b1, 0x313ac44f, 0xb903112f, 0x432ef649, 0xdc0a36c0, 0x61cf2bba, + 0x81474925, 0xa8b6c7ad, 0xee5931de, 0xb2f8158d, 0x59fb7409, 0x2e3dfaed, 0x9af25a3f, 0xe1fed4d5, +}; + +static unsigned int stabrand(void) +{ + //spice_assert( !(TABRAND_SEEDMASK & TABRAND_TABSIZE)); + //spice_assert( TABRAND_SEEDMASK + 1 == TABRAND_TABSIZE ); + + return TABRAND_SEEDMASK; +} + +static unsigned int tabrand(unsigned int *tabrand_seed) +{ + return tabrand_chaos[++*tabrand_seed & TABRAND_SEEDMASK]; +} + +static const unsigned short besttrigtab[3][11] = { /* array of wm_trigger for waitmask and evol, + used by set_wm_trigger() */ + /* 1 */ { 550, 900, 800, 700, 500, 350, 300, 200, 180, 180, 160}, + /* 3 */ { 110, 550, 900, 800, 550, 400, 350, 250, 140, 160, 140}, + /* 5 */ { 100, 120, 550, 900, 700, 500, 400, 300, 220, 250, 160} +}; + +/* set wm_trigger knowing waitmask (param) and evol (glob)*/ +static void set_wm_trigger(CommonState *state) +{ + unsigned int wm = state->wmidx; + if (wm > 10) { + wm = 10; + } + + spice_assert(evol < 6); + + state->wm_trigger = besttrigtab[evol / 2][wm]; + + spice_assert(state->wm_trigger <= 2000); + spice_assert(state->wm_trigger >= 1); +} + +static int ceil_log_2(int val) /* ceil(log_2(val)) */ +{ + int result; + + //spice_assert(val>0); + + if (val == 1) { + return 0; + } + + result = 1; + val -= 1; + while (val >>= 1) { + result++; + } + + return result; +} + +/* number of leading zeroes in the byte, used by cntlzeroes(uint)*/ +static const BYTE lzeroes[256] = { + 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* count leading zeroes */ +static unsigned int cnt_l_zeroes(const unsigned int bits) +{ + if (bits & 0xff800000) { + return lzeroes[bits >> 24]; + } else if (bits & 0xffff8000) { + return 8 + lzeroes[(bits >> 16) & 0x000000ff]; + } else if (bits & 0xffffff80) { + return 16 + lzeroes[(bits >> 8) & 0x000000ff]; + } else { + return 24 + lzeroes[bits & 0x000000ff]; + } +} + +#define QUIC_FAMILY_8BPC +#include "quic_family_tmpl.c" + +#ifdef QUIC_RGB +#define QUIC_FAMILY_5BPC +#include "quic_family_tmpl.c" +#endif + +static void decorelate_init(QuicFamily *family, int bpc) +{ + const unsigned int pixelbitmask = bppmask[bpc]; + const unsigned int pixelbitmaskshr = pixelbitmask >> 1; + unsigned int s; + + //spice_assert(bpc <= 8); + + for (s = 0; s <= pixelbitmask; s++) { + if (s <= pixelbitmaskshr) { + family->xlatU2L[s] = s << 1; + } else { + family->xlatU2L[s] = ((pixelbitmask - s) << 1) + 1; + } + } +} + +static void corelate_init(QuicFamily *family, int bpc) +{ + const unsigned long int pixelbitmask = bppmask[bpc]; + unsigned long int s; + + //spice_assert(bpc <= 8); + + for (s = 0; s <= pixelbitmask; s++) { + if (s & 0x01) { + family->xlatL2U[s] = pixelbitmask - (s >> 1); + } else { + family->xlatL2U[s] = (s >> 1); + } + } +} + +static void family_init(QuicFamily *family, int bpc, int limit) +{ + int l; + + for (l = 0; l < bpc; l++) { /* fill arrays indexed by code number */ + int altprefixlen, altcodewords; + + altprefixlen = limit - bpc; + if (altprefixlen > (int)(bppmask[bpc - l])) { + altprefixlen = bppmask[bpc - l]; + } + + altcodewords = bppmask[bpc] + 1 - (altprefixlen << l); + + family->nGRcodewords[l] = (altprefixlen << l); + family->notGRcwlen[l] = altprefixlen + ceil_log_2(altcodewords); + family->notGRprefixmask[l] = bppmask[32 - altprefixlen]; /* needed for decoding only */ + family->notGRsuffixlen[l] = ceil_log_2(altcodewords); /* needed for decoding only */ + } + + decorelate_init(family, bpc); + corelate_init(family, bpc); +} + +static void more_io_words(Encoder *encoder) +{ + uint32_t *io_ptr; + int num_io_words = encoder->usr->more_space(encoder->usr, &io_ptr, encoder->rows_completed); + if (num_io_words <= 0) { + encoder->usr->error(encoder->usr, "%s: no more words\n", __FUNCTION__); + } + spice_assert(io_ptr); + encoder->io_words_count += num_io_words; + encoder->io_now = io_ptr; + encoder->io_end = encoder->io_now + num_io_words; +} + +static void __write_io_word(Encoder *encoder) +{ + more_io_words(encoder); + *(encoder->io_now++) = encoder->io_word; +} + +static void (*__write_io_word_ptr)(Encoder *encoder) = __write_io_word; + +static INLINE void write_io_word(Encoder *encoder) +{ + if (encoder->io_now == encoder->io_end) { + __write_io_word_ptr(encoder); //disable inline optimizations + return; + } + *(encoder->io_now++) = encoder->io_word; +} + +static INLINE void encode(Encoder *encoder, unsigned int word, unsigned int len) +{ + int delta; + + spice_assert(len > 0 && len < 32); + spice_assert(!(word & ~bppmask[len])); + if ((delta = ((int)encoder->io_available_bits - len)) >= 0) { + encoder->io_available_bits = delta; + encoder->io_word |= word << encoder->io_available_bits; + return; + } + delta = -delta; + encoder->io_word |= word >> delta; + write_io_word(encoder); + encoder->io_available_bits = 32 - delta; + encoder->io_word = word << encoder->io_available_bits; + + spice_assert(encoder->io_available_bits < 32); + spice_assert((encoder->io_word & bppmask[encoder->io_available_bits]) == 0); +} + +static INLINE void encode_32(Encoder *encoder, unsigned int word) +{ + encode(encoder, word >> 16, 16); + encode(encoder, word & 0x0000ffff, 16); +} + +static INLINE void flush(Encoder *encoder) +{ + if (encoder->io_available_bits > 0 && encoder->io_available_bits != 32) { + encode(encoder, 0, encoder->io_available_bits); + } + encode_32(encoder, 0); + encode(encoder, 0, 1); +} + +static void __read_io_word(Encoder *encoder) +{ + more_io_words(encoder); + encoder->io_next_word = *(encoder->io_now++); +} + +static void (*__read_io_word_ptr)(Encoder *encoder) = __read_io_word; + + +static INLINE void read_io_word(Encoder *encoder) +{ + if (encoder->io_now == encoder->io_end) { + __read_io_word_ptr(encoder); //disable inline optimizations + return; + } + spice_assert(encoder->io_now < encoder->io_end); + encoder->io_next_word = *(encoder->io_now++); +} + +static INLINE void decode_eatbits(Encoder *encoder, int len) +{ + int delta; + + spice_assert(len > 0 && len < 32); + encoder->io_word <<= len; + + if ((delta = ((int)encoder->io_available_bits - len)) >= 0) { + encoder->io_available_bits = delta; + encoder->io_word |= encoder->io_next_word >> encoder->io_available_bits; + return; + } + + delta = -delta; + encoder->io_word |= encoder->io_next_word << delta; + read_io_word(encoder); + encoder->io_available_bits = 32 - delta; + encoder->io_word |= (encoder->io_next_word >> encoder->io_available_bits); +} + +static INLINE void decode_eat32bits(Encoder *encoder) +{ + decode_eatbits(encoder, 16); + decode_eatbits(encoder, 16); +} + +#ifdef RLE + +#ifdef RLE_STAT + +static INLINE void encode_ones(Encoder *encoder, unsigned int n) +{ + unsigned int count; + + for (count = n >> 5; count; count--) { + encode(encoder, ~0U, 32); + } + + if ((n &= 0x1f)) { + encode(encoder, (1U << n) - 1, n); + } +} + +#define MELCSTATES 32 /* number of melcode states */ + +static int zeroLUT[256]; /* table to find out number of leading zeros */ + +static int J[MELCSTATES] = { + 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, + 7, 8, 9, 10, 11, 12, 13, 14, 15 +}; + +/* creates the bit counting look-up table. */ +static void init_zeroLUT(void) +{ + int i, j, k, l; + + j = k = 1; + l = 8; + for (i = 0; i < 256; ++i) { + zeroLUT[i] = l; + --k; + if (k == 0) { + k = j; + --l; + j *= 2; + } + } +} + +static void encoder_init_rle(CommonState *state) +{ + state->melcstate = 0; + state->melclen = J[0]; + state->melcorder = 1 << state->melclen; +} + +#ifdef QUIC_RGB + +static void encode_run(Encoder *encoder, unsigned int runlen) //todo: try use end of line +{ + int hits = 0; + + while (runlen >= encoder->rgb_state.melcorder) { + hits++; + runlen -= encoder->rgb_state.melcorder; + if (encoder->rgb_state.melcstate < MELCSTATES) { + encoder->rgb_state.melclen = J[++encoder->rgb_state.melcstate]; + encoder->rgb_state.melcorder = (1L << encoder->rgb_state.melclen); + } + } + + /* send the required number of "hit" bits (one per occurrence + of a run of length melcorder). This number is never too big: + after 31 such "hit" bits, each "hit" would represent a run of 32K + pixels. + */ + encode_ones(encoder, hits); + + encode(encoder, runlen, encoder->rgb_state.melclen + 1); + + /* adjust melcoder parameters */ + if (encoder->rgb_state.melcstate) { + encoder->rgb_state.melclen = J[--encoder->rgb_state.melcstate]; + encoder->rgb_state.melcorder = (1L << encoder->rgb_state.melclen); + } +} + +#endif + +static void encode_channel_run(Encoder *encoder, Channel *channel, unsigned int runlen) +{ + //todo: try use end of line + int hits = 0; + + while (runlen >= channel->state.melcorder) { + hits++; + runlen -= channel->state.melcorder; + if (channel->state.melcstate < MELCSTATES) { + channel->state.melclen = J[++channel->state.melcstate]; + channel->state.melcorder = (1L << channel->state.melclen); + } + } + + /* send the required number of "hit" bits (one per occurrence + of a run of length melcorder). This number is never too big: + after 31 such "hit" bits, each "hit" would represent a run of 32K + pixels. + */ + encode_ones(encoder, hits); + + encode(encoder, runlen, channel->state.melclen + 1); + + /* adjust melcoder parameters */ + if (channel->state.melcstate) { + channel->state.melclen = J[--channel->state.melcstate]; + channel->state.melcorder = (1L << channel->state.melclen); + } +} + +/* decoding routine: reads bits from the input and returns a run length. */ +/* argument is the number of pixels left to end-of-line (bound on run length) */ + +#ifdef QUIC_RGB +static int decode_run(Encoder *encoder) +{ + int runlen = 0; + + do { + register int temp, hits; + temp = zeroLUT[(BYTE)(~(encoder->io_word >> 24))];/* number of leading ones in the + input stream, up to 8 */ + for (hits = 1; hits <= temp; hits++) { + runlen += encoder->rgb_state.melcorder; + + if (encoder->rgb_state.melcstate < MELCSTATES) { + encoder->rgb_state.melclen = J[++encoder->rgb_state.melcstate]; + encoder->rgb_state.melcorder = (1U << encoder->rgb_state.melclen); + } + } + if (temp != 8) { + decode_eatbits(encoder, temp + 1); /* consume the leading + 0 of the remainder encoding */ + break; + } + decode_eatbits(encoder, 8); + } while (1); + + /* read the length of the remainder */ + if (encoder->rgb_state.melclen) { + runlen += encoder->io_word >> (32 - encoder->rgb_state.melclen); + decode_eatbits(encoder, encoder->rgb_state.melclen); + } + + /* adjust melcoder parameters */ + if (encoder->rgb_state.melcstate) { + encoder->rgb_state.melclen = J[--encoder->rgb_state.melcstate]; + encoder->rgb_state.melcorder = (1U << encoder->rgb_state.melclen); + } + + return runlen; +} + +#endif + +static int decode_channel_run(Encoder *encoder, Channel *channel) +{ + int runlen = 0; + + do { + register int temp, hits; + temp = zeroLUT[(BYTE)(~(encoder->io_word >> 24))];/* number of leading ones in the + input stream, up to 8 */ + for (hits = 1; hits <= temp; hits++) { + runlen += channel->state.melcorder; + + if (channel->state.melcstate < MELCSTATES) { + channel->state.melclen = J[++channel->state.melcstate]; + channel->state.melcorder = (1U << channel->state.melclen); + } + } + if (temp != 8) { + decode_eatbits(encoder, temp + 1); /* consume the leading + 0 of the remainder encoding */ + break; + } + decode_eatbits(encoder, 8); + } while (1); + + /* read the length of the remainder */ + if (channel->state.melclen) { + runlen += encoder->io_word >> (32 - channel->state.melclen); + decode_eatbits(encoder, channel->state.melclen); + } + + /* adjust melcoder parameters */ + if (channel->state.melcstate) { + channel->state.melclen = J[--channel->state.melcstate]; + channel->state.melcorder = (1U << channel->state.melclen); + } + + return runlen; +} + +#else + +static INLINE void encode_run(Encoder *encoder, unsigned int len) +{ + int odd = len & 1U; + int msb; + + len &= ~1U; + + while ((msb = spice_bit_find_msb(len))) { + len &= ~(1 << (msb - 1)); + spice_assert(msb < 32); + encode(encoder, (1 << (msb)) - 1, msb); + encode(encoder, 0, 1); + } + + if (odd) { + encode(encoder, 2, 2); + } else { + encode(encoder, 0, 1); + } +} + +static INLINE unsigned int decode_run(Encoder *encoder) +{ + unsigned int len = 0; + int count; + + do { + count = 0; + while (encoder->io_word & (1U << 31)) { + decode_eatbits(encoder, 1); + count++; + spice_assert(count < 32); + } + decode_eatbits(encoder, 1); + len += (1U << count) >> 1; + } while (count > 1); + + return len; +} + +#endif +#endif + +static INLINE void init_decode_io(Encoder *encoder) +{ + encoder->io_next_word = encoder->io_word = *(encoder->io_now++); + encoder->io_available_bits = 0; +} + +#ifdef __GNUC__ +#define ATTR_PACKED __attribute__ ((__packed__)) +#else +#define ATTR_PACKED +#pragma pack(push) +#pragma pack(1) +#endif + +typedef struct ATTR_PACKED one_byte_pixel_t { + BYTE a; +} one_byte_t; + +typedef struct ATTR_PACKED three_bytes_pixel_t { + BYTE a; + BYTE b; + BYTE c; +} three_bytes_t; + +typedef struct ATTR_PACKED four_bytes_pixel_t { + BYTE a; + BYTE b; + BYTE c; + BYTE d; +} four_bytes_t; + +typedef struct ATTR_PACKED rgb32_pixel_t { + BYTE b; + BYTE g; + BYTE r; + BYTE pad; +} rgb32_pixel_t; + +typedef struct ATTR_PACKED rgb24_pixel_t { + BYTE b; + BYTE g; + BYTE r; +} rgb24_pixel_t; + +typedef uint16_t rgb16_pixel_t; + +#ifndef __GNUC__ +#pragma pack(pop) +#endif + +#undef ATTR_PACKED + +#define ONE_BYTE +#include "quic_tmpl.c" + +#define FOUR_BYTE +#include "quic_tmpl.c" + +#ifdef QUIC_RGB + +#define QUIC_RGB32 +#include "quic_rgb_tmpl.c" + +#define QUIC_RGB24 +#include "quic_rgb_tmpl.c" + +#define QUIC_RGB16 +#include "quic_rgb_tmpl.c" + +#define QUIC_RGB16_TO_32 +#include "quic_rgb_tmpl.c" + +#else + +#define THREE_BYTE +#include "quic_tmpl.c" + +#endif + +static void fill_model_structures(Encoder *encoder, FamilyStat *family_stat, + unsigned int rep_first, unsigned int first_size, + unsigned int rep_next, unsigned int mul_size, + unsigned int levels, unsigned int ncounters, + unsigned int nbuckets, unsigned int n_buckets_ptrs) +{ + unsigned int + bsize, + bstart, + bend = 0, + repcntr, + bnumber; + + COUNTER * free_counter = family_stat->counters;/* first free location in the array of + counters */ + + bnumber = 0; + + repcntr = rep_first + 1; /* first bucket */ + bsize = first_size; + + do { /* others */ + if (bnumber) { + bstart = bend + 1; + } else { + bstart = 0; + } + + if (!--repcntr) { + repcntr = rep_next; + bsize *= mul_size; + } + + bend = bstart + bsize - 1; + if (bend + bsize >= levels) { + bend = levels - 1; + } + + family_stat->buckets_buf[bnumber].pcounters = free_counter; + free_counter += ncounters; + + spice_assert(bstart < n_buckets_ptrs); + { + unsigned int i; + spice_assert(bend < n_buckets_ptrs); + for (i = bstart; i <= bend; i++) { + family_stat->buckets_ptrs[i] = family_stat->buckets_buf + bnumber; + } + } + + bnumber++; + } while (bend < levels - 1); + + spice_assert(free_counter - family_stat->counters == nbuckets * ncounters); +} + +static void find_model_params(Encoder *encoder, + const int bpc, + unsigned int *ncounters, + unsigned int *levels, + unsigned int *n_buckets_ptrs, + unsigned int *repfirst, + unsigned int *firstsize, + unsigned int *repnext, + unsigned int *mulsize, + unsigned int *nbuckets) +{ + unsigned int bsize; /* bucket size */ + unsigned int bstart, bend = 0; /* bucket start and end, range : 0 to levels-1*/ + unsigned int repcntr; /* helper */ + + spice_assert(bpc <= 8 && bpc > 0); + + + *ncounters = 8; + + *levels = 0x1 << bpc; + + *n_buckets_ptrs = 0; /* ==0 means: not set yet */ + + switch (evol) { /* set repfirst firstsize repnext mulsize */ + case 1: /* buckets contain following numbers of contexts: 1 1 1 2 2 4 4 8 8 ... */ + *repfirst = 3; + *firstsize = 1; + *repnext = 2; + *mulsize = 2; + break; + case 3: /* 1 2 4 8 16 32 64 ... */ + *repfirst = 1; + *firstsize = 1; + *repnext = 1; + *mulsize = 2; + break; + case 5: /* 1 4 16 64 256 1024 4096 16384 65536 */ + *repfirst = 1; + *firstsize = 1; + *repnext = 1; + *mulsize = 4; + break; + case 0: /* obsolete */ + case 2: /* obsolete */ + case 4: /* obsolete */ + encoder->usr->error(encoder->usr, "findmodelparams(): evol value obsolete!!!\n"); + default: + encoder->usr->error(encoder->usr, "findmodelparams(): evol out of range!!!\n"); + } + + *nbuckets = 0; + repcntr = *repfirst + 1; /* first bucket */ + bsize = *firstsize; + + do { /* other buckets */ + if (nbuckets) { /* bucket start */ + bstart = bend + 1; + } else { + bstart = 0; + } + + if (!--repcntr) { /* bucket size */ + repcntr = *repnext; + bsize *= *mulsize; + } + + bend = bstart + bsize - 1; /* bucket end */ + if (bend + bsize >= *levels) { /* if following bucked was bigger than current one */ + bend = *levels - 1; /* concatenate them */ + } + + if (!*n_buckets_ptrs) { /* array size not set yet? */ + *n_buckets_ptrs = *levels; + #if 0 + if (bend == *levels - 1) { /* this bucket is last - all in the first array */ + *n_buckets_ptrs = *levels; + } else if (bsize >= 256) { /* this bucket is allowed to reside in the 2nd table */ + b_lo_ptrs = bstart; + spice_assert(bstart); /* previous bucket exists */ + } + #endif + } + + (*nbuckets)++; + } while (bend < *levels - 1); +} + +static int init_model_structures(Encoder *encoder, FamilyStat *family_stat, + unsigned int rep_first, unsigned int first_size, + unsigned int rep_next, unsigned int mul_size, + unsigned int levels, unsigned int ncounters, + unsigned int n_buckets_ptrs, unsigned int n_buckets) +{ + family_stat->buckets_ptrs = (s_bucket **)encoder->usr->malloc(encoder->usr, + n_buckets_ptrs * + sizeof(s_bucket *)); + if (!family_stat->buckets_ptrs) { + return FALSE; + } + + family_stat->counters = (COUNTER *)encoder->usr->malloc(encoder->usr, + n_buckets * sizeof(COUNTER) * + MAXNUMCODES); + if (!family_stat->counters) { + goto error_1; + } + + family_stat->buckets_buf = (s_bucket *)encoder->usr->malloc(encoder->usr, + n_buckets * sizeof(s_bucket)); + if (!family_stat->buckets_buf) { + goto error_2; + } + + fill_model_structures(encoder, family_stat, rep_first, first_size, rep_next, mul_size, levels, + ncounters, n_buckets, n_buckets_ptrs); + + return TRUE; + +error_2: + encoder->usr->free(encoder->usr, family_stat->counters); + +error_1: + encoder->usr->free(encoder->usr, family_stat->buckets_ptrs); + + return FALSE; +} + +static void free_family_stat(QuicUsrContext *usr, FamilyStat *family_stat) +{ + usr->free(usr, family_stat->buckets_ptrs); + usr->free(usr, family_stat->counters); + usr->free(usr, family_stat->buckets_buf); +} + +static int init_channel(Encoder *encoder, Channel *channel) +{ + unsigned int ncounters; + unsigned int levels; + unsigned int rep_first; + unsigned int first_size; + unsigned int rep_next; + unsigned int mul_size; + unsigned int n_buckets; + unsigned int n_buckets_ptrs; + + channel->encoder = encoder; + channel->state.encoder = encoder; + channel->correlate_row_width = 0; + channel->correlate_row = NULL; + + find_model_params(encoder, 8, &ncounters, &levels, &n_buckets_ptrs, &rep_first, + &first_size, &rep_next, &mul_size, &n_buckets); + encoder->n_buckets_8bpc = n_buckets; + if (!init_model_structures(encoder, &channel->family_stat_8bpc, rep_first, first_size, + rep_next, mul_size, levels, ncounters, n_buckets_ptrs, + n_buckets)) { + return FALSE; + } + + find_model_params(encoder, 5, &ncounters, &levels, &n_buckets_ptrs, &rep_first, + &first_size, &rep_next, &mul_size, &n_buckets); + encoder->n_buckets_5bpc = n_buckets; + if (!init_model_structures(encoder, &channel->family_stat_5bpc, rep_first, first_size, + rep_next, mul_size, levels, ncounters, n_buckets_ptrs, + n_buckets)) { + free_family_stat(encoder->usr, &channel->family_stat_8bpc); + return FALSE; + } + + return TRUE; +} + +static void destroy_channel(Channel *channel) +{ + QuicUsrContext *usr = channel->encoder->usr; + if (channel->correlate_row) { + usr->free(usr, channel->correlate_row - 1); + } + free_family_stat(usr, &channel->family_stat_8bpc); + free_family_stat(usr, &channel->family_stat_5bpc); +} + +static int init_encoder(Encoder *encoder, QuicUsrContext *usr) +{ + int i; + + encoder->usr = usr; + encoder->rgb_state.encoder = encoder; + + for (i = 0; i < MAX_CHANNELS; i++) { + if (!init_channel(encoder, &encoder->channels[i])) { + for (--i; i >= 0; i--) { + destroy_channel(&encoder->channels[i]); + } + return FALSE; + } + } + return TRUE; +} + +static int encoder_reste(Encoder *encoder, uint32_t *io_ptr, uint32_t *io_ptr_end) +{ + spice_assert(((unsigned long)io_ptr % 4) == ((unsigned long)io_ptr_end % 4)); + spice_assert(io_ptr <= io_ptr_end); + + encoder->rgb_state.waitcnt = 0; + encoder->rgb_state.tabrand_seed = stabrand(); + encoder->rgb_state.wmidx = DEFwmistart; + encoder->rgb_state.wmileft = wminext; + set_wm_trigger(&encoder->rgb_state); + +#if defined(RLE) && defined(RLE_STAT) + encoder_init_rle(&encoder->rgb_state); +#endif + + encoder->io_words_count = io_ptr_end - io_ptr; + encoder->io_now = io_ptr; + encoder->io_end = io_ptr_end; + encoder->rows_completed = 0; + + return TRUE; +} + +static int encoder_reste_channels(Encoder *encoder, int channels, int width, int bpc) +{ + int i; + + encoder->num_channels = channels; + + for (i = 0; i < channels; i++) { + s_bucket *bucket; + s_bucket *end_bucket; + + if (encoder->channels[i].correlate_row_width < width) { + encoder->channels[i].correlate_row_width = 0; + if (encoder->channels[i].correlate_row) { + encoder->usr->free(encoder->usr, encoder->channels[i].correlate_row - 1); + } + if (!(encoder->channels[i].correlate_row = (BYTE *)encoder->usr->malloc(encoder->usr, + width + 1))) { + return FALSE; + } + encoder->channels[i].correlate_row++; + encoder->channels[i].correlate_row_width = width; + } + + if (bpc == 8) { + MEMCLEAR(encoder->channels[i].family_stat_8bpc.counters, + encoder->n_buckets_8bpc * sizeof(COUNTER) * MAXNUMCODES); + bucket = encoder->channels[i].family_stat_8bpc.buckets_buf; + end_bucket = bucket + encoder->n_buckets_8bpc; + for (; bucket < end_bucket; bucket++) { + bucket->bestcode = /*BPC*/ 8 - 1; + } + encoder->channels[i]._buckets_ptrs = encoder->channels[i].family_stat_8bpc.buckets_ptrs; + } else if (bpc == 5) { + MEMCLEAR(encoder->channels[i].family_stat_5bpc.counters, + encoder->n_buckets_5bpc * sizeof(COUNTER) * MAXNUMCODES); + bucket = encoder->channels[i].family_stat_5bpc.buckets_buf; + end_bucket = bucket + encoder->n_buckets_5bpc; + for (; bucket < end_bucket; bucket++) { + bucket->bestcode = /*BPC*/ 5 - 1; + } + encoder->channels[i]._buckets_ptrs = encoder->channels[i].family_stat_5bpc.buckets_ptrs; + } else { + encoder->usr->warn(encoder->usr, "%s: bad bpc %d\n", __FUNCTION__, bpc); + return FALSE; + } + + encoder->channels[i].state.waitcnt = 0; + encoder->channels[i].state.tabrand_seed = stabrand(); + encoder->channels[i].state.wmidx = DEFwmistart; + encoder->channels[i].state.wmileft = wminext; + set_wm_trigger(&encoder->channels[i].state); + +#if defined(RLE) && defined(RLE_STAT) + encoder_init_rle(&encoder->channels[i].state); +#endif + } + return TRUE; +} + +static void quic_image_params(Encoder *encoder, QuicImageType type, int *channels, int *bpc) +{ + spice_assert(channels && bpc); + switch (type) { + case QUIC_IMAGE_TYPE_GRAY: + *channels = 1; + *bpc = 8; + break; + case QUIC_IMAGE_TYPE_RGB16: + *channels = 3; + *bpc = 5; +#ifndef QUIC_RGB + encoder->usr->error(encoder->usr, "not implemented\n"); +#endif + break; + case QUIC_IMAGE_TYPE_RGB24: + *channels = 3; + *bpc = 8; + break; + case QUIC_IMAGE_TYPE_RGB32: + *channels = 3; + *bpc = 8; + break; + case QUIC_IMAGE_TYPE_RGBA: + *channels = 4; + *bpc = 8; + break; + case QUIC_IMAGE_TYPE_INVALID: + default: + *channels = 0; + *bpc = 0; + encoder->usr->error(encoder->usr, "bad image type\n"); + } +} + +#define FILL_LINES() { \ + if (line == lines_end) { \ + int n = encoder->usr->more_lines(encoder->usr, &line); \ + if (n <= 0 || line == NULL) { \ + encoder->usr->error(encoder->usr, "more lines failed\n"); \ + } \ + lines_end = line + n * stride; \ + } \ +} + +#define NEXT_LINE() { \ + line += stride; \ + FILL_LINES(); \ +} + +#define QUIC_COMPRESS_RGB(bits) \ + encoder->channels[0].correlate_row[-1] = 0; \ + encoder->channels[1].correlate_row[-1] = 0; \ + encoder->channels[2].correlate_row[-1] = 0; \ + quic_rgb##bits##_compress_row0(encoder, (rgb##bits##_pixel_t *)(line), width); \ + encoder->rows_completed++; \ + for (row = 1; row < height; row++) { \ + prev = line; \ + NEXT_LINE(); \ + encoder->channels[0].correlate_row[-1] = encoder->channels[0].correlate_row[0]; \ + encoder->channels[1].correlate_row[-1] = encoder->channels[1].correlate_row[0]; \ + encoder->channels[2].correlate_row[-1] = encoder->channels[2].correlate_row[0]; \ + quic_rgb##bits##_compress_row(encoder, (rgb##bits##_pixel_t *)prev, \ + (rgb##bits##_pixel_t *)line, width); \ + encoder->rows_completed++; \ + } + +int quic_encode(QuicContext *quic, QuicImageType type, int width, int height, + uint8_t *line, unsigned int num_lines, int stride, + uint32_t *io_ptr, unsigned int num_io_words) +{ + Encoder *encoder = (Encoder *)quic; + uint32_t *io_ptr_end = io_ptr + num_io_words; + uint8_t *lines_end; + int row; + uint8_t *prev; + int channels; + int bpc; +#ifndef QUIC_RGB + int i; +#endif + + lines_end = line + num_lines * stride; + if (line == NULL && lines_end != line) { + spice_warn_if_reached(); + return QUIC_ERROR; + } + + quic_image_params(encoder, type, &channels, &bpc); + + if (!encoder_reste(encoder, io_ptr, io_ptr_end) || + !encoder_reste_channels(encoder, channels, width, bpc)) { + return QUIC_ERROR; + } + + encoder->io_word = 0; + encoder->io_available_bits = 32; + + encode_32(encoder, QUIC_MAGIC); + encode_32(encoder, QUIC_VERSION); + encode_32(encoder, type); + encode_32(encoder, width); + encode_32(encoder, height); + + FILL_LINES(); + + switch (type) { +#ifdef QUIC_RGB + case QUIC_IMAGE_TYPE_RGB32: + spice_assert(ABS(stride) >= width * 4); + QUIC_COMPRESS_RGB(32); + break; + case QUIC_IMAGE_TYPE_RGB24: + spice_assert(ABS(stride) >= width * 3); + QUIC_COMPRESS_RGB(24); + break; + case QUIC_IMAGE_TYPE_RGB16: + spice_assert(ABS(stride) >= width * 2); + QUIC_COMPRESS_RGB(16); + break; + case QUIC_IMAGE_TYPE_RGBA: + spice_assert(ABS(stride) >= width * 4); + + encoder->channels[0].correlate_row[-1] = 0; + encoder->channels[1].correlate_row[-1] = 0; + encoder->channels[2].correlate_row[-1] = 0; + quic_rgb32_compress_row0(encoder, (rgb32_pixel_t *)(line), width); + + encoder->channels[3].correlate_row[-1] = 0; + quic_four_compress_row0(encoder, &encoder->channels[3], (four_bytes_t *)(line + 3), width); + + encoder->rows_completed++; + + for (row = 1; row < height; row++) { + prev = line; + NEXT_LINE(); + encoder->channels[0].correlate_row[-1] = encoder->channels[0].correlate_row[0]; + encoder->channels[1].correlate_row[-1] = encoder->channels[1].correlate_row[0]; + encoder->channels[2].correlate_row[-1] = encoder->channels[2].correlate_row[0]; + quic_rgb32_compress_row(encoder, (rgb32_pixel_t *)prev, (rgb32_pixel_t *)line, width); + + encoder->channels[3].correlate_row[-1] = encoder->channels[3].correlate_row[0]; + quic_four_compress_row(encoder, &encoder->channels[3], (four_bytes_t *)(prev + 3), + (four_bytes_t *)(line + 3), width); + encoder->rows_completed++; + } + break; +#else + case QUIC_IMAGE_TYPE_RGB24: + spice_assert(ABS(stride) >= width * 3); + for (i = 0; i < 3; i++) { + encoder->channels[i].correlate_row[-1] = 0; + quic_three_compress_row0(encoder, &encoder->channels[i], (three_bytes_t *)(line + i), + width); + } + encoder->rows_completed++; + for (row = 1; row < height; row++) { + prev = line; + NEXT_LINE(); + for (i = 0; i < 3; i++) { + encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0]; + quic_three_compress_row(encoder, &encoder->channels[i], (three_bytes_t *)(prev + i), + (three_bytes_t *)(line + i), width); + } + encoder->rows_completed++; + } + break; + case QUIC_IMAGE_TYPE_RGB32: + case QUIC_IMAGE_TYPE_RGBA: + spice_assert(ABS(stride) >= width * 4); + for (i = 0; i < channels; i++) { + encoder->channels[i].correlate_row[-1] = 0; + quic_four_compress_row0(encoder, &encoder->channels[i], (four_bytes_t *)(line + i), + width); + } + encoder->rows_completed++; + for (row = 1; row < height; row++) { + prev = line; + NEXT_LINE(); + for (i = 0; i < channels; i++) { + encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0]; + quic_four_compress_row(encoder, &encoder->channels[i], (four_bytes_t *)(prev + i), + (four_bytes_t *)(line + i), width); + } + encoder->rows_completed++; + } + break; +#endif + case QUIC_IMAGE_TYPE_GRAY: + spice_assert(ABS(stride) >= width); + encoder->channels[0].correlate_row[-1] = 0; + quic_one_compress_row0(encoder, &encoder->channels[0], (one_byte_t *)line, width); + encoder->rows_completed++; + for (row = 1; row < height; row++) { + prev = line; + NEXT_LINE(); + encoder->channels[0].correlate_row[-1] = encoder->channels[0].correlate_row[0]; + quic_one_compress_row(encoder, &encoder->channels[0], (one_byte_t *)prev, + (one_byte_t *)line, width); + encoder->rows_completed++; + } + break; + case QUIC_IMAGE_TYPE_INVALID: + default: + encoder->usr->error(encoder->usr, "bad image type\n"); + } + + flush(encoder); + encoder->io_words_count -= (encoder->io_end - encoder->io_now); + + return encoder->io_words_count; +} + +int quic_decode_begin(QuicContext *quic, uint32_t *io_ptr, unsigned int num_io_words, + QuicImageType *out_type, int *out_width, int *out_height) +{ + Encoder *encoder = (Encoder *)quic; + uint32_t *io_ptr_end = io_ptr + num_io_words; + QuicImageType type; + int width; + int height; + uint32_t magic; + uint32_t version; + int channels; + int bpc; + + if (!encoder_reste(encoder, io_ptr, io_ptr_end)) { + return QUIC_ERROR; + } + + init_decode_io(encoder); + + magic = encoder->io_word; + decode_eat32bits(encoder); + if (magic != QUIC_MAGIC) { + encoder->usr->warn(encoder->usr, "bad magic\n"); + return QUIC_ERROR; + } + + version = encoder->io_word; + decode_eat32bits(encoder); + if (version != QUIC_VERSION) { + encoder->usr->warn(encoder->usr, "bad version\n"); + return QUIC_ERROR; + } + + type = (QuicImageType)encoder->io_word; + decode_eat32bits(encoder); + + width = encoder->io_word; + decode_eat32bits(encoder); + + height = encoder->io_word; + decode_eat32bits(encoder); + + quic_image_params(encoder, type, &channels, &bpc); + + if (!encoder_reste_channels(encoder, channels, width, bpc)) { + return QUIC_ERROR; + } + + *out_width = encoder->width = width; + *out_height = encoder->height = height; + *out_type = encoder->type = type; + return QUIC_OK; +} + +#ifndef QUIC_RGB +static void clear_row(four_bytes_t *row, int width) +{ + four_bytes_t *end; + for (end = row + width; row < end; row++) { + row->a = 0; + } +} + +#endif + +#ifdef QUIC_RGB + +static void uncompress_rgba(Encoder *encoder, uint8_t *buf, int stride) +{ + unsigned int row; + uint8_t *prev; + + encoder->channels[0].correlate_row[-1] = 0; + encoder->channels[1].correlate_row[-1] = 0; + encoder->channels[2].correlate_row[-1] = 0; + quic_rgb32_uncompress_row0(encoder, (rgb32_pixel_t *)buf, encoder->width); + + encoder->channels[3].correlate_row[-1] = 0; + quic_four_uncompress_row0(encoder, &encoder->channels[3], (four_bytes_t *)(buf + 3), + encoder->width); + + encoder->rows_completed++; + for (row = 1; row < encoder->height; row++) { + prev = buf; + buf += stride; + + encoder->channels[0].correlate_row[-1] = encoder->channels[0].correlate_row[0]; + encoder->channels[1].correlate_row[-1] = encoder->channels[1].correlate_row[0]; + encoder->channels[2].correlate_row[-1] = encoder->channels[2].correlate_row[0]; + quic_rgb32_uncompress_row(encoder, (rgb32_pixel_t *)prev, (rgb32_pixel_t *)buf, + encoder->width); + + encoder->channels[3].correlate_row[-1] = encoder->channels[3].correlate_row[0]; + quic_four_uncompress_row(encoder, &encoder->channels[3], (four_bytes_t *)(prev + 3), + (four_bytes_t *)(buf + 3), encoder->width); + + encoder->rows_completed++; + } +} + +#endif + +static void uncompress_gray(Encoder *encoder, uint8_t *buf, int stride) +{ + unsigned int row; + uint8_t *prev; + + encoder->channels[0].correlate_row[-1] = 0; + quic_one_uncompress_row0(encoder, &encoder->channels[0], (one_byte_t *)buf, encoder->width); + encoder->rows_completed++; + for (row = 1; row < encoder->height; row++) { + prev = buf; + buf += stride; + encoder->channels[0].correlate_row[-1] = encoder->channels[0].correlate_row[0]; + quic_one_uncompress_row(encoder, &encoder->channels[0], (one_byte_t *)prev, + (one_byte_t *)buf, encoder->width); + encoder->rows_completed++; + } +} + +#define QUIC_UNCOMPRESS_RGB(prefix, type) \ + encoder->channels[0].correlate_row[-1] = 0; \ + encoder->channels[1].correlate_row[-1] = 0; \ + encoder->channels[2].correlate_row[-1] = 0; \ + quic_rgb##prefix##_uncompress_row0(encoder, (type *)buf, encoder->width); \ + encoder->rows_completed++; \ + for (row = 1; row < encoder->height; row++) { \ + prev = buf; \ + buf += stride; \ + encoder->channels[0].correlate_row[-1] = encoder->channels[0].correlate_row[0]; \ + encoder->channels[1].correlate_row[-1] = encoder->channels[1].correlate_row[0]; \ + encoder->channels[2].correlate_row[-1] = encoder->channels[2].correlate_row[0]; \ + quic_rgb##prefix##_uncompress_row(encoder, (type *)prev, (type *)buf, \ + encoder->width); \ + encoder->rows_completed++; \ + } + +int quic_decode(QuicContext *quic, QuicImageType type, uint8_t *buf, int stride) +{ + Encoder *encoder = (Encoder *)quic; + unsigned int row; + uint8_t *prev; +#ifndef QUIC_RGB + int i; +#endif + + spice_assert(buf); + + switch (encoder->type) { +#ifdef QUIC_RGB + case QUIC_IMAGE_TYPE_RGB32: + case QUIC_IMAGE_TYPE_RGB24: + if (type == QUIC_IMAGE_TYPE_RGB32) { + spice_assert(ABS(stride) >= (int)encoder->width * 4); + QUIC_UNCOMPRESS_RGB(32, rgb32_pixel_t); + break; + } else if (type == QUIC_IMAGE_TYPE_RGB24) { + spice_assert(ABS(stride) >= (int)encoder->width * 3); + QUIC_UNCOMPRESS_RGB(24, rgb24_pixel_t); + break; + } + encoder->usr->warn(encoder->usr, "unsupported output format\n"); + return QUIC_ERROR; + case QUIC_IMAGE_TYPE_RGB16: + if (type == QUIC_IMAGE_TYPE_RGB16) { + spice_assert(ABS(stride) >= (int)encoder->width * 2); + QUIC_UNCOMPRESS_RGB(16, rgb16_pixel_t); + } else if (type == QUIC_IMAGE_TYPE_RGB32) { + spice_assert(ABS(stride) >= (int)encoder->width * 4); + QUIC_UNCOMPRESS_RGB(16_to_32, rgb32_pixel_t); + } else { + encoder->usr->warn(encoder->usr, "unsupported output format\n"); + return QUIC_ERROR; + } + + break; + case QUIC_IMAGE_TYPE_RGBA: + + if (type != QUIC_IMAGE_TYPE_RGBA) { + encoder->usr->warn(encoder->usr, "unsupported output format\n"); + return QUIC_ERROR; + } + spice_assert(ABS(stride) >= (int)encoder->width * 4); + uncompress_rgba(encoder, buf, stride); + break; +#else + case QUIC_IMAGE_TYPE_RGB24: + spice_assert(ABS(stride) >= (int)encoder->width * 3); + for (i = 0; i < 3; i++) { + encoder->channels[i].correlate_row[-1] = 0; + quic_three_uncompress_row0(encoder, &encoder->channels[i], (three_bytes_t *)(buf + i), + encoder->width); + } + encoder->rows_completed++; + for (row = 1; row < encoder->height; row++) { + prev = buf; + buf += stride; + for (i = 0; i < 3; i++) { + encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0]; + quic_three_uncompress_row(encoder, &encoder->channels[i], + (three_bytes_t *)(prev + i), + (three_bytes_t *)(buf + i), + encoder->width); + } + encoder->rows_completed++; + } + break; + case QUIC_IMAGE_TYPE_RGB32: + spice_assert(ABS(stride) >= encoder->width * 4); + for (i = 0; i < 3; i++) { + encoder->channels[i].correlate_row[-1] = 0; + quic_four_uncompress_row0(encoder, &encoder->channels[i], (four_bytes_t *)(buf + i), + encoder->width); + } + clear_row((four_bytes_t *)(buf + 3), encoder->width); + encoder->rows_completed++; + for (row = 1; row < encoder->height; row++) { + prev = buf; + buf += stride; + for (i = 0; i < 3; i++) { + encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0]; + quic_four_uncompress_row(encoder, &encoder->channels[i], + (four_bytes_t *)(prev + i), + (four_bytes_t *)(buf + i), + encoder->width); + } + clear_row((four_bytes_t *)(buf + 3), encoder->width); + encoder->rows_completed++; + } + break; + case QUIC_IMAGE_TYPE_RGBA: + spice_assert(ABS(stride) >= encoder->width * 4); + for (i = 0; i < 4; i++) { + encoder->channels[i].correlate_row[-1] = 0; + quic_four_uncompress_row0(encoder, &encoder->channels[i], (four_bytes_t *)(buf + i), + encoder->width); + } + encoder->rows_completed++; + for (row = 1; row < encoder->height; row++) { + prev = buf; + buf += stride; + for (i = 0; i < 4; i++) { + encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0]; + quic_four_uncompress_row(encoder, &encoder->channels[i], + (four_bytes_t *)(prev + i), + (four_bytes_t *)(buf + i), + encoder->width); + } + encoder->rows_completed++; + } + break; +#endif + case QUIC_IMAGE_TYPE_GRAY: + + if (type != QUIC_IMAGE_TYPE_GRAY) { + encoder->usr->warn(encoder->usr, "unsupported output format\n"); + return QUIC_ERROR; + } + spice_assert(ABS(stride) >= (int)encoder->width); + uncompress_gray(encoder, buf, stride); + break; + case QUIC_IMAGE_TYPE_INVALID: + default: + encoder->usr->error(encoder->usr, "bad image type\n"); + } + return QUIC_OK; +} + +static int need_init = TRUE; + +QuicContext *quic_create(QuicUsrContext *usr) +{ + Encoder *encoder; + + if (!usr || need_init || !usr->error || !usr->warn || !usr->info || !usr->malloc || + !usr->free || !usr->more_space || !usr->more_lines) { + return NULL; + } + + if (!(encoder = (Encoder *)usr->malloc(usr, sizeof(Encoder)))) { + return NULL; + } + + if (!init_encoder(encoder, usr)) { + usr->free(usr, encoder); + return NULL; + } + return (QuicContext *)encoder; +} + +void quic_destroy(QuicContext *quic) +{ + Encoder *encoder = (Encoder *)quic; + int i; + + if (!quic) { + return; + } + + for (i = 0; i < MAX_CHANNELS; i++) { + destroy_channel(&encoder->channels[i]); + } + encoder->usr->free(encoder->usr, encoder); +} + +void quic_init(void) +{ + if (!need_init) { + return; + } + need_init = FALSE; + + family_init(&family_8bpc, 8, DEFmaxclen); + family_init(&family_5bpc, 5, DEFmaxclen); +#if defined(RLE) && defined(RLE_STAT) + init_zeroLUT(); +#endif +} diff -Nru spice-gtk-0.9/spice-common/common/quic_config.h spice-gtk-0.12/spice-common/common/quic_config.h --- spice-gtk-0.9/spice-common/common/quic_config.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/quic_config.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,44 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef __QUIC_CONFIG_H +#define __QUIC_CONFIG_H + +#include +#include + +SPICE_BEGIN_DECLS + +#ifdef __GNUC__ +#include +#define MEMCLEAR(ptr, size) memset(ptr, 0, size) +#else +#ifdef QXLDD +#include +#include "os_dep.h" +#define MEMCLEAR(ptr, size) RtlZeroMemory(ptr, size) +#else +#include +#include +#define MEMCLEAR(ptr, size) memset(ptr, 0, size) +#endif // QXLDD +#endif //__GNUC__ + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/quic_family_tmpl.c spice-gtk-0.12/spice-common/common/quic_family_tmpl.c --- spice-gtk-0.9/spice-common/common/quic_family_tmpl.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/quic_family_tmpl.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,117 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef QUIC_FAMILY_8BPC +#undef QUIC_FAMILY_8BPC +#define FNAME(name) name##_8bpc +#define VNAME(name) name##_8bpc +#define BPC 8 +#endif + + +#ifdef QUIC_FAMILY_5BPC +#undef QUIC_FAMILY_5BPC +#define FNAME(name) name##_5bpc +#define VNAME(name) name##_5bpc +#define BPC 5 +#endif + + +static unsigned int FNAME(golomb_code_len)(const BYTE n, const unsigned int l) +{ + if (n < VNAME(family).nGRcodewords[l]) { + return (n >> l) + 1 + l; + } else { + return VNAME(family).notGRcwlen[l]; + } +} + +static void FNAME(golomb_coding)(const BYTE n, const unsigned int l, unsigned int * const codeword, + unsigned int * const codewordlen) +{ + if (n < VNAME(family).nGRcodewords[l]) { + (*codeword) = bitat[l] | (n & bppmask[l]); + (*codewordlen) = (n >> l) + l + 1; + } else { + (*codeword) = n - VNAME(family).nGRcodewords[l]; + (*codewordlen) = VNAME(family).notGRcwlen[l]; + } +} + +static unsigned int FNAME(golomb_decoding)(const unsigned int l, const unsigned int bits, + unsigned int * const codewordlen) +{ + if (bits > VNAME(family).notGRprefixmask[l]) { /*GR*/ + const unsigned int zeroprefix = cnt_l_zeroes(bits); /* leading zeroes in codeword */ + const unsigned int cwlen = zeroprefix + 1 + l; /* codeword length */ + (*codewordlen) = cwlen; + return (zeroprefix << l) | ((bits >> (32 - cwlen)) & bppmask[l]); + } else { /* not-GR */ + const unsigned int cwlen = VNAME(family).notGRcwlen[l]; + (*codewordlen) = cwlen; + return VNAME(family).nGRcodewords[l] + ((bits) >> (32 - cwlen) & + bppmask[VNAME(family).notGRsuffixlen[l]]); + } +} + +/* update the bucket using just encoded curval */ +static void FNAME(update_model)(CommonState *state, s_bucket * const bucket, + const BYTE curval, unsigned int bpp) +{ + COUNTER * const pcounters = bucket->pcounters; + unsigned int i; + unsigned int bestcode; + unsigned int bestcodelen; + //unsigned int bpp = encoder->bpp; + + /* update counters, find minimum */ + + bestcode = bpp - 1; + bestcodelen = (pcounters[bestcode] += FNAME(golomb_code_len)(curval, bestcode)); + + for (i = bpp - 2; i < bpp; i--) { /* NOTE: expression i=0 */ + const unsigned int ithcodelen = (pcounters[i] += FNAME(golomb_code_len)(curval, i)); + + if (ithcodelen < bestcodelen) { + bestcode = i; + bestcodelen = ithcodelen; + } + } + + bucket->bestcode = bestcode; /* store the found minimum */ + + if (bestcodelen > state->wm_trigger) { /* halving counters? */ + for (i = 0; i < bpp; i++) { + pcounters[i] >>= 1; + } + } +} + +static s_bucket *FNAME(find_bucket)(Channel *channel, const unsigned int val) +{ + spice_assert(val < (0x1U << BPC)); + + return channel->_buckets_ptrs[val]; +} + +#undef FNAME +#undef VNAME +#undef BPC diff -Nru spice-gtk-0.9/spice-common/common/quic.h spice-gtk-0.12/spice-common/common/quic.h --- spice-gtk-0.9/spice-common/common/quic.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/quic.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,70 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef __QUIC_H +#define __QUIC_H + +#include +#include "quic_config.h" +#include "macros.h" + +SPICE_BEGIN_DECLS + +typedef enum { + QUIC_IMAGE_TYPE_INVALID, + QUIC_IMAGE_TYPE_GRAY, + QUIC_IMAGE_TYPE_RGB16, + QUIC_IMAGE_TYPE_RGB24, + QUIC_IMAGE_TYPE_RGB32, + QUIC_IMAGE_TYPE_RGBA +} QuicImageType; + +#define QUIC_ERROR -1 +#define QUIC_OK 0 + +typedef void *QuicContext; + +typedef struct QuicUsrContext QuicUsrContext; +struct QuicUsrContext { + SPICE_ATTR_PRINTF(2, 3) void (*error)(QuicUsrContext *usr, const char *fmt, ...); + SPICE_ATTR_PRINTF(2, 3) void (*warn)(QuicUsrContext *usr, const char *fmt, ...); + SPICE_ATTR_PRINTF(2, 3) void (*info)(QuicUsrContext *usr, const char *fmt, ...); + void *(*malloc)(QuicUsrContext *usr, int size); + void (*free)(QuicUsrContext *usr, void *ptr); + int (*more_space)(QuicUsrContext *usr, uint32_t **io_ptr, int rows_completed); + int (*more_lines)(QuicUsrContext *usr, uint8_t **lines); // on return the last line of previous + // lines bunch must still be valid +}; + +int quic_encode(QuicContext *quic, QuicImageType type, int width, int height, + uint8_t *lines, unsigned int num_lines, int stride, + uint32_t *io_ptr, unsigned int num_io_words); + +int quic_decode_begin(QuicContext *quic, uint32_t *io_ptr, unsigned int num_io_words, + QuicImageType *type, int *width, int *height); +int quic_decode(QuicContext *quic, QuicImageType type, uint8_t *buf, int stride); + + +QuicContext *quic_create(QuicUsrContext *usr); +void quic_destroy(QuicContext *quic); + +void quic_init(void); + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/quic_rgb_tmpl.c spice-gtk-0.12/spice-common/common/quic_rgb_tmpl.c --- spice-gtk-0.9/spice-common/common/quic_rgb_tmpl.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/quic_rgb_tmpl.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,765 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef QUIC_RGB32 +#undef QUIC_RGB32 +#define PIXEL rgb32_pixel_t +#define FNAME(name) quic_rgb32_##name +#define golomb_coding golomb_coding_8bpc +#define golomb_decoding golomb_decoding_8bpc +#define update_model update_model_8bpc +#define find_bucket find_bucket_8bpc +#define family family_8bpc +#define BPC 8 +#define BPC_MASK 0xffU +#define COMPRESS_IMP +#define SET_r(pix, val) ((pix)->r = val) +#define GET_r(pix) ((pix)->r) +#define SET_g(pix, val) ((pix)->g = val) +#define GET_g(pix) ((pix)->g) +#define SET_b(pix, val) ((pix)->b = val) +#define GET_b(pix) ((pix)->b) +#define UNCOMPRESS_PIX_START(pix) ((pix)->pad = 0) +#endif + +#ifdef QUIC_RGB24 +#undef QUIC_RGB24 +#define PIXEL rgb24_pixel_t +#define FNAME(name) quic_rgb24_##name +#define golomb_coding golomb_coding_8bpc +#define golomb_decoding golomb_decoding_8bpc +#define update_model update_model_8bpc +#define find_bucket find_bucket_8bpc +#define family family_8bpc +#define BPC 8 +#define BPC_MASK 0xffU +#define COMPRESS_IMP +#define SET_r(pix, val) ((pix)->r = val) +#define GET_r(pix) ((pix)->r) +#define SET_g(pix, val) ((pix)->g = val) +#define GET_g(pix) ((pix)->g) +#define SET_b(pix, val) ((pix)->b = val) +#define GET_b(pix) ((pix)->b) +#define UNCOMPRESS_PIX_START(pix) +#endif + +#ifdef QUIC_RGB16 +#undef QUIC_RGB16 +#define PIXEL rgb16_pixel_t +#define FNAME(name) quic_rgb16_##name +#define golomb_coding golomb_coding_5bpc +#define golomb_decoding golomb_decoding_5bpc +#define update_model update_model_5bpc +#define find_bucket find_bucket_5bpc +#define family family_5bpc +#define BPC 5 +#define BPC_MASK 0x1fU +#define COMPRESS_IMP +#define SET_r(pix, val) (*(pix) = (*(pix) & ~(0x1f << 10)) | ((val) << 10)) +#define GET_r(pix) ((*(pix) >> 10) & 0x1f) +#define SET_g(pix, val) (*(pix) = (*(pix) & ~(0x1f << 5)) | ((val) << 5)) +#define GET_g(pix) ((*(pix) >> 5) & 0x1f) +#define SET_b(pix, val) (*(pix) = (*(pix) & ~0x1f) | (val)) +#define GET_b(pix) (*(pix) & 0x1f) +#define UNCOMPRESS_PIX_START(pix) (*(pix) = 0) +#endif + +#ifdef QUIC_RGB16_TO_32 +#undef QUIC_RGB16_TO_32 +#define PIXEL rgb32_pixel_t +#define FNAME(name) quic_rgb16_to_32_##name +#define golomb_coding golomb_coding_5bpc +#define golomb_decoding golomb_decoding_5bpc +#define update_model update_model_5bpc +#define find_bucket find_bucket_5bpc +#define family family_5bpc +#define BPC 5 +#define BPC_MASK 0x1fU + +#define SET_r(pix, val) ((pix)->r = ((val) << 3) | (((val) & 0x1f) >> 2)) +#define GET_r(pix) ((pix)->r >> 3) +#define SET_g(pix, val) ((pix)->g = ((val) << 3) | (((val) & 0x1f) >> 2)) +#define GET_g(pix) ((pix)->g >> 3) +#define SET_b(pix, val) ((pix)->b = ((val) << 3) | (((val) & 0x1f) >> 2)) +#define GET_b(pix) ((pix)->b >> 3) +#define UNCOMPRESS_PIX_START(pix) ((pix)->pad = 0) +#endif + +#define SAME_PIXEL(p1, p2) \ + (GET_r(p1) == GET_r(p2) && GET_g(p1) == GET_g(p2) && \ + GET_b(p1) == GET_b(p2)) + + +#define _PIXEL_A(channel, curr) ((unsigned int)GET_##channel((curr) - 1)) +#define _PIXEL_B(channel, prev) ((unsigned int)GET_##channel(prev)) +#define _PIXEL_C(channel, prev) ((unsigned int)GET_##channel((prev) - 1)) + +/* a */ + +#define DECORELATE_0(channel, curr, bpc_mask)\ + family.xlatU2L[(unsigned)((int)GET_##channel(curr) - (int)_PIXEL_A(channel, curr)) & bpc_mask] + +#define CORELATE_0(channel, curr, correlate, bpc_mask)\ + ((family.xlatL2U[correlate] + _PIXEL_A(channel, curr)) & bpc_mask) + +#ifdef PRED_1 + +/* (a+b)/2 */ +#define DECORELATE(channel, prev, curr, bpc_mask, r) \ + r = family.xlatU2L[(unsigned)((int)GET_##channel(curr) - (int)((_PIXEL_A(channel, curr) + \ + _PIXEL_B(channel, prev)) >> 1)) & bpc_mask] + +#define CORELATE(channel, prev, curr, correlate, bpc_mask, r) \ + SET_##channel(r, ((family.xlatL2U[correlate] + \ + (int)((_PIXEL_A(channel, curr) + _PIXEL_B(channel, prev)) >> 1)) & bpc_mask)) +#endif + +#ifdef PRED_2 + +/* .75a+.75b-.5c */ +#define DECORELATE(channel, prev, curr, bpc_mask, r) { \ + int p = ((int)(3 * (_PIXEL_A(channel, curr) + _PIXEL_B(channel, prev))) - \ + (int)(_PIXEL_C(channel, prev) << 1)) >> 2; \ + if (p < 0) { \ + p = 0; \ + } else if ((unsigned)p > bpc_mask) { \ + p = bpc_mask; \ + } \ + r = family.xlatU2L[(unsigned)((int)GET_##channel(curr) - p) & bpc_mask]; \ +} + +#define CORELATE(channel, prev, curr, correlate, bpc_mask, r) { \ + const int p = ((int)(3 * (_PIXEL_A(channel, curr) + _PIXEL_B(channel, prev))) - \ + (int)(_PIXEL_C(channel, prev) << 1) ) >> 2; \ + const unsigned int s = family.xlatL2U[correlate]; \ + if (!(p & ~bpc_mask)) { \ + SET_##channel(r, (s + (unsigned)p) & bpc_mask); \ + } else if (p < 0) { \ + SET_##channel(r, s); \ + } else { \ + SET_##channel(r, (s + bpc_mask) & bpc_mask); \ + } \ +} + +#endif + + +#define COMPRESS_ONE_ROW0_0(channel) \ + correlate_row_##channel[0] = family.xlatU2L[GET_##channel(cur_row)]; \ + golomb_coding(correlate_row_##channel[0], find_bucket(channel_##channel, \ + correlate_row_##channel[-1])->bestcode, \ + &codeword, &codewordlen); \ + encode(encoder, codeword, codewordlen); + +#define COMPRESS_ONE_ROW0(channel, index) \ + correlate_row_##channel[index] = DECORELATE_0(channel, &cur_row[index], bpc_mask); \ + golomb_coding(correlate_row_##channel[index], find_bucket(channel_##channel, \ + correlate_row_##channel[index -1])->bestcode, \ + &codeword, &codewordlen); \ + encode(encoder, codeword, codewordlen); + +#define UPDATE_MODEL(index) \ + update_model(&encoder->rgb_state, find_bucket(channel_r, correlate_row_r[index - 1]), \ + correlate_row_r[index], bpc); \ + update_model(&encoder->rgb_state, find_bucket(channel_g, correlate_row_g[index - 1]), \ + correlate_row_g[index], bpc); \ + update_model(&encoder->rgb_state, find_bucket(channel_b, correlate_row_b[index - 1]), \ + correlate_row_b[index], bpc); + + +#ifdef RLE_PRED_1 +#define RLE_PRED_1_IMP \ +if (SAME_PIXEL(&cur_row[i - 1], &prev_row[i])) { \ + if (run_index != i && SAME_PIXEL(&prev_row[i - 1], &prev_row[i]) && \ + i + 1 < end && SAME_PIXEL(&prev_row[i], &prev_row[i + 1])) { \ + goto do_run; \ + } \ +} +#else +#define RLE_PRED_1_IMP +#endif + +#ifdef RLE_PRED_2 +#define RLE_PRED_2_IMP \ +if (SAME_PIXEL(&prev_row[i - 1], &prev_row[i])) { \ + if (run_index != i && i > 2 && SAME_PIXEL(&cur_row[i - 1], &cur_row[i - 2])) { \ + goto do_run; \ + } \ +} +#else +#define RLE_PRED_2_IMP +#endif + +#ifdef RLE_PRED_3 +#define RLE_PRED_3_IMP \ +if (i > 1 && SAME_PIXEL(&cur_row[i - 1], &cur_row[i - 2]) && i != run_index) { \ + goto do_run; \ +} +#else +#define RLE_PRED_3_IMP +#endif + +#ifdef COMPRESS_IMP + +static void FNAME(compress_row0_seg)(Encoder *encoder, int i, + const PIXEL * const cur_row, + const int end, + const unsigned int waitmask, + const unsigned int bpc, + const unsigned int bpc_mask) +{ + Channel * const channel_r = encoder->channels; + Channel * const channel_g = channel_r + 1; + Channel * const channel_b = channel_g + 1; + + BYTE * const correlate_row_r = channel_r->correlate_row; + BYTE * const correlate_row_g = channel_g->correlate_row; + BYTE * const correlate_row_b = channel_b->correlate_row; + int stopidx; + + spice_assert(end - i > 0); + + if (!i) { + unsigned int codeword, codewordlen; + + COMPRESS_ONE_ROW0_0(r); + COMPRESS_ONE_ROW0_0(g); + COMPRESS_ONE_ROW0_0(b); + + if (encoder->rgb_state.waitcnt) { + encoder->rgb_state.waitcnt--; + } else { + encoder->rgb_state.waitcnt = (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); + UPDATE_MODEL(0); + } + stopidx = ++i + encoder->rgb_state.waitcnt; + } else { + stopidx = i + encoder->rgb_state.waitcnt; + } + + while (stopidx < end) { + for (; i <= stopidx; i++) { + unsigned int codeword, codewordlen; + COMPRESS_ONE_ROW0(r, i); + COMPRESS_ONE_ROW0(g, i); + COMPRESS_ONE_ROW0(b, i); + } + + UPDATE_MODEL(stopidx); + stopidx = i + (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); + } + + for (; i < end; i++) { + unsigned int codeword, codewordlen; + + COMPRESS_ONE_ROW0(r, i); + COMPRESS_ONE_ROW0(g, i); + COMPRESS_ONE_ROW0(b, i); + } + encoder->rgb_state.waitcnt = stopidx - end; +} + +static void FNAME(compress_row0)(Encoder *encoder, const PIXEL *cur_row, + unsigned int width) +{ + const unsigned int bpc = BPC; + const unsigned int bpc_mask = BPC_MASK; + int pos = 0; + + while ((wmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) { + if (encoder->rgb_state.wmileft) { + FNAME(compress_row0_seg)(encoder, pos, cur_row, pos + encoder->rgb_state.wmileft, + bppmask[encoder->rgb_state.wmidx], bpc, bpc_mask); + width -= encoder->rgb_state.wmileft; + pos += encoder->rgb_state.wmileft; + } + + encoder->rgb_state.wmidx++; + set_wm_trigger(&encoder->rgb_state); + encoder->rgb_state.wmileft = wminext; + } + + if (width) { + FNAME(compress_row0_seg)(encoder, pos, cur_row, pos + width, + bppmask[encoder->rgb_state.wmidx], bpc, bpc_mask); + if (wmimax > (int)encoder->rgb_state.wmidx) { + encoder->rgb_state.wmileft -= width; + } + } + + spice_assert((int)encoder->rgb_state.wmidx <= wmimax); + spice_assert(encoder->rgb_state.wmidx <= 32); + spice_assert(wminext > 0); +} + +#define COMPRESS_ONE_0(channel) \ + correlate_row_##channel[0] = family.xlatU2L[(unsigned)((int)GET_##channel(cur_row) - \ + (int)GET_##channel(prev_row) ) & bpc_mask]; \ + golomb_coding(correlate_row_##channel[0], \ + find_bucket(channel_##channel, correlate_row_##channel[-1])->bestcode, \ + &codeword, &codewordlen); \ + encode(encoder, codeword, codewordlen); + +#define COMPRESS_ONE(channel, index) \ + DECORELATE(channel, &prev_row[index], &cur_row[index],bpc_mask, \ + correlate_row_##channel[index]); \ + golomb_coding(correlate_row_##channel[index], \ + find_bucket(channel_##channel, correlate_row_##channel[index - 1])->bestcode, \ + &codeword, &codewordlen); \ + encode(encoder, codeword, codewordlen); + +static void FNAME(compress_row_seg)(Encoder *encoder, int i, + const PIXEL * const prev_row, + const PIXEL * const cur_row, + const int end, + const unsigned int waitmask, + const unsigned int bpc, + const unsigned int bpc_mask) +{ + Channel * const channel_r = encoder->channels; + Channel * const channel_g = channel_r + 1; + Channel * const channel_b = channel_g + 1; + + BYTE * const correlate_row_r = channel_r->correlate_row; + BYTE * const correlate_row_g = channel_g->correlate_row; + BYTE * const correlate_row_b = channel_b->correlate_row; + int stopidx; +#ifdef RLE + int run_index = 0; + int run_size; +#endif + + spice_assert(end - i > 0); + + if (!i) { + unsigned int codeword, codewordlen; + + COMPRESS_ONE_0(r); + COMPRESS_ONE_0(g); + COMPRESS_ONE_0(b); + + if (encoder->rgb_state.waitcnt) { + encoder->rgb_state.waitcnt--; + } else { + encoder->rgb_state.waitcnt = (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); + UPDATE_MODEL(0); + } + stopidx = ++i + encoder->rgb_state.waitcnt; + } else { + stopidx = i + encoder->rgb_state.waitcnt; + } + for (;;) { + while (stopidx < end) { + for (; i <= stopidx; i++) { + unsigned int codeword, codewordlen; +#ifdef RLE + RLE_PRED_1_IMP; + RLE_PRED_2_IMP; + RLE_PRED_3_IMP; +#endif + COMPRESS_ONE(r, i); + COMPRESS_ONE(g, i); + COMPRESS_ONE(b, i); + } + + UPDATE_MODEL(stopidx); + stopidx = i + (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); + } + + for (; i < end; i++) { + unsigned int codeword, codewordlen; +#ifdef RLE + RLE_PRED_1_IMP; + RLE_PRED_2_IMP; + RLE_PRED_3_IMP; +#endif + COMPRESS_ONE(r, i); + COMPRESS_ONE(g, i); + COMPRESS_ONE(b, i); + } + encoder->rgb_state.waitcnt = stopidx - end; + + return; + +#ifdef RLE +do_run: + run_index = i; + encoder->rgb_state.waitcnt = stopidx - i; + run_size = 0; + + while (SAME_PIXEL(&cur_row[i], &cur_row[i - 1])) { + run_size++; + if (++i == end) { + encode_run(encoder, run_size); + return; + } + } + encode_run(encoder, run_size); + stopidx = i + encoder->rgb_state.waitcnt; +#endif + } +} + +static void FNAME(compress_row)(Encoder *encoder, + const PIXEL * const prev_row, + const PIXEL * const cur_row, + unsigned int width) + +{ + const unsigned int bpc = BPC; + const unsigned int bpc_mask = BPC_MASK; + unsigned int pos = 0; + + while ((wmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) { + if (encoder->rgb_state.wmileft) { + FNAME(compress_row_seg)(encoder, pos, prev_row, cur_row, + pos + encoder->rgb_state.wmileft, + bppmask[encoder->rgb_state.wmidx], + bpc, bpc_mask); + width -= encoder->rgb_state.wmileft; + pos += encoder->rgb_state.wmileft; + } + + encoder->rgb_state.wmidx++; + set_wm_trigger(&encoder->rgb_state); + encoder->rgb_state.wmileft = wminext; + } + + if (width) { + FNAME(compress_row_seg)(encoder, pos, prev_row, cur_row, pos + width, + bppmask[encoder->rgb_state.wmidx], bpc, bpc_mask); + if (wmimax > (int)encoder->rgb_state.wmidx) { + encoder->rgb_state.wmileft -= width; + } + } + + spice_assert((int)encoder->rgb_state.wmidx <= wmimax); + spice_assert(encoder->rgb_state.wmidx <= 32); + spice_assert(wminext > 0); +} + +#endif + +#define UNCOMPRESS_ONE_ROW0_0(channel) \ + correlate_row_##channel[0] = (BYTE)golomb_decoding(find_bucket(channel_##channel, \ + correlate_row_##channel[-1])->bestcode, \ + encoder->io_word, &codewordlen); \ + SET_##channel(&cur_row[0], (BYTE)family.xlatL2U[correlate_row_##channel[0]]); \ + decode_eatbits(encoder, codewordlen); + +#define UNCOMPRESS_ONE_ROW0(channel) \ + correlate_row_##channel[i] = (BYTE)golomb_decoding(find_bucket(channel_##channel, \ + correlate_row_##channel[i - 1])->bestcode, \ + encoder->io_word, \ + &codewordlen); \ + SET_##channel(&cur_row[i], CORELATE_0(channel, &cur_row[i], correlate_row_##channel[i], \ + bpc_mask)); \ + decode_eatbits(encoder, codewordlen); + +static void FNAME(uncompress_row0_seg)(Encoder *encoder, int i, + PIXEL * const cur_row, + const int end, + const unsigned int waitmask, + const unsigned int bpc, + const unsigned int bpc_mask) +{ + Channel * const channel_r = encoder->channels; + Channel * const channel_g = channel_r + 1; + Channel * const channel_b = channel_g + 1; + + BYTE * const correlate_row_r = channel_r->correlate_row; + BYTE * const correlate_row_g = channel_g->correlate_row; + BYTE * const correlate_row_b = channel_b->correlate_row; + int stopidx; + + spice_assert(end - i > 0); + + if (!i) { + unsigned int codewordlen; + + UNCOMPRESS_PIX_START(&cur_row[i]); + UNCOMPRESS_ONE_ROW0_0(r); + UNCOMPRESS_ONE_ROW0_0(g); + UNCOMPRESS_ONE_ROW0_0(b); + + if (encoder->rgb_state.waitcnt) { + --encoder->rgb_state.waitcnt; + } else { + encoder->rgb_state.waitcnt = (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); + UPDATE_MODEL(0); + } + stopidx = ++i + encoder->rgb_state.waitcnt; + } else { + stopidx = i + encoder->rgb_state.waitcnt; + } + + while (stopidx < end) { + for (; i <= stopidx; i++) { + unsigned int codewordlen; + + UNCOMPRESS_PIX_START(&cur_row[i]); + UNCOMPRESS_ONE_ROW0(r); + UNCOMPRESS_ONE_ROW0(g); + UNCOMPRESS_ONE_ROW0(b); + } + UPDATE_MODEL(stopidx); + stopidx = i + (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); + } + + for (; i < end; i++) { + unsigned int codewordlen; + + UNCOMPRESS_PIX_START(&cur_row[i]); + UNCOMPRESS_ONE_ROW0(r); + UNCOMPRESS_ONE_ROW0(g); + UNCOMPRESS_ONE_ROW0(b); + } + encoder->rgb_state.waitcnt = stopidx - end; +} + +static void FNAME(uncompress_row0)(Encoder *encoder, + PIXEL * const cur_row, + unsigned int width) + +{ + const unsigned int bpc = BPC; + const unsigned int bpc_mask = BPC_MASK; + unsigned int pos = 0; + + while ((wmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) { + if (encoder->rgb_state.wmileft) { + FNAME(uncompress_row0_seg)(encoder, pos, cur_row, + pos + encoder->rgb_state.wmileft, + bppmask[encoder->rgb_state.wmidx], + bpc, bpc_mask); + pos += encoder->rgb_state.wmileft; + width -= encoder->rgb_state.wmileft; + } + + encoder->rgb_state.wmidx++; + set_wm_trigger(&encoder->rgb_state); + encoder->rgb_state.wmileft = wminext; + } + + if (width) { + FNAME(uncompress_row0_seg)(encoder, pos, cur_row, pos + width, + bppmask[encoder->rgb_state.wmidx], bpc, bpc_mask); + if (wmimax > (int)encoder->rgb_state.wmidx) { + encoder->rgb_state.wmileft -= width; + } + } + + spice_assert((int)encoder->rgb_state.wmidx <= wmimax); + spice_assert(encoder->rgb_state.wmidx <= 32); + spice_assert(wminext > 0); +} + +#define UNCOMPRESS_ONE_0(channel) \ + correlate_row_##channel[0] = (BYTE)golomb_decoding(find_bucket(channel_##channel, \ + correlate_row_##channel[-1])->bestcode, \ + encoder->io_word, &codewordlen); \ + SET_##channel(&cur_row[0], (family.xlatL2U[correlate_row_##channel[0]] + \ + GET_##channel(prev_row)) & bpc_mask); \ + decode_eatbits(encoder, codewordlen); + +#define UNCOMPRESS_ONE(channel) \ + correlate_row_##channel[i] = (BYTE)golomb_decoding(find_bucket(channel_##channel, \ + correlate_row_##channel[i - 1])->bestcode, \ + encoder->io_word, \ + &codewordlen); \ + CORELATE(channel, &prev_row[i], &cur_row[i], correlate_row_##channel[i], bpc_mask, \ + &cur_row[i]); \ + decode_eatbits(encoder, codewordlen); + +static void FNAME(uncompress_row_seg)(Encoder *encoder, + const PIXEL * const prev_row, + PIXEL * const cur_row, + int i, + const int end, + const unsigned int bpc, + const unsigned int bpc_mask) +{ + Channel * const channel_r = encoder->channels; + Channel * const channel_g = channel_r + 1; + Channel * const channel_b = channel_g + 1; + + BYTE * const correlate_row_r = channel_r->correlate_row; + BYTE * const correlate_row_g = channel_g->correlate_row; + BYTE * const correlate_row_b = channel_b->correlate_row; + const unsigned int waitmask = bppmask[encoder->rgb_state.wmidx]; + int stopidx; +#ifdef RLE + int run_index = 0; + int run_end; +#endif + + spice_assert(end - i > 0); + + if (!i) { + unsigned int codewordlen; + + UNCOMPRESS_PIX_START(&cur_row[i]); + UNCOMPRESS_ONE_0(r); + UNCOMPRESS_ONE_0(g); + UNCOMPRESS_ONE_0(b); + + if (encoder->rgb_state.waitcnt) { + --encoder->rgb_state.waitcnt; + } else { + encoder->rgb_state.waitcnt = (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); + UPDATE_MODEL(0); + } + stopidx = ++i + encoder->rgb_state.waitcnt; + } else { + stopidx = i + encoder->rgb_state.waitcnt; + } + for (;;) { + while (stopidx < end) { + for (; i <= stopidx; i++) { + unsigned int codewordlen; +#ifdef RLE + RLE_PRED_1_IMP; + RLE_PRED_2_IMP; + RLE_PRED_3_IMP; +#endif + UNCOMPRESS_PIX_START(&cur_row[i]); + UNCOMPRESS_ONE(r); + UNCOMPRESS_ONE(g); + UNCOMPRESS_ONE(b); + } + + UPDATE_MODEL(stopidx); + + stopidx = i + (tabrand(&encoder->rgb_state.tabrand_seed) & waitmask); + } + + for (; i < end; i++) { + unsigned int codewordlen; +#ifdef RLE + RLE_PRED_1_IMP; + RLE_PRED_2_IMP; + RLE_PRED_3_IMP; +#endif + UNCOMPRESS_PIX_START(&cur_row[i]); + UNCOMPRESS_ONE(r); + UNCOMPRESS_ONE(g); + UNCOMPRESS_ONE(b); + } + + encoder->rgb_state.waitcnt = stopidx - end; + + return; + +#ifdef RLE +do_run: + encoder->rgb_state.waitcnt = stopidx - i; + run_index = i; + run_end = i + decode_run(encoder); + + for (; i < run_end; i++) { + UNCOMPRESS_PIX_START(&cur_row[i]); + SET_r(&cur_row[i], GET_r(&cur_row[i - 1])); + SET_g(&cur_row[i], GET_g(&cur_row[i - 1])); + SET_b(&cur_row[i], GET_b(&cur_row[i - 1])); + } + + if (i == end) { + return; + } + + stopidx = i + encoder->rgb_state.waitcnt; +#endif + } +} + +static void FNAME(uncompress_row)(Encoder *encoder, + const PIXEL * const prev_row, + PIXEL * const cur_row, + unsigned int width) + +{ + const unsigned int bpc = BPC; + const unsigned int bpc_mask = BPC_MASK; + unsigned int pos = 0; + + while ((wmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) { + if (encoder->rgb_state.wmileft) { + FNAME(uncompress_row_seg)(encoder, prev_row, cur_row, pos, + pos + encoder->rgb_state.wmileft, bpc, bpc_mask); + pos += encoder->rgb_state.wmileft; + width -= encoder->rgb_state.wmileft; + } + + encoder->rgb_state.wmidx++; + set_wm_trigger(&encoder->rgb_state); + encoder->rgb_state.wmileft = wminext; + } + + if (width) { + FNAME(uncompress_row_seg)(encoder, prev_row, cur_row, pos, + pos + width, bpc, bpc_mask); + if (wmimax > (int)encoder->rgb_state.wmidx) { + encoder->rgb_state.wmileft -= width; + } + } + + spice_assert((int)encoder->rgb_state.wmidx <= wmimax); + spice_assert(encoder->rgb_state.wmidx <= 32); + spice_assert(wminext > 0); +} + +#undef PIXEL +#undef FNAME +#undef _PIXEL_A +#undef _PIXEL_B +#undef _PIXEL_C +#undef SAME_PIXEL +#undef RLE_PRED_1_IMP +#undef RLE_PRED_2_IMP +#undef RLE_PRED_3_IMP +#undef UPDATE_MODEL +#undef DECORELATE_0 +#undef DECORELATE +#undef COMPRESS_ONE_ROW0_0 +#undef COMPRESS_ONE_ROW0 +#undef COMPRESS_ONE_0 +#undef COMPRESS_ONE +#undef CORELATE_0 +#undef CORELATE +#undef UNCOMPRESS_ONE_ROW0_0 +#undef UNCOMPRESS_ONE_ROW0 +#undef UNCOMPRESS_ONE_0 +#undef UNCOMPRESS_ONE +#undef golomb_coding +#undef golomb_decoding +#undef update_model +#undef find_bucket +#undef family +#undef BPC +#undef BPC_MASK +#undef COMPRESS_IMP +#undef SET_r +#undef GET_r +#undef SET_g +#undef GET_g +#undef SET_b +#undef GET_b +#undef UNCOMPRESS_PIX_START diff -Nru spice-gtk-0.9/spice-common/common/quic_tmpl.c spice-gtk-0.12/spice-common/common/quic_tmpl.c --- spice-gtk-0.9/spice-common/common/quic_tmpl.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/quic_tmpl.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,635 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef ONE_BYTE +#undef ONE_BYTE +#define FNAME(name) quic_one_##name +#define PIXEL one_byte_t +#endif + +#ifdef THREE_BYTE +#undef THREE_BYTE +#define FNAME(name) quic_three_##name +#define PIXEL three_bytes_t +#endif + +#ifdef FOUR_BYTE +#undef FOUR_BYTE +#define FNAME(name) quic_four_##name +#define PIXEL four_bytes_t +#endif + +#define golomb_coding golomb_coding_8bpc +#define golomb_decoding golomb_decoding_8bpc +#define update_model update_model_8bpc +#define find_bucket find_bucket_8bpc +#define family family_8bpc + +#define BPC 8 +#define BPC_MASK 0xffU + +#define _PIXEL_A ((unsigned int)curr[-1].a) +#define _PIXEL_B ((unsigned int)prev[0].a) +#define _PIXEL_C ((unsigned int)prev[-1].a) + +#ifdef RLE_PRED_1 +#define RLE_PRED_1_IMP \ +if (cur_row[i - 1].a == prev_row[i].a) { \ + if (run_index != i && prev_row[i - 1].a == prev_row[i].a && \ + i + 1 < end && prev_row[i].a == prev_row[i + 1].a) { \ + goto do_run; \ + } \ +} +#else +#define RLE_PRED_1_IMP +#endif + +#ifdef RLE_PRED_2 +#define RLE_PRED_2_IMP \ +if (prev_row[i - 1].a == prev_row[i].a) { \ + if (run_index != i && i > 2 && cur_row[i - 1].a == cur_row[i - 2].a) { \ + goto do_run; \ + } \ +} +#else +#define RLE_PRED_2_IMP +#endif + +#ifdef RLE_PRED_3 +#define RLE_PRED_3_IMP \ +if (i > 1 && cur_row[i - 1].a == cur_row[i - 2].a && i != run_index) { \ + goto do_run; \ +} +#else +#define RLE_PRED_3_IMP +#endif + +/* a */ +static INLINE BYTE FNAME(decorelate_0)(const PIXEL * const curr, const unsigned int bpc_mask) +{ + return family.xlatU2L[(unsigned)((int)curr[0].a - (int)_PIXEL_A) & bpc_mask]; +} + +static INLINE void FNAME(corelate_0)(PIXEL *curr, const BYTE corelate, + const unsigned int bpc_mask) +{ + curr->a = (family.xlatL2U[corelate] + _PIXEL_A) & bpc_mask; +} + +#ifdef PRED_1 + +/* (a+b)/2 */ +static INLINE BYTE FNAME(decorelate)(const PIXEL *const prev, const PIXEL * const curr, + const unsigned int bpc_mask) +{ + return family.xlatU2L[(unsigned)((int)curr->a - (int)((_PIXEL_A + _PIXEL_B) >> 1)) & bpc_mask]; +} + + +static INLINE void FNAME(corelate)(const PIXEL *prev, PIXEL *curr, const BYTE corelate, + const unsigned int bpc_mask) +{ + curr->a = (family.xlatL2U[corelate] + (int)((_PIXEL_A + _PIXEL_B) >> 1)) & bpc_mask; +} + +#endif + +#ifdef PRED_2 + +/* .75a+.75b-.5c */ +static INLINE BYTE FNAME(decorelate)(const PIXEL *const prev, const PIXEL * const curr, + const unsigned int bpc_mask) +{ + int p = ((int)(3 * (_PIXEL_A + _PIXEL_B)) - (int)(_PIXEL_C << 1)) >> 2; + + if (p < 0) { + p = 0; + } else if ((unsigned)p > bpc_mask) { + p = bpc_mask; + } + + { + return family.xlatU2L[(unsigned)((int)curr->a - p) & bpc_mask]; + } +} + +static INLINE void FNAME(corelate)(const PIXEL *prev, PIXEL *curr, const BYTE corelate, + const unsigned int bpc_mask) +{ + const int p = ((int)(3 * (_PIXEL_A + _PIXEL_B)) - (int)(_PIXEL_C << 1)) >> 2; + const unsigned int s = family.xlatL2U[corelate]; + + if (!(p & ~bpc_mask)) { + curr->a = (s + (unsigned)p) & bpc_mask; + } else if (p < 0) { + curr->a = s; + } else { + curr->a = (s + bpc_mask) & bpc_mask; + } +} + +#endif + +static void FNAME(compress_row0_seg)(Encoder *encoder, Channel *channel, int i, + const PIXEL * const cur_row, + const int end, + const unsigned int waitmask, + const unsigned int bpc, + const unsigned int bpc_mask) +{ + BYTE * const decorelate_drow = channel->correlate_row; + int stopidx; + + spice_assert(end - i > 0); + + if (i == 0) { + unsigned int codeword, codewordlen; + + decorelate_drow[0] = family.xlatU2L[cur_row->a]; + golomb_coding(decorelate_drow[0], find_bucket(channel, decorelate_drow[-1])->bestcode, + &codeword, &codewordlen); + encode(encoder, codeword, codewordlen); + + if (channel->state.waitcnt) { + channel->state.waitcnt--; + } else { + channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); + update_model(&channel->state, find_bucket(channel, decorelate_drow[-1]), + decorelate_drow[i], bpc); + } + stopidx = ++i + channel->state.waitcnt; + } else { + stopidx = i + channel->state.waitcnt; + } + + while (stopidx < end) { + for (; i <= stopidx; i++) { + unsigned int codeword, codewordlen; + decorelate_drow[i] = FNAME(decorelate_0)(&cur_row[i], bpc_mask); + golomb_coding(decorelate_drow[i], + find_bucket(channel, decorelate_drow[i - 1])->bestcode, &codeword, + &codewordlen); + encode(encoder, codeword, codewordlen); + } + + update_model(&channel->state, find_bucket(channel, decorelate_drow[stopidx - 1]), + decorelate_drow[stopidx], bpc); + stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); + } + + for (; i < end; i++) { + unsigned int codeword, codewordlen; + decorelate_drow[i] = FNAME(decorelate_0)(&cur_row[i], bpc_mask); + golomb_coding(decorelate_drow[i], find_bucket(channel, decorelate_drow[i - 1])->bestcode, + &codeword, &codewordlen); + encode(encoder, codeword, codewordlen); + } + channel->state.waitcnt = stopidx - end; +} + +static void FNAME(compress_row0)(Encoder *encoder, Channel *channel, const PIXEL *cur_row, + unsigned int width) +{ + const unsigned int bpc = BPC; + const unsigned int bpc_mask = BPC_MASK; + int pos = 0; + + while ((wmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) { + if (channel->state.wmileft) { + FNAME(compress_row0_seg)(encoder, channel, pos, cur_row, pos + channel->state.wmileft, + bppmask[channel->state.wmidx], bpc, bpc_mask); + width -= channel->state.wmileft; + pos += channel->state.wmileft; + } + + channel->state.wmidx++; + set_wm_trigger(&channel->state); + channel->state.wmileft = wminext; + } + + if (width) { + FNAME(compress_row0_seg)(encoder, channel, pos, cur_row, pos + width, + bppmask[channel->state.wmidx], bpc, bpc_mask); + if (wmimax > (int)channel->state.wmidx) { + channel->state.wmileft -= width; + } + } + + spice_assert((int)channel->state.wmidx <= wmimax); + spice_assert(channel->state.wmidx <= 32); + spice_assert(wminext > 0); +} + +static void FNAME(compress_row_seg)(Encoder *encoder, Channel *channel, int i, + const PIXEL * const prev_row, + const PIXEL * const cur_row, + const int end, + const unsigned int waitmask, + const unsigned int bpc, + const unsigned int bpc_mask) +{ + BYTE * const decorelate_drow = channel->correlate_row; + int stopidx; +#ifdef RLE + int run_index = 0; + int run_size; +#endif + + spice_assert(end - i > 0); + + if (!i) { + unsigned int codeword, codewordlen; + + decorelate_drow[0] = family.xlatU2L[(unsigned)((int)cur_row->a - + (int)prev_row->a) & bpc_mask]; + + golomb_coding(decorelate_drow[0], + find_bucket(channel, decorelate_drow[-1])->bestcode, + &codeword, + &codewordlen); + encode(encoder, codeword, codewordlen); + + if (channel->state.waitcnt) { + channel->state.waitcnt--; + } else { + channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); + update_model(&channel->state, find_bucket(channel, decorelate_drow[-1]), + decorelate_drow[0], bpc); + } + stopidx = ++i + channel->state.waitcnt; + } else { + stopidx = i + channel->state.waitcnt; + } + for (;;) { + while (stopidx < end) { + for (; i <= stopidx; i++) { + unsigned int codeword, codewordlen; +#ifdef RLE + RLE_PRED_1_IMP; + RLE_PRED_2_IMP; + RLE_PRED_3_IMP; +#endif + decorelate_drow[i] = FNAME(decorelate)(&prev_row[i], &cur_row[i], bpc_mask); + golomb_coding(decorelate_drow[i], + find_bucket(channel, decorelate_drow[i - 1])->bestcode, &codeword, + &codewordlen); + encode(encoder, codeword, codewordlen); + } + + update_model(&channel->state, find_bucket(channel, decorelate_drow[stopidx - 1]), + decorelate_drow[stopidx], bpc); + stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); + } + + for (; i < end; i++) { + unsigned int codeword, codewordlen; +#ifdef RLE + RLE_PRED_1_IMP; + RLE_PRED_2_IMP; + RLE_PRED_3_IMP; +#endif + decorelate_drow[i] = FNAME(decorelate)(&prev_row[i], &cur_row[i], bpc_mask); + golomb_coding(decorelate_drow[i], find_bucket(channel, + decorelate_drow[i - 1])->bestcode, + &codeword, &codewordlen); + encode(encoder, codeword, codewordlen); + } + channel->state.waitcnt = stopidx - end; + + return; + +#ifdef RLE +do_run: + run_index = i; + channel->state.waitcnt = stopidx - i; + run_size = 0; + + while (cur_row[i].a == cur_row[i - 1].a) { + run_size++; + if (++i == end) { +#ifdef RLE_STAT + encode_channel_run(encoder, channel, run_size); +#else + encode_run(encoder, run_size); +#endif + return; + } + } +#ifdef RLE_STAT + encode_channel_run(encoder, channel, run_size); +#else + encode_run(encoder, run_size); +#endif + stopidx = i + channel->state.waitcnt; +#endif + } +} + +static void FNAME(compress_row)(Encoder *encoder, Channel *channel, + const PIXEL * const prev_row, + const PIXEL * const cur_row, + unsigned int width) + +{ + const unsigned int bpc = BPC; + const unsigned int bpc_mask = BPC_MASK; + unsigned int pos = 0; + + while ((wmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) { + if (channel->state.wmileft) { + FNAME(compress_row_seg)(encoder, channel, pos, prev_row, cur_row, + pos + channel->state.wmileft, bppmask[channel->state.wmidx], + bpc, bpc_mask); + width -= channel->state.wmileft; + pos += channel->state.wmileft; + } + + channel->state.wmidx++; + set_wm_trigger(&channel->state); + channel->state.wmileft = wminext; + } + + if (width) { + FNAME(compress_row_seg)(encoder, channel, pos, prev_row, cur_row, pos + width, + bppmask[channel->state.wmidx], bpc, bpc_mask); + if (wmimax > (int)channel->state.wmidx) { + channel->state.wmileft -= width; + } + } + + spice_assert((int)channel->state.wmidx <= wmimax); + spice_assert(channel->state.wmidx <= 32); + spice_assert(wminext > 0); +} + +static void FNAME(uncompress_row0_seg)(Encoder *encoder, Channel *channel, int i, + BYTE * const correlate_row, + PIXEL * const cur_row, + const int end, + const unsigned int waitmask, + const unsigned int bpc, + const unsigned int bpc_mask) +{ + int stopidx; + + spice_assert(end - i > 0); + + if (i == 0) { + unsigned int codewordlen; + + correlate_row[0] = (BYTE)golomb_decoding(find_bucket(channel, + correlate_row[-1])->bestcode, + encoder->io_word, &codewordlen); + cur_row[0].a = (BYTE)family.xlatL2U[correlate_row[0]]; + decode_eatbits(encoder, codewordlen); + + if (channel->state.waitcnt) { + --channel->state.waitcnt; + } else { + channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); + update_model(&channel->state, find_bucket(channel, correlate_row[-1]), + correlate_row[0], bpc); + } + stopidx = ++i + channel->state.waitcnt; + } else { + stopidx = i + channel->state.waitcnt; + } + + while (stopidx < end) { + struct s_bucket * pbucket = NULL; + + for (; i <= stopidx; i++) { + unsigned int codewordlen; + + pbucket = find_bucket(channel, correlate_row[i - 1]); + correlate_row[i] = (BYTE)golomb_decoding(pbucket->bestcode, encoder->io_word, + &codewordlen); + FNAME(corelate_0)(&cur_row[i], correlate_row[i], bpc_mask); + decode_eatbits(encoder, codewordlen); + } + + update_model(&channel->state, pbucket, correlate_row[stopidx], bpc); + + stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); + } + + for (; i < end; i++) { + unsigned int codewordlen; + + correlate_row[i] = (BYTE)golomb_decoding(find_bucket(channel, + correlate_row[i - 1])->bestcode, + encoder->io_word, &codewordlen); + FNAME(corelate_0)(&cur_row[i], correlate_row[i], bpc_mask); + decode_eatbits(encoder, codewordlen); + } + channel->state.waitcnt = stopidx - end; +} + +static void FNAME(uncompress_row0)(Encoder *encoder, Channel *channel, + PIXEL * const cur_row, + unsigned int width) + +{ + const unsigned int bpc = BPC; + const unsigned int bpc_mask = BPC_MASK; + BYTE * const correlate_row = channel->correlate_row; + unsigned int pos = 0; + + while ((wmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) { + if (channel->state.wmileft) { + FNAME(uncompress_row0_seg)(encoder, channel, pos, correlate_row, cur_row, + pos + channel->state.wmileft, bppmask[channel->state.wmidx], + bpc, bpc_mask); + pos += channel->state.wmileft; + width -= channel->state.wmileft; + } + + channel->state.wmidx++; + set_wm_trigger(&channel->state); + channel->state.wmileft = wminext; + } + + if (width) { + FNAME(uncompress_row0_seg)(encoder, channel, pos, correlate_row, cur_row, pos + width, + bppmask[channel->state.wmidx], bpc, bpc_mask); + if (wmimax > (int)channel->state.wmidx) { + channel->state.wmileft -= width; + } + } + + spice_assert((int)channel->state.wmidx <= wmimax); + spice_assert(channel->state.wmidx <= 32); + spice_assert(wminext > 0); +} + +static void FNAME(uncompress_row_seg)(Encoder *encoder, Channel *channel, + BYTE *correlate_row, + const PIXEL * const prev_row, + PIXEL * const cur_row, + int i, + const int end, + const unsigned int bpc, + const unsigned int bpc_mask) +{ + const unsigned int waitmask = bppmask[channel->state.wmidx]; + int stopidx; +#ifdef RLE + int run_index = 0; + int run_end; +#endif + + spice_assert(end - i > 0); + + if (i == 0) { + unsigned int codewordlen; + + correlate_row[0] = (BYTE)golomb_decoding(find_bucket(channel, correlate_row[-1])->bestcode, + encoder->io_word, &codewordlen); + cur_row[0].a = (family.xlatL2U[correlate_row[0]] + prev_row[0].a) & bpc_mask; + decode_eatbits(encoder, codewordlen); + + if (channel->state.waitcnt) { + --channel->state.waitcnt; + } else { + channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask); + update_model(&channel->state, find_bucket(channel, correlate_row[-1]), + correlate_row[0], bpc); + } + stopidx = ++i + channel->state.waitcnt; + } else { + stopidx = i + channel->state.waitcnt; + } + for (;;) { + while (stopidx < end) { + struct s_bucket * pbucket = NULL; + + for (; i <= stopidx; i++) { + unsigned int codewordlen; +#ifdef RLE + RLE_PRED_1_IMP; + RLE_PRED_2_IMP; + RLE_PRED_3_IMP; +#endif + pbucket = find_bucket(channel, correlate_row[i - 1]); + correlate_row[i] = (BYTE)golomb_decoding(pbucket->bestcode, encoder->io_word, + &codewordlen); + FNAME(corelate)(&prev_row[i], &cur_row[i], correlate_row[i], bpc_mask); + decode_eatbits(encoder, codewordlen); + } + + update_model(&channel->state, pbucket, correlate_row[stopidx], bpc); + + stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask); + } + + for (; i < end; i++) { + unsigned int codewordlen; +#ifdef RLE + RLE_PRED_1_IMP; + RLE_PRED_2_IMP; + RLE_PRED_3_IMP; +#endif + correlate_row[i] = (BYTE)golomb_decoding(find_bucket(channel, + correlate_row[i - 1])->bestcode, + encoder->io_word, &codewordlen); + FNAME(corelate)(&prev_row[i], &cur_row[i], correlate_row[i], bpc_mask); + decode_eatbits(encoder, codewordlen); + } + + channel->state.waitcnt = stopidx - end; + + return; + +#ifdef RLE +do_run: + channel->state.waitcnt = stopidx - i; + run_index = i; +#ifdef RLE_STAT + run_end = i + decode_channel_run(encoder, channel); +#else + run_end = i + decode_run(encoder); +#endif + + for (; i < run_end; i++) { + cur_row[i].a = cur_row[i - 1].a; + } + + if (i == end) { + return; + } + + stopidx = i + channel->state.waitcnt; +#endif + } +} + +static void FNAME(uncompress_row)(Encoder *encoder, Channel *channel, + const PIXEL * const prev_row, + PIXEL * const cur_row, + unsigned int width) + +{ + const unsigned int bpc = BPC; + const unsigned int bpc_mask = BPC_MASK; + BYTE * const correlate_row = channel->correlate_row; + unsigned int pos = 0; + + while ((wmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) { + if (channel->state.wmileft) { + FNAME(uncompress_row_seg)(encoder, channel, correlate_row, prev_row, cur_row, pos, + pos + channel->state.wmileft, bpc, bpc_mask); + pos += channel->state.wmileft; + width -= channel->state.wmileft; + } + + channel->state.wmidx++; + set_wm_trigger(&channel->state); + channel->state.wmileft = wminext; + } + + if (width) { + FNAME(uncompress_row_seg)(encoder, channel, correlate_row, prev_row, cur_row, pos, + pos + width, bpc, bpc_mask); + if (wmimax > (int)channel->state.wmidx) { + channel->state.wmileft -= width; + } + } + + spice_assert((int)channel->state.wmidx <= wmimax); + spice_assert(channel->state.wmidx <= 32); + spice_assert(wminext > 0); +} + +#undef PIXEL +#undef FNAME +#undef _PIXEL_A +#undef _PIXEL_B +#undef _PIXEL_C +#undef RLE_PRED_1_IMP +#undef RLE_PRED_2_IMP +#undef RLE_PRED_3_IMP +#undef golomb_coding +#undef golomb_deoding +#undef update_model +#undef find_bucket +#undef family +#undef BPC +#undef BPC_MASK diff -Nru spice-gtk-0.9/spice-common/common/rect.h spice-gtk-0.12/spice-common/common/rect.h --- spice-gtk-0.9/spice-common/common/rect.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/rect.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,118 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H_RECT +#define _H_RECT + +#include +#include "draw.h" + +SPICE_BEGIN_DECLS + +static INLINE void rect_sect(SpiceRect* r, const SpiceRect* bounds) +{ + r->left = MAX(r->left, bounds->left); + r->right = MIN(r->right, bounds->right); + r->right = MAX(r->left, r->right); + + r->top = MAX(r->top, bounds->top); + r->bottom = MIN(r->bottom, bounds->bottom); + r->bottom = MAX(r->top, r->bottom); +} + +static INLINE void rect_offset(SpiceRect* r, int dx, int dy) +{ + r->left += dx; + r->right += dx; + r->top += dy; + r->bottom += dy; +} + +static INLINE int rect_is_empty(const SpiceRect* r) +{ + return r->top == r->bottom || r->left == r->right; +} + +static INLINE int rect_intersects(const SpiceRect* r1, const SpiceRect* r2) +{ + return r1->left < r2->right && r1->right > r2->left && + r1->top < r2->bottom && r1->bottom > r2->top; +} + +static INLINE int rect_is_equal(const SpiceRect *r1, const SpiceRect *r2) +{ + return r1->top == r2->top && r1->left == r2->left && + r1->bottom == r2->bottom && r1->right == r2->right; +} + +static INLINE void rect_union(SpiceRect *dest, const SpiceRect *r) +{ + dest->top = MIN(dest->top, r->top); + dest->left = MIN(dest->left, r->left); + dest->bottom = MAX(dest->bottom, r->bottom); + dest->right = MAX(dest->right, r->right); +} + +static INLINE int rect_is_same_size(const SpiceRect *r1, const SpiceRect *r2) +{ + return r1->right - r1->left == r2->right - r2->left && + r1->bottom - r1->top == r2->bottom - r2->top; +} + +SPICE_END_DECLS + +#ifdef __cplusplus + +static inline void rect_sect(SpiceRect& r, const SpiceRect& bounds) +{ + rect_sect(&r, &bounds); +} + +static inline void rect_offset(SpiceRect& r, int dx, int dy) +{ + rect_offset(&r, dx, dy); +} + +static inline int rect_is_empty(const SpiceRect& r) +{ + return rect_is_empty(&r); +} + +static inline int rect_intersects(const SpiceRect& r1, const SpiceRect& r2) +{ + return rect_intersects(&r1, &r2); +} + +static inline int rect_is_equal(const SpiceRect& r1, const SpiceRect& r2) +{ + return rect_is_equal(&r1, &r2); +} + +static inline void rect_union(SpiceRect& dest, const SpiceRect& r) +{ + rect_union(&dest, &r); +} + +static inline int rect_is_same_size(const SpiceRect& r1, const SpiceRect& r2) +{ + return rect_is_same_size(&r1, &r2); +} + +#endif /* __cplusplus */ + +#endif diff -Nru spice-gtk-0.9/spice-common/common/region.c spice-gtk-0.12/spice-common/common/region.c --- spice-gtk-0.9/spice-common/common/region.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/region.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,890 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include + +#include "region.h" +#include "rect.h" +#include "mem.h" + +/* true iff two Boxes overlap */ +#define EXTENTCHECK(r1, r2) \ + (!( ((r1)->x2 <= (r2)->x1) || \ + ((r1)->x1 >= (r2)->x2) || \ + ((r1)->y2 <= (r2)->y1) || \ + ((r1)->y1 >= (r2)->y2) ) ) + +/* true iff Box r1 contains Box r2 */ +#define SUBSUMES(r1, r2) \ + ( ((r1)->x1 <= (r2)->x1) && \ + ((r1)->x2 >= (r2)->x2) && \ + ((r1)->y1 <= (r2)->y1) && \ + ((r1)->y2 >= (r2)->y2) ) + + +void region_init(QRegion *rgn) +{ + pixman_region32_init(rgn); +} + +void region_clear(QRegion *rgn) +{ + pixman_region32_fini(rgn); + pixman_region32_init(rgn); +} + +void region_destroy(QRegion *rgn) +{ + pixman_region32_fini(rgn); +} + +void region_clone(QRegion *dest, const QRegion *src) +{ + pixman_region32_init(dest); + pixman_region32_copy(dest, (pixman_region32_t *)src); +} + +#define FIND_BAND(r, r_band_end, r_end, ry1) \ + do { \ + ry1 = r->y1; \ + r_band_end = r + 1; \ + while ((r_band_end != r_end) && (r_band_end->y1 == ry1)) { \ + r_band_end++; \ + } \ + } while (0) + +static int test_band(int query, + int res, + pixman_box32_t *r1, + pixman_box32_t *r1_end, + pixman_box32_t *r2, + pixman_box32_t *r2_end) +{ + int x1; + int x2; + + do { + x1 = MAX(r1->x1, r2->x1); + x2 = MIN(r1->x2, r2->x2); + + /* + * Is there any overlap between the two rectangles? + */ + if (x1 < x2) { + res |= REGION_TEST_SHARED; + + if (r1->x1 < r2->x1 || r1->x2 > r2->x2) { + res |= REGION_TEST_LEFT_EXCLUSIVE; + } + + if (r2->x1 < r1->x1 || r2->x2 > r1->x2) { + res |= REGION_TEST_RIGHT_EXCLUSIVE; + } + } else { + /* No overlap at all, the leftmost is exclusive */ + if (r1->x1 < r2->x1) { + res |= REGION_TEST_LEFT_EXCLUSIVE; + } else { + res |= REGION_TEST_RIGHT_EXCLUSIVE; + } + } + + if ((res & query) == query) { + return res; + } + + /* + * Advance the pointer(s) with the leftmost right side, since the next + * rectangle on that list may still overlap the other region's + * current rectangle. + */ + if (r1->x2 == x2) { + r1++; + } + if (r2->x2 == x2) { + r2++; + } + } while ((r1 != r1_end) && (r2 != r2_end)); + + /* + * Deal with whichever band (if any) still has rectangles left. + */ + if (r1 != r1_end) { + res |= REGION_TEST_LEFT_EXCLUSIVE; + } else if (r2 != r2_end) { + res |= REGION_TEST_RIGHT_EXCLUSIVE; + } + + return res; +} + +static int test_generic (pixman_region32_t *reg1, + pixman_region32_t *reg2, + int query) +{ + pixman_box32_t *r1; /* Pointer into first region */ + pixman_box32_t *r2; /* Pointer into 2d region */ + pixman_box32_t *r1_end; /* End of 1st region */ + pixman_box32_t *r2_end; /* End of 2d region */ + int ybot; /* Bottom of intersection */ + int ytop; /* Top of intersection */ + pixman_box32_t * r1_band_end; /* End of current band in r1 */ + pixman_box32_t * r2_band_end; /* End of current band in r2 */ + int top; /* Top of non-overlapping band */ + int bot; /* Bottom of non-overlapping band*/ + int r1y1; /* Temps for r1->y1 and r2->y1 */ + int r2y1; + int r1_num_rects; + int r2_num_rects; + int res; + + r1 = pixman_region32_rectangles(reg1, &r1_num_rects); + r1_end = r1 + r1_num_rects; + + r2 = pixman_region32_rectangles(reg2, &r2_num_rects); + r2_end = r2 + r2_num_rects; + + res = 0; + + /* + * Initialize ybot. + * In the upcoming loop, ybot and ytop serve different functions depending + * on whether the band being handled is an overlapping or non-overlapping + * band. + * In the case of a non-overlapping band (only one of the regions + * has points in the band), ybot is the bottom of the most recent + * intersection and thus clips the top of the rectangles in that band. + * ytop is the top of the next intersection between the two regions and + * serves to clip the bottom of the rectangles in the current band. + * For an overlapping band (where the two regions intersect), ytop clips + * the top of the rectangles of both regions and ybot clips the bottoms. + */ + + ybot = MIN(r1->y1, r2->y1); + + do { + /* + * This algorithm proceeds one source-band (as opposed to a + * destination band, which is determined by where the two regions + * intersect) at a time. r1_band_end and r2_band_end serve to mark the + * rectangle after the last one in the current band for their + * respective regions. + */ + FIND_BAND(r1, r1_band_end, r1_end, r1y1); + FIND_BAND(r2, r2_band_end, r2_end, r2y1); + + /* + * First handle the band that doesn't intersect, if any. + * + * Note that attention is restricted to one band in the + * non-intersecting region at once, so if a region has n + * bands between the current position and the next place it overlaps + * the other, this entire loop will be passed through n times. + */ + if (r1y1 < r2y1) { + top = MAX (r1y1, ybot); + bot = MIN (r1->y2, r2y1); + if (top != bot) { + res |= REGION_TEST_LEFT_EXCLUSIVE; + + if ((res & query) == query) { + return res & query; + } + } + + ytop = r2y1; + } else if (r2y1 < r1y1) { + top = MAX (r2y1, ybot); + bot = MIN (r2->y2, r1y1); + + if (top != bot) { + res |= REGION_TEST_RIGHT_EXCLUSIVE; + + if ((res & query) == query) { + return res & query; + } + } + ytop = r1y1; + } else { + ytop = r1y1; + } + + /* + * Now see if we've hit an intersecting band. The two bands only + * intersect if ybot > ytop + */ + ybot = MIN (r1->y2, r2->y2); + if (ybot > ytop) { + res = test_band(query, res, + r1, r1_band_end, + r2, r2_band_end); + if ((res & query) == query) { + return res & query; + } + } + + /* + * If we've finished with a band (y2 == ybot) we skip forward + * in the region to the next band. + */ + if (r1->y2 == ybot) { + r1 = r1_band_end; + } + + if (r2->y2 == ybot) { + r2 = r2_band_end; + } + + } + while (r1 != r1_end && r2 != r2_end); + + /* + * Deal with whichever region (if any) still has rectangles left. + */ + + if (r1 != r1_end) { + res |= REGION_TEST_LEFT_EXCLUSIVE; + } else if (r2 != r2_end) { + res |= REGION_TEST_RIGHT_EXCLUSIVE; + } + + return res & query; +} + +int region_test(const QRegion *_reg1, const QRegion *_reg2, int query) +{ + int res; + pixman_region32_t *reg1 = (pixman_region32_t *)_reg1; + pixman_region32_t *reg2 = (pixman_region32_t *)_reg2; + + query = (query) ? query & REGION_TEST_ALL : REGION_TEST_ALL; + + res = 0; + + if (!pixman_region32_not_empty(reg1) || !pixman_region32_not_empty(reg2) || + !EXTENTCHECK (®1->extents, ®2->extents)) { + /* One or more regions are empty or they are disjoint */ + + if (pixman_region32_not_empty(reg1)) { + res |= REGION_TEST_LEFT_EXCLUSIVE; + } + + if (pixman_region32_not_empty(reg2)) { + res |= REGION_TEST_RIGHT_EXCLUSIVE; + } + + return res & query; + } else if (!reg1->data && !reg2->data) { + /* Just two rectangles that intersect */ + res |= REGION_TEST_SHARED; + + if (!SUBSUMES(®1->extents, ®2->extents)) { + res |= REGION_TEST_RIGHT_EXCLUSIVE; + } + + if (!SUBSUMES(®2->extents, ®1->extents)) { + res |= REGION_TEST_LEFT_EXCLUSIVE; + } + + return res & query; + } else if (!reg2->data && SUBSUMES (®2->extents, ®1->extents)) { + /* reg2 is just a rect that contains all of reg1 */ + + res |= REGION_TEST_SHARED; /* some piece must be shared, because reg is not empty */ + res |= REGION_TEST_RIGHT_EXCLUSIVE; /* reg2 contains all of reg1 and then some */ + + return res & query; + } else if (!reg1->data && SUBSUMES (®1->extents, ®2->extents)) { + /* reg1 is just a rect that contains all of reg2 */ + + res |= REGION_TEST_SHARED; /* some piece must be shared, because reg is not empty */ + res |= REGION_TEST_LEFT_EXCLUSIVE; /* reg1 contains all of reg2 and then some */ + + return res & query; + } else if (reg1 == reg2) { + res |= REGION_TEST_SHARED; + return res & query; + } else { + /* General purpose intersection */ + return test_generic (reg1, reg2, query); + } +} + +int region_is_valid(const QRegion *rgn) +{ + return pixman_region32_selfcheck((pixman_region32_t *)rgn); +} + +int region_is_empty(const QRegion *rgn) +{ + return !pixman_region32_not_empty((pixman_region32_t *)rgn); +} + +SpiceRect *region_dup_rects(const QRegion *rgn, uint32_t *num_rects) +{ + pixman_box32_t *boxes; + SpiceRect *rects; + int n, i; + + boxes = pixman_region32_rectangles((pixman_region32_t *)rgn, &n); + if (num_rects) { + *num_rects = n; + } + rects = spice_new(SpiceRect, n); + for (i = 0; i < n; i++) { + rects[i].left = boxes[i].x1; + rects[i].top = boxes[i].y1; + rects[i].right = boxes[i].x2; + rects[i].bottom = boxes[i].y2; + } + return rects; +} + +void region_ret_rects(const QRegion *rgn, SpiceRect *rects, uint32_t num_rects) +{ + pixman_box32_t *boxes; + unsigned int n, i; + + boxes = pixman_region32_rectangles((pixman_region32_t *)rgn, (int *)&n); + for (i = 0; i < n && i < num_rects; i++) { + rects[i].left = boxes[i].x1; + rects[i].top = boxes[i].y1; + rects[i].right = boxes[i].x2; + rects[i].bottom = boxes[i].y2; + } + + if (i && i != n) { + unsigned int x; + + for (x = 0; x < (n - num_rects); ++x) { + rects[i - 1].left = MIN(rects[i - 1].left, boxes[i + x].x1); + rects[i - 1].top = MIN(rects[i - 1].top, boxes[i + x].y1); + rects[i - 1].right = MAX(rects[i - 1].right, boxes[i + x].x2); + rects[i - 1].bottom = MAX(rects[i - 1].bottom, boxes[i + x].y2); + } + } +} + + +int region_is_equal(const QRegion *rgn1, const QRegion *rgn2) +{ + return pixman_region32_equal((pixman_region32_t *)rgn1, (pixman_region32_t *)rgn2); +} + +int region_intersects(const QRegion *rgn1, const QRegion *rgn2) +{ + int test_res; + + if (!region_bounds_intersects(rgn1, rgn2)) { + return FALSE; + } + + test_res = region_test(rgn1, rgn2, REGION_TEST_SHARED); + return !!test_res; +} + +int region_bounds_intersects(const QRegion *rgn1, const QRegion *rgn2) +{ + pixman_box32_t *extents1, *extents2; + + extents1 = pixman_region32_extents((pixman_region32_t *)rgn1); + extents2 = pixman_region32_extents((pixman_region32_t *)rgn1); + + return EXTENTCHECK(extents1, extents2); +} + +int region_contains(const QRegion *rgn, const QRegion *other) +{ + int test_res; + + test_res = region_test(rgn, other, REGION_TEST_RIGHT_EXCLUSIVE); + return !test_res; +} + +int region_contains_point(const QRegion *rgn, int32_t x, int32_t y) +{ + return pixman_region32_contains_point((pixman_region32_t *)rgn, x, y, NULL); +} + +void region_or(QRegion *rgn, const QRegion *other_rgn) +{ + pixman_region32_union(rgn, rgn, (pixman_region32_t *)other_rgn); +} + +void region_and(QRegion *rgn, const QRegion *other_rgn) +{ + pixman_region32_intersect(rgn, rgn, (pixman_region32_t *)other_rgn); +} + +void region_xor(QRegion *rgn, const QRegion *other_rgn) +{ + pixman_region32_t intersection; + + pixman_region32_copy(&intersection, rgn); + pixman_region32_intersect(&intersection, + &intersection, + (pixman_region32_t *)other_rgn); + pixman_region32_union(rgn, rgn, (pixman_region32_t *)other_rgn); + pixman_region32_subtract(rgn, rgn, &intersection); + pixman_region32_fini(&intersection); +} + +void region_exclude(QRegion *rgn, const QRegion *other_rgn) +{ + pixman_region32_subtract(rgn, rgn, (pixman_region32_t *)other_rgn); +} + +void region_add(QRegion *rgn, const SpiceRect *r) +{ + pixman_region32_union_rect(rgn, rgn, r->left, r->top, + r->right - r->left, + r->bottom - r->top); +} + +void region_remove(QRegion *rgn, const SpiceRect *r) +{ + pixman_region32_t rg; + + pixman_region32_init_rect(&rg, r->left, r->top, + r->right - r->left, + r->bottom - r->top); + pixman_region32_subtract(rgn, rgn, &rg); + pixman_region32_fini(&rg); +} + + +void region_offset(QRegion *rgn, int32_t dx, int32_t dy) +{ + pixman_region32_translate(rgn, dx, dy); +} + +void region_dump(const QRegion *rgn, const char *prefix) +{ + pixman_box32_t *rects, *extents; + int n_rects, i; + + printf("%sREGION: %p, ", prefix, rgn); + + if (!pixman_region32_not_empty((pixman_region32_t *)rgn)) { + printf("EMPTY\n"); + return; + } + + extents = pixman_region32_extents((pixman_region32_t *)rgn); + rects = pixman_region32_rectangles((pixman_region32_t *)rgn, &n_rects); + printf("num %u bounds (%d, %d, %d, %d)\n", + n_rects, + extents->x1, + extents->y1, + extents->x2, + extents->y2); + + + for (i = 0; i < n_rects; i++) { + printf("%*s %12d %12d %12d %12d\n", + (int)strlen(prefix), "", + rects[i].x1, + rects[i].y1, + rects[i].x2, + rects[i].y2); + } +} + +#ifdef REGION_TEST + +static int slow_region_test(const QRegion *rgn, const QRegion *other_rgn, int query) +{ + pixman_region32_t intersection; + int res; + + pixman_region32_init(&intersection); + pixman_region32_intersect(&intersection, + (pixman_region32_t *)rgn, + (pixman_region32_t *)other_rgn); + + res = 0; + + if (query & REGION_TEST_SHARED && + pixman_region32_not_empty(&intersection)) { + res |= REGION_TEST_SHARED; + } + + if (query & REGION_TEST_LEFT_EXCLUSIVE && + !pixman_region32_equal(&intersection, (pixman_region32_t *)rgn)) { + res |= REGION_TEST_LEFT_EXCLUSIVE; + } + + if (query & REGION_TEST_RIGHT_EXCLUSIVE && + !pixman_region32_equal(&intersection, (pixman_region32_t *)other_rgn)) { + res |= REGION_TEST_RIGHT_EXCLUSIVE; + } + + pixman_region32_fini(&intersection); + + return res; +} + + +static int rect_is_valid(const SpiceRect *r) +{ + if (r->top > r->bottom || r->left > r->right) { + printf("%s: invalid rect\n", __FUNCTION__); + return FALSE; + } + return TRUE; +} + +static void rect_set(SpiceRect *r, int32_t top, int32_t left, int32_t bottom, int32_t right) +{ + r->top = top; + r->left = left; + r->bottom = bottom; + r->right = right; + spice_assert(rect_is_valid(r)); +} + +static void random_region(QRegion *reg) +{ + int i; + int num_rects; + int x, y, w, h; + SpiceRect _r; + SpiceRect *r = &_r; + + region_clear(reg); + + num_rects = rand() % 20; + for (i = 0; i < num_rects; i++) { + x = rand()%100; + y = rand()%100; + w = rand()%100; + h = rand()%100; + rect_set(r, + x, y, + x+w, y+h); + region_add(reg, r); + } +} + +static void test(const QRegion *r1, const QRegion *r2, int *expected) +{ + printf("r1 is_empty %s [%s]\n", + region_is_empty(r1) ? "TRUE" : "FALSE", + (region_is_empty(r1) == *(expected++)) ? "OK" : "ERR"); + printf("r2 is_empty %s [%s]\n", + region_is_empty(r2) ? "TRUE" : "FALSE", + (region_is_empty(r2) == *(expected++)) ? "OK" : "ERR"); + printf("is_equal %s [%s]\n", + region_is_equal(r1, r2) ? "TRUE" : "FALSE", + (region_is_equal(r1, r2) == *(expected++)) ? "OK" : "ERR"); + printf("intersects %s [%s]\n", + region_intersects(r1, r2) ? "TRUE" : "FALSE", + (region_intersects(r1, r2) == *(expected++)) ? "OK" : "ERR"); + printf("contains %s [%s]\n", + region_contains(r1, r2) ? "TRUE" : "FALSE", + (region_contains(r1, r2) == *(expected++)) ? "OK" : "ERR"); +} + +enum { + EXPECT_R1_EMPTY, + EXPECT_R2_EMPTY, + EXPECT_EQUAL, + EXPECT_SECT, + EXPECT_CONT, +}; + +int main(void) +{ + QRegion _r1, _r2, _r3; + QRegion *r1 = &_r1; + QRegion *r2 = &_r2; + QRegion *r3 = &_r3; + SpiceRect _r; + SpiceRect *r = &_r; + int expected[5]; + int i, j; + + region_init(r1); + region_init(r2); + + printf("dump r1 empty rgn [%s]\n", region_is_valid(r1) ? "VALID" : "INVALID"); + region_dump(r1, ""); + expected[EXPECT_R1_EMPTY] = TRUE; + expected[EXPECT_R2_EMPTY] = TRUE; + expected[EXPECT_EQUAL] = TRUE; + expected[EXPECT_SECT] = FALSE; + expected[EXPECT_CONT] = TRUE; + test(r1, r2, expected); + printf("\n"); + + region_clone(r3, r1); + printf("dump r3 clone rgn [%s]\n", region_is_valid(r3) ? "VALID" : "INVALID"); + region_dump(r3, ""); + expected[EXPECT_R1_EMPTY] = TRUE; + expected[EXPECT_R2_EMPTY] = TRUE; + expected[EXPECT_EQUAL] = TRUE; + expected[EXPECT_SECT] = FALSE; + expected[EXPECT_CONT] = TRUE; + test(r1, r3, expected); + region_destroy(r3); + printf("\n"); + + rect_set(r, 0, 0, 100, 100); + region_add(r1, r); + printf("dump r1 [%s]\n", region_is_valid(r1) ? "VALID" : "INVALID"); + region_dump(r1, ""); + expected[EXPECT_R1_EMPTY] = FALSE; + expected[EXPECT_R2_EMPTY] = TRUE; + expected[EXPECT_EQUAL] = FALSE; + expected[EXPECT_SECT] = FALSE; + expected[EXPECT_CONT] = TRUE; + test(r1, r2, expected); + printf("\n"); + + region_clear(r1); + rect_set(r, 0, 0, 0, 0); + region_add(r1, r); + printf("dump r1 [%s]\n", region_is_valid(r1) ? "VALID" : "INVALID"); + region_dump(r1, ""); + expected[EXPECT_R1_EMPTY] = TRUE; + expected[EXPECT_R2_EMPTY] = TRUE; + expected[EXPECT_EQUAL] = TRUE; + expected[EXPECT_SECT] = FALSE; + expected[EXPECT_CONT] = TRUE; + test(r1, r2, expected); + printf("\n"); + + rect_set(r, -100, -100, 0, 0); + region_add(r1, r); + printf("dump r1 [%s]\n", region_is_valid(r1) ? "VALID" : "INVALID"); + region_dump(r1, ""); + expected[EXPECT_R1_EMPTY] = FALSE; + expected[EXPECT_R2_EMPTY] = TRUE; + expected[EXPECT_EQUAL] = FALSE; + expected[EXPECT_SECT] = FALSE; + expected[EXPECT_CONT] = TRUE; + test(r1, r2, expected); + printf("\n"); + + region_clear(r1); + rect_set(r, -100, -100, 100, 100); + region_add(r1, r); + printf("dump r1 [%s]\n", region_is_valid(r1) ? "VALID" : "INVALID"); + region_dump(r1, ""); + expected[EXPECT_R1_EMPTY] = FALSE; + expected[EXPECT_R2_EMPTY] = TRUE; + expected[EXPECT_EQUAL] = FALSE; + expected[EXPECT_SECT] = FALSE; + expected[EXPECT_CONT] = TRUE; + test(r1, r2, expected); + printf("\n"); + + + region_clear(r1); + region_clear(r2); + + rect_set(r, 100, 100, 200, 200); + region_add(r1, r); + printf("dump r1 [%s]\n", region_is_valid(r1) ? "VALID" : "INVALID"); + region_dump(r1, ""); + expected[EXPECT_R1_EMPTY] = FALSE; + expected[EXPECT_R2_EMPTY] = TRUE; + expected[EXPECT_EQUAL] = FALSE; + expected[EXPECT_SECT] = FALSE; + expected[EXPECT_CONT] = TRUE; + test(r1, r2, expected); + printf("\n"); + + rect_set(r, 300, 300, 400, 400); + region_add(r1, r); + printf("dump r1 [%s]\n", region_is_valid(r1) ? "VALID" : "INVALID"); + region_dump(r1, ""); + expected[EXPECT_R1_EMPTY] = FALSE; + expected[EXPECT_R2_EMPTY] = TRUE; + expected[EXPECT_EQUAL] = FALSE; + expected[EXPECT_SECT] = FALSE; + expected[EXPECT_CONT] = TRUE; + test(r1, r2, expected); + printf("\n"); + + rect_set(r, 500, 500, 600, 600); + region_add(r2, r); + printf("dump r2 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); + region_dump(r2, ""); + expected[EXPECT_R1_EMPTY] = FALSE; + expected[EXPECT_R2_EMPTY] = FALSE; + expected[EXPECT_EQUAL] = FALSE; + expected[EXPECT_SECT] = FALSE; + expected[EXPECT_CONT] = FALSE; + test(r1, r2, expected); + printf("\n"); + + region_clear(r2); + + rect_set(r, 100, 100, 200, 200); + region_add(r2, r); + rect_set(r, 300, 300, 400, 400); + region_add(r2, r); + printf("dump r2 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); + region_dump(r2, ""); + expected[EXPECT_R1_EMPTY] = FALSE; + expected[EXPECT_R2_EMPTY] = FALSE; + expected[EXPECT_EQUAL] = TRUE; + expected[EXPECT_SECT] = TRUE; + expected[EXPECT_CONT] = TRUE; + test(r1, r2, expected); + printf("\n"); + + region_clear(r2); + + rect_set(r, 100, 100, 200, 200); + region_add(r2, r); + printf("dump r2 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); + region_dump(r2, ""); + expected[EXPECT_R1_EMPTY] = FALSE; + expected[EXPECT_R2_EMPTY] = FALSE; + expected[EXPECT_EQUAL] = FALSE; + expected[EXPECT_SECT] = TRUE; + expected[EXPECT_CONT] = TRUE; + test(r1, r2, expected); + printf("\n"); + + region_clear(r2); + + rect_set(r, -2000, -2000, -1000, -1000); + region_add(r2, r); + printf("dump r2 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); + region_dump(r2, ""); + expected[EXPECT_R1_EMPTY] = FALSE; + expected[EXPECT_R2_EMPTY] = FALSE; + expected[EXPECT_EQUAL] = FALSE; + expected[EXPECT_SECT] = FALSE; + expected[EXPECT_CONT] = FALSE; + test(r1, r2, expected); + printf("\n"); + + region_clear(r2); + + rect_set(r, -2000, -2000, 1000, 1000); + region_add(r2, r); + printf("dump r2 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); + region_dump(r2, ""); + expected[EXPECT_R1_EMPTY] = FALSE; + expected[EXPECT_R2_EMPTY] = FALSE; + expected[EXPECT_EQUAL] = FALSE; + expected[EXPECT_SECT] = TRUE; + expected[EXPECT_CONT] = FALSE; + test(r1, r2, expected); + printf("\n"); + + region_clear(r2); + + rect_set(r, 150, 150, 175, 175); + region_add(r2, r); + printf("dump r2 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); + region_dump(r2, ""); + expected[EXPECT_R1_EMPTY] = FALSE; + expected[EXPECT_R2_EMPTY] = FALSE; + expected[EXPECT_EQUAL] = FALSE; + expected[EXPECT_SECT] = TRUE; + expected[EXPECT_CONT] = TRUE; + test(r1, r2, expected); + printf("\n"); + + region_clear(r2); + + rect_set(r, 150, 150, 350, 350); + region_add(r2, r); + printf("dump r2 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); + region_dump(r2, ""); + expected[EXPECT_R1_EMPTY] = FALSE; + expected[EXPECT_R2_EMPTY] = FALSE; + expected[EXPECT_EQUAL] = FALSE; + expected[EXPECT_SECT] = TRUE; + expected[EXPECT_CONT] = FALSE; + test(r1, r2, expected); + printf("\n"); + + region_and(r2, r1); + printf("dump r2 and r1 [%s]\n", region_is_valid(r2) ? "VALID" : "INVALID"); + region_dump(r2, ""); + expected[EXPECT_R1_EMPTY] = FALSE; + expected[EXPECT_R2_EMPTY] = FALSE; + expected[EXPECT_EQUAL] = FALSE; + expected[EXPECT_SECT] = TRUE; + expected[EXPECT_CONT] = FALSE; + test(r2, r1, expected); + printf("\n"); + + + region_clone(r3, r1); + printf("dump r3 clone rgn [%s]\n", region_is_valid(r3) ? "VALID" : "INVALID"); + region_dump(r3, ""); + expected[EXPECT_R1_EMPTY] = FALSE; + expected[EXPECT_R2_EMPTY] = FALSE; + expected[EXPECT_EQUAL] = TRUE; + expected[EXPECT_SECT] = TRUE; + expected[EXPECT_CONT] = TRUE; + test(r1, r3, expected); + printf("\n"); + + j = 0; + for (i = 0; i < 1000000; i++) { + int res1, res2, test; + int tests[] = { + REGION_TEST_LEFT_EXCLUSIVE, + REGION_TEST_RIGHT_EXCLUSIVE, + REGION_TEST_SHARED, + REGION_TEST_LEFT_EXCLUSIVE | REGION_TEST_RIGHT_EXCLUSIVE, + REGION_TEST_LEFT_EXCLUSIVE | REGION_TEST_SHARED, + REGION_TEST_RIGHT_EXCLUSIVE | REGION_TEST_SHARED, + REGION_TEST_LEFT_EXCLUSIVE | REGION_TEST_RIGHT_EXCLUSIVE | REGION_TEST_SHARED + }; + + random_region(r1); + random_region(r2); + + for (test = 0; test < 7; test++) { + res1 = region_test(r1, r2, tests[test]); + res2 = slow_region_test(r1, r2, tests[test]); + if (res1 != res2) { + printf ("Error in region_test %d, got %d, expected %d, query=%d\n", + j, res1, res2, tests[test]); + printf ("r1:\n"); + region_dump(r1, ""); + printf ("r2:\n"); + region_dump(r2, ""); + } + j++; + } + } + + region_destroy(r3); + region_destroy(r1); + region_destroy(r2); + + return 0; +} + +#endif diff -Nru spice-gtk-0.9/spice-common/common/region.h spice-gtk-0.12/spice-common/common/region.h --- spice-gtk-0.9/spice-common/common/region.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/region.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,68 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H_REGION +#define _H_REGION + +#include +#include + +#include "draw.h" +#include "pixman_utils.h" + +SPICE_BEGIN_DECLS + +typedef pixman_region32_t QRegion; + +#define REGION_TEST_LEFT_EXCLUSIVE (1 << 0) +#define REGION_TEST_RIGHT_EXCLUSIVE (1 << 1) +#define REGION_TEST_SHARED (1 << 2) +#define REGION_TEST_ALL \ + (REGION_TEST_LEFT_EXCLUSIVE | REGION_TEST_RIGHT_EXCLUSIVE | REGION_TEST_SHARED) + +void region_init(QRegion *rgn); +void region_clear(QRegion *rgn); +void region_destroy(QRegion *rgn); +void region_clone(QRegion *dest, const QRegion *src); +SpiceRect *region_dup_rects(const QRegion *rgn, uint32_t *num_rects); +void region_ret_rects(const QRegion *rgn, SpiceRect *rects, uint32_t num_rects); + +int region_test(const QRegion *rgn, const QRegion *other_rgn, int query); +int region_is_valid(const QRegion *rgn); +int region_is_empty(const QRegion *rgn); +int region_is_equal(const QRegion *rgn1, const QRegion *rgn2); +int region_intersects(const QRegion *rgn1, const QRegion *rgn2); +int region_bounds_intersects(const QRegion *rgn1, const QRegion *rgn2); +int region_contains(const QRegion *rgn, const QRegion *other); +int region_contains_point(const QRegion *rgn, int32_t x, int32_t y); + +void region_or(QRegion *rgn, const QRegion *other_rgn); +void region_and(QRegion *rgn, const QRegion *other_rgn); +void region_xor(QRegion *rgn, const QRegion *other_rgn); +void region_exclude(QRegion *rgn, const QRegion *other_rgn); + +void region_add(QRegion *rgn, const SpiceRect *r); +void region_remove(QRegion *rgn, const SpiceRect *r); + +void region_offset(QRegion *rgn, int32_t dx, int32_t dy); + +void region_dump(const QRegion *rgn, const char *prefix); + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/ring.h spice-gtk-0.12/spice-common/common/ring.h --- spice-gtk-0.9/spice-common/common/ring.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/ring.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,169 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H_RING2 +#define _H_RING2 + +#include +#include "spice_common.h" + +SPICE_BEGIN_DECLS + +typedef struct Ring RingItem; +typedef struct Ring { + RingItem *prev; + RingItem *next; +} Ring; + +static inline void ring_init(Ring *ring) +{ + ring->next = ring->prev = ring; +} + +static inline void ring_item_init(RingItem *item) +{ + item->next = item->prev = NULL; +} + +static inline int ring_item_is_linked(RingItem *item) +{ + return !!item->next; +} + +static inline int ring_is_empty(Ring *ring) +{ + spice_assert(ring->next != NULL && ring->prev != NULL); + return ring == ring->next; +} + +static inline void ring_add(Ring *ring, RingItem *item) +{ + spice_assert(ring->next != NULL && ring->prev != NULL); + spice_assert(item->next == NULL && item->prev == NULL); + + item->next = ring->next; + item->prev = ring; + ring->next = item->next->prev = item; +} + +static inline void ring_add_after(RingItem *item, RingItem *pos) +{ + ring_add(pos, item); +} + +static inline void ring_add_before(RingItem *item, RingItem *pos) +{ + ring_add(pos->prev, item); +} + +static inline void __ring_remove(RingItem *item) +{ + item->next->prev = item->prev; + item->prev->next = item->next; + item->prev = item->next = 0; +} + +static inline void ring_remove(RingItem *item) +{ + spice_assert(item->next != NULL && item->prev != NULL); + spice_assert(item->next != item); + + __ring_remove(item); +} + +static inline RingItem *ring_get_head(Ring *ring) +{ + RingItem *ret; + + spice_assert(ring->next != NULL && ring->prev != NULL); + + if (ring_is_empty(ring)) { + return NULL; + } + ret = ring->next; + return ret; +} + +static inline RingItem *ring_get_tail(Ring *ring) +{ + RingItem *ret; + + spice_assert(ring->next != NULL && ring->prev != NULL); + + if (ring_is_empty(ring)) { + return NULL; + } + ret = ring->prev; + return ret; +} + +static inline RingItem *ring_next(Ring *ring, RingItem *pos) +{ + RingItem *ret; + + spice_assert(ring->next != NULL && ring->prev != NULL); + spice_assert(pos); + spice_assert(pos->next != NULL && pos->prev != NULL); + ret = pos->next; + return (ret == ring) ? NULL : ret; +} + +static inline RingItem *ring_prev(Ring *ring, RingItem *pos) +{ + RingItem *ret; + + spice_assert(ring->next != NULL && ring->prev != NULL); + spice_assert(pos); + spice_assert(pos->next != NULL && pos->prev != NULL); + ret = pos->prev; + return (ret == ring) ? NULL : ret; +} + +#define RING_FOREACH_SAFE(var, next, ring) \ + for ((var) = ring_get_head(ring); \ + (var) && ((next) = ring_next(ring, (var)), 1); \ + (var) = (next)) + + +#define RING_FOREACH(var, ring) \ + for ((var) = ring_get_head(ring); \ + (var); \ + (var) = ring_next(ring, var)) + +#define RING_FOREACH_REVERSED(var, ring) \ + for ((var) = ring_get_tail(ring); \ + (var); \ + (var) = ring_prev(ring, var)) + + +static inline unsigned int ring_get_length(Ring *ring) +{ + RingItem *i; + unsigned int ret = 0; + + for (i = ring_get_head(ring); + i != NULL; + i = ring_next(ring, i)) + ret++; + + return ret; +} + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/rop3.c spice-gtk-0.12/spice-common/common/rop3.c --- spice-gtk-0.9/spice-common/common/rop3.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/rop3.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,650 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#include "rop3.h" +#include "spice_common.h" + +typedef void (*rop3_with_pattern_handler_t)(pixman_image_t *d, pixman_image_t *s, + SpicePoint *src_pos, pixman_image_t *p, + SpicePoint *pat_pos); + +typedef void (*rop3_with_color_handler_t)(pixman_image_t *d, pixman_image_t *s, + SpicePoint *src_pos, uint32_t rgb); + +typedef void (*rop3_test_handler_t)(void); + +#define ROP3_NUM_OPS 256 + +static rop3_with_pattern_handler_t rop3_with_pattern_handlers_32[ROP3_NUM_OPS]; +static rop3_with_pattern_handler_t rop3_with_pattern_handlers_16[ROP3_NUM_OPS]; +static rop3_with_color_handler_t rop3_with_color_handlers_32[ROP3_NUM_OPS]; +static rop3_with_color_handler_t rop3_with_color_handlers_16[ROP3_NUM_OPS]; +static rop3_test_handler_t rop3_test_handlers_32[ROP3_NUM_OPS]; +static rop3_test_handler_t rop3_test_handlers_16[ROP3_NUM_OPS]; + + +static void default_rop3_with_pattern_handler(pixman_image_t *d, pixman_image_t *s, + SpicePoint *src_pos, pixman_image_t *p, + SpicePoint *pat_pos) +{ + spice_critical("not implemented"); +} + +static void default_rop3_withe_color_handler(pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos, + uint32_t rgb) +{ + spice_critical("not implemented"); +} + +static void default_rop3_test_handler(void) +{ +} + +#define ROP3_HANDLERS_DEPTH(name, formula, index, depth) \ +static void rop3_handle_p##depth##_##name(pixman_image_t *d, pixman_image_t *s, \ + SpicePoint *src_pos, \ + pixman_image_t *p, SpicePoint *pat_pos) \ +{ \ + int width = pixman_image_get_width(d); \ + int height = pixman_image_get_height(d); \ + uint8_t *dest_line = (uint8_t *)pixman_image_get_data(d); \ + int dest_stride = pixman_image_get_stride(d); \ + uint8_t *end_line = dest_line + height * dest_stride; \ + \ + int pat_width = pixman_image_get_width(p); \ + int pat_height = pixman_image_get_height(p); \ + uint8_t *pat_base = (uint8_t *)pixman_image_get_data(p); \ + int pat_stride = pixman_image_get_stride(p); \ + int pat_v_offset = pat_pos->y; \ + \ + int src_stride = pixman_image_get_stride(s); \ + uint8_t *src_line; \ + src_line = (uint8_t *)pixman_image_get_data(s) + src_pos->y * src_stride + (src_pos->x * depth / 8); \ + \ + for (; dest_line < end_line; dest_line += dest_stride, src_line += src_stride) { \ + uint##depth##_t *dest = (uint##depth##_t *)dest_line; \ + uint##depth##_t *end = dest + width; \ + uint##depth##_t *src = (uint##depth##_t *)src_line; \ + \ + int pat_h_offset = pat_pos->x; \ + \ + for (; dest < end; dest++, src++) { \ + uint##depth##_t *pat; \ + pat = (uint##depth##_t *) \ + (pat_base + pat_v_offset * pat_stride + (pat_h_offset * depth / 8)); \ + *dest = formula; \ + pat_h_offset = (pat_h_offset + 1) % pat_width; \ + } \ + \ + pat_v_offset = (pat_v_offset + 1) % pat_height; \ + } \ +} \ + \ +static void rop3_handle_c##depth##_##name(pixman_image_t *d, pixman_image_t *s, \ + SpicePoint *src_pos, \ + uint32_t rgb) \ +{ \ + int width = pixman_image_get_width(d); \ + int height = pixman_image_get_height(d); \ + uint8_t *dest_line = (uint8_t *)pixman_image_get_data(d); \ + int dest_stride = pixman_image_get_stride(d); \ + uint8_t *end_line = dest_line + height * dest_stride; \ + uint##depth##_t _pat = rgb; \ + uint##depth##_t *pat = &_pat; \ + \ + int src_stride = pixman_image_get_stride(s); \ + uint8_t *src_line; \ + src_line = (uint8_t *) \ + pixman_image_get_data(s) + src_pos->y * src_stride + (src_pos->x * depth / 8); \ + \ + for (; dest_line < end_line; dest_line += dest_stride, src_line += src_stride) { \ + uint##depth##_t *dest = (uint##depth##_t *)dest_line; \ + uint##depth##_t *end = dest + width; \ + uint##depth##_t *src = (uint##depth##_t *)src_line; \ + for (; dest < end; dest++, src++) { \ + *dest = formula; \ + } \ + } \ +} \ + \ +static void rop3_test##depth##_##name(void) \ +{ \ + uint8_t d = 0xaa; \ + uint8_t s = 0xcc; \ + uint8_t p = 0xf0; \ + uint8_t *pat = &p; \ + uint8_t *src = &s; \ + uint8_t *dest = &d; \ + \ + d = formula; \ + if (d != index) { \ + printf("%s: failed, result is 0x%x expect 0x%x\n", __FUNCTION__, d, index); \ + } \ +} + +#define ROP3_HANDLERS(name, formula, index) \ + ROP3_HANDLERS_DEPTH(name, formula, index, 32) \ + ROP3_HANDLERS_DEPTH(name, formula, index, 16) + +ROP3_HANDLERS(DPSoon, ~(*pat | *src | *dest), 0x01); +ROP3_HANDLERS(DPSona, ~(*pat | *src) & *dest, 0x02); +ROP3_HANDLERS(SDPona, ~(*pat | *dest) & *src, 0x04); +ROP3_HANDLERS(PDSxnon, ~(~(*src ^ *dest) | *pat), 0x06); +ROP3_HANDLERS(PDSaon, ~((*src & *dest) | *pat), 0x07); +ROP3_HANDLERS(SDPnaa, ~*pat & *dest & *src, 0x08); +ROP3_HANDLERS(PDSxon, ~((*src ^ *dest) | *pat), 0x09); +ROP3_HANDLERS(PSDnaon, ~((~*dest & *src) | *pat), 0x0b); +ROP3_HANDLERS(PDSnaon, ~((~*src & *dest) | *pat), 0x0d); +ROP3_HANDLERS(PDSonon, ~(~(*src | *dest) | *pat), 0x0e); +ROP3_HANDLERS(PDSona, ~(*src | *dest) & *pat, 0x10); +ROP3_HANDLERS(SDPxnon, ~(~(*pat ^ *dest) | *src), 0x12); +ROP3_HANDLERS(SDPaon, ~((*pat & *dest) | *src), 0x13); +ROP3_HANDLERS(DPSxnon, ~(~(*pat ^ *src) | *dest), 0x14); +ROP3_HANDLERS(DPSaon, ~((*pat & *src) | *dest), 0x15); +ROP3_HANDLERS(PSDPSanaxx, (~(*pat & *src) & *dest) ^ *src ^ *pat, 0x16); +ROP3_HANDLERS(SSPxDSxaxn, ~(((*src ^ *dest) & (*src ^ *pat)) ^ *src), 0x17); +ROP3_HANDLERS(SPxPDxa, (*src ^ *pat) & (*pat ^ *dest), 0x18); +ROP3_HANDLERS(SDPSanaxn, ~((~(*pat & *src) & *dest) ^ *src), 0x19); +ROP3_HANDLERS(PDSPaox, ((*pat & *src) | *dest) ^ *pat, 0x1a); +ROP3_HANDLERS(SDPSxaxn, ~(((*pat ^ *src) & *dest) ^ *src), 0x1b); +ROP3_HANDLERS(PSDPaox, ((*pat & *dest) | *src) ^ *pat, 0x1c); +ROP3_HANDLERS(DSPDxaxn, ~(((*pat ^ *dest) & *src) ^ *dest), 0x1d); +ROP3_HANDLERS(PDSox, (*dest | *src) ^ *pat, 0x1e); +ROP3_HANDLERS(PDSoan, ~((*src | *dest) & *pat), 0x1f); +ROP3_HANDLERS(DPSnaa, ~*src & *pat & *dest, 0x20); +ROP3_HANDLERS(SDPxon, ~((*pat ^ *dest) | *src), 0x21); +ROP3_HANDLERS(SPDnaon, ~((~*dest & *pat) | *src), 0x23); +ROP3_HANDLERS(SPxDSxa, (*src ^ *pat) & (*dest ^ *src), 0x24); +ROP3_HANDLERS(PDSPanaxn, ~((~(*src & *pat) & *dest) ^ *pat), 0x25); +ROP3_HANDLERS(SDPSaox, ((*src & *pat) | *dest) ^ *src, 0x26); +ROP3_HANDLERS(SDPSxnox, (~(*src ^ *pat) | *dest) ^ *src, 0x27); +ROP3_HANDLERS(DPSxa, (*pat ^ *src) & *dest, 0x28); +ROP3_HANDLERS(PSDPSaoxxn, ~(((*src & *pat) | *dest) ^ *src ^ *pat), 0x29); +ROP3_HANDLERS(DPSana, ~(*src & *pat) & *dest, 0x2a); +ROP3_HANDLERS(SSPxPDxaxn, ~(((*pat ^ *dest) & (*src ^ *pat)) ^ *src), 0x2b); +ROP3_HANDLERS(SPDSoax, ((*src | *dest) & *pat) ^ *src, 0x2c); +ROP3_HANDLERS(PSDnox, (~*dest | *src) ^ *pat, 0x2d); +ROP3_HANDLERS(PSDPxox, ((*pat ^ *dest) | *src) ^ *pat, 0x2e); +ROP3_HANDLERS(PSDnoan, ~((~*dest | *src) & *pat), 0x2f); +ROP3_HANDLERS(SDPnaon, ~((~*pat & *dest) | *src), 0x31); +ROP3_HANDLERS(SDPSoox, (*src | *pat | *dest) ^ *src, 0x32); +ROP3_HANDLERS(SPDSaox, ((*src & *dest) | *pat) ^ *src, 0x34); +ROP3_HANDLERS(SPDSxnox, (~(*src ^ *dest) | *pat) ^ *src, 0x35); +ROP3_HANDLERS(SDPox, (*pat | *dest) ^ *src, 0x36); +ROP3_HANDLERS(SDPoan, ~((*pat | *dest) & *src), 0x37); +ROP3_HANDLERS(PSDPoax, ((*pat | *dest) & *src) ^ *pat, 0x38); +ROP3_HANDLERS(SPDnox, (~*dest | *pat) ^ *src, 0x39); +ROP3_HANDLERS(SPDSxox, ((*src ^ *dest) | *pat) ^ *src, 0x3a); +ROP3_HANDLERS(SPDnoan, ~((~*dest | *pat) & *src), 0x3b); +ROP3_HANDLERS(SPDSonox, (~(*src | *dest) | *pat) ^ *src, 0x3d); +ROP3_HANDLERS(SPDSnaox, ((~*src & *dest) | *pat) ^ *src, 0x3e); +ROP3_HANDLERS(PSDnaa, ~*dest & *src & *pat, 0x40); +ROP3_HANDLERS(DPSxon, ~((*src ^ *pat) | *dest), 0x41); +ROP3_HANDLERS(SDxPDxa, (*src ^ *dest) & (*pat ^ *dest), 0x42); +ROP3_HANDLERS(SPDSanaxn, ~((~(*src & *dest) & *pat) ^ *src), 0x43); +ROP3_HANDLERS(DPSnaon, ~((~*src & *pat) | *dest), 0x45); +ROP3_HANDLERS(DSPDaox, ((*dest & *pat) | *src) ^ *dest, 0x46); +ROP3_HANDLERS(PSDPxaxn, ~(((*pat ^ *dest) & *src) ^ *pat), 0x47); +ROP3_HANDLERS(SDPxa, (*pat ^ *dest) & *src, 0x48); +ROP3_HANDLERS(PDSPDaoxxn, ~(((*dest & *pat) | *src) ^ *dest ^ *pat), 0x49); +ROP3_HANDLERS(DPSDoax, ((*dest | *src) & *pat) ^ *dest, 0x4a); +ROP3_HANDLERS(PDSnox, (~*src | *dest) ^ *pat, 0x4b); +ROP3_HANDLERS(SDPana, ~(*pat & *dest) & *src, 0x4c); +ROP3_HANDLERS(SSPxDSxoxn, ~(((*src ^ *dest) | (*src ^ *pat)) ^ *src), 0x4d); +ROP3_HANDLERS(PDSPxox, ((*pat ^ *src) | *dest) ^ *pat, 0x4e); +ROP3_HANDLERS(PDSnoan, ~((~*src | *dest) & *pat), 0x4f); +ROP3_HANDLERS(DSPnaon, ~((~*pat & *src) | *dest), 0x51); +ROP3_HANDLERS(DPSDaox, ((*dest & *src) | *pat) ^ *dest, 0x52); +ROP3_HANDLERS(SPDSxaxn, ~(((*src ^ *dest) & *pat) ^ *src), 0x53); +ROP3_HANDLERS(DPSonon, ~(~(*src | *pat) | *dest), 0x54); +ROP3_HANDLERS(DPSox, (*src | *pat) ^ *dest, 0x56); +ROP3_HANDLERS(DPSoan, ~((*src | *pat) & *dest), 0x57); +ROP3_HANDLERS(PDSPoax, ((*pat | *src) & *dest) ^ *pat, 0x58); +ROP3_HANDLERS(DPSnox, (~*src | *pat) ^ *dest, 0x59); +ROP3_HANDLERS(DPSDonox, (~(*dest | *src) | *pat) ^ *dest, 0x5b); +ROP3_HANDLERS(DPSDxox, ((*dest ^ *src) | *pat) ^ *dest, 0x5c); +ROP3_HANDLERS(DPSnoan, ~((~*src | *pat) & *dest), 0x5d); +ROP3_HANDLERS(DPSDnaox, ((~*dest & *src) | *pat) ^ *dest, 0x5e); +ROP3_HANDLERS(PDSxa, (*src ^ *dest) & *pat, 0x60); +ROP3_HANDLERS(DSPDSaoxxn, ~(((*src & *dest) | *pat) ^ *src ^ *dest), 0x61); +ROP3_HANDLERS(DSPDoax, ((*dest | *pat) & *src) ^ *dest, 0x62); +ROP3_HANDLERS(SDPnox, (~*pat | *dest) ^ *src, 0x63); +ROP3_HANDLERS(SDPSoax, ((*src | *pat) & *dest) ^ *src, 0x64); +ROP3_HANDLERS(DSPnox, (~*pat | *src) ^ *dest, 0x65); +ROP3_HANDLERS(SDPSonox, (~(*src | *pat) | *dest) ^ *src, 0x67); +ROP3_HANDLERS(DSPDSonoxxn, ~((~(*src | *dest) | *pat) ^ *src ^ *dest), 0x68); +ROP3_HANDLERS(PDSxxn, ~(*src ^ *dest ^ *pat), 0x69); +ROP3_HANDLERS(DPSax, (*src & *pat) ^ *dest, 0x6a); +ROP3_HANDLERS(PSDPSoaxxn, ~(((*src | *pat) & *dest) ^ *src ^ *pat), 0x6b); +ROP3_HANDLERS(SDPax, (*pat & *dest) ^ *src, 0x6c); +ROP3_HANDLERS(PDSPDoaxxn, ~(((*dest | *pat) & *src) ^ *dest ^ *pat), 0x6d); +ROP3_HANDLERS(SDPSnoax, ((~*src | *pat) & *dest) ^ *src, 0x6e); +ROP3_HANDLERS(PDSxnan, ~(~(*src ^ *dest) & *pat), 0x6f); +ROP3_HANDLERS(PDSana, ~(*src & *dest) & *pat, 0x70); +ROP3_HANDLERS(SSDxPDxaxn, ~(((*dest ^ *pat) & (*src ^ *dest)) ^ *src), 0x71); +ROP3_HANDLERS(SDPSxox, ((*src ^ *pat) | *dest) ^ *src, 0x72); +ROP3_HANDLERS(SDPnoan, ~((~*pat | *dest) & *src), 0x73); +ROP3_HANDLERS(DSPDxox, ((*dest ^ *pat) | *src) ^ *dest, 0x74); +ROP3_HANDLERS(DSPnoan, ~((~*pat | *src) & *dest), 0x75); +ROP3_HANDLERS(SDPSnaox, ((~*src & *pat) | *dest) ^ *src, 0x76); +ROP3_HANDLERS(PDSax, (*src & *dest) ^ *pat, 0x78); +ROP3_HANDLERS(DSPDSoaxxn, ~(((*src | *dest) & *pat) ^ *src ^ *dest), 0x79); +ROP3_HANDLERS(DPSDnoax, ((~*dest | *src) & *pat) ^ *dest, 0x7a); +ROP3_HANDLERS(SDPxnan, ~(~(*pat ^ *dest) & *src), 0x7b); +ROP3_HANDLERS(SPDSnoax, ((~*src | *dest) & *pat) ^ *src, 0x7c); +ROP3_HANDLERS(DPSxnan, ~(~(*src ^ *pat) & *dest), 0x7d); +ROP3_HANDLERS(SPxDSxo, (*src ^ *dest) | (*pat ^ *src), 0x7e); +ROP3_HANDLERS(DPSaan, ~(*src & *pat & *dest), 0x7f); +ROP3_HANDLERS(DPSaa, *src & *pat & *dest, 0x80); +ROP3_HANDLERS(SPxDSxon, ~((*src ^ *dest) | (*pat ^ *src)), 0x81); +ROP3_HANDLERS(DPSxna, ~(*src ^ *pat) & *dest, 0x82); +ROP3_HANDLERS(SPDSnoaxn, ~(((~*src | *dest) & *pat) ^ *src), 0x83); +ROP3_HANDLERS(SDPxna, ~(*pat ^ *dest) & *src, 0x84); +ROP3_HANDLERS(PDSPnoaxn, ~(((~*pat | *src) & *dest) ^ *pat), 0x85); +ROP3_HANDLERS(DSPDSoaxx, ((*src | *dest) & *pat) ^ *src ^ *dest, 0x86); +ROP3_HANDLERS(PDSaxn, ~((*src & *dest) ^ *pat), 0x87); +ROP3_HANDLERS(SDPSnaoxn, ~(((~*src & *pat) | *dest) ^ *src), 0x89); +ROP3_HANDLERS(DSPnoa, (~*pat | *src) & *dest, 0x8a); +ROP3_HANDLERS(DSPDxoxn, ~(((*dest ^ *pat) | *src) ^ *dest), 0x8b); +ROP3_HANDLERS(SDPnoa, (~*pat | *dest) & *src, 0x8c); +ROP3_HANDLERS(SDPSxoxn, ~(((*src ^ *pat) | *dest) ^ *src), 0x8d); +ROP3_HANDLERS(SSDxPDxax, ((*dest ^ *pat) & (*dest ^ *src)) ^ *src, 0x8e); +ROP3_HANDLERS(PDSanan, ~(~(*src & *dest) & *pat), 0x8f); +ROP3_HANDLERS(PDSxna, ~(*src ^ *dest) & *pat, 0x90); +ROP3_HANDLERS(SDPSnoaxn, ~(((~*src | *pat) & *dest) ^ *src), 0x91); +ROP3_HANDLERS(DPSDPoaxx, ((*pat | *dest) & *src) ^ *pat ^ *dest, 0x92); +ROP3_HANDLERS(SPDaxn, ~((*dest & *pat) ^ *src), 0x93); +ROP3_HANDLERS(PSDPSoaxx, ((*src | *pat) & *dest) ^ *src ^ *pat, 0x94); +ROP3_HANDLERS(DPSaxn, ~((*src & *pat) ^ *dest), 0x95); +ROP3_HANDLERS(DPSxx, *src ^ *pat ^ *dest, 0x96); +ROP3_HANDLERS(PSDPSonoxx, (~(*src | *pat) | *dest) ^ *src ^ *pat, 0x97); +ROP3_HANDLERS(SDPSonoxn, ~((~(*src | *pat) | *dest) ^ *src), 0x98); +ROP3_HANDLERS(DPSnax, (~*src & *pat) ^ *dest, 0x9a); +ROP3_HANDLERS(SDPSoaxn, ~(((*src | *pat) & *dest) ^ *src), 0x9b); +ROP3_HANDLERS(SPDnax, (~*dest & *pat) ^ *src, 0x9c); +ROP3_HANDLERS(DSPDoaxn, ~(((*dest | *pat) & *src) ^ *dest), 0x9d); +ROP3_HANDLERS(DSPDSaoxx, ((*src & *dest) | *pat) ^ *src ^ *dest, 0x9e); +ROP3_HANDLERS(PDSxan, ~((*src ^ *dest) & *pat), 0x9f); +ROP3_HANDLERS(PDSPnaoxn, ~(((~*pat & *src) | *dest) ^ *pat), 0xa1); +ROP3_HANDLERS(DPSnoa, (~*src | *pat) & *dest, 0xa2); +ROP3_HANDLERS(DPSDxoxn, ~(((*dest ^ *src) | *pat) ^ *dest), 0xa3); +ROP3_HANDLERS(PDSPonoxn, ~((~(*pat | *src) | *dest) ^ *pat), 0xa4); +ROP3_HANDLERS(DSPnax, (~*pat & *src) ^ *dest, 0xa6); +ROP3_HANDLERS(PDSPoaxn, ~(((*pat | *src) & *dest) ^ *pat), 0xa7); +ROP3_HANDLERS(DPSoa, (*src | *pat) & *dest, 0xa8); +ROP3_HANDLERS(DPSoxn, ~((*src | *pat) ^ *dest), 0xa9); +ROP3_HANDLERS(DPSono, ~(*src | *pat) | *dest, 0xab); +ROP3_HANDLERS(SPDSxax, ((*src ^ *dest) & *pat) ^ *src, 0xac); +ROP3_HANDLERS(DPSDaoxn, ~(((*dest & *src) | *pat) ^ *dest), 0xad); +ROP3_HANDLERS(DSPnao, (~*pat & *src) | *dest, 0xae); +ROP3_HANDLERS(PDSnoa, (~*src | *dest) & *pat, 0xb0); +ROP3_HANDLERS(PDSPxoxn, ~(((*pat ^ *src) | *dest) ^ *pat), 0xb1); +ROP3_HANDLERS(SSPxDSxox, ((*src ^ *dest) | (*pat ^ *src)) ^ *src, 0xb2); +ROP3_HANDLERS(SDPanan, ~(~(*pat & *dest) & *src), 0xb3); +ROP3_HANDLERS(PSDnax, (~*dest & *src) ^ *pat, 0xb4); +ROP3_HANDLERS(DPSDoaxn, ~(((*dest | *src) & *pat) ^ *dest), 0xb5); +ROP3_HANDLERS(DPSDPaoxx, ((*pat & *dest) | *src) ^ *pat ^ *dest, 0xb6); +ROP3_HANDLERS(SDPxan, ~((*pat ^ *dest) & *src), 0xb7); +ROP3_HANDLERS(PSDPxax, ((*dest ^ *pat) & *src) ^ *pat, 0xb8); +ROP3_HANDLERS(DSPDaoxn, ~(((*dest & *pat) | *src) ^ *dest), 0xb9); +ROP3_HANDLERS(DPSnao, (~*src & *pat) | *dest, 0xba); +ROP3_HANDLERS(SPDSanax, (~(*src & *dest) & *pat) ^ *src, 0xbc); +ROP3_HANDLERS(SDxPDxan, ~((*dest ^ *pat) & (*dest ^ *src)), 0xbd); +ROP3_HANDLERS(DPSxo, (*src ^ *pat) | *dest, 0xbe); +ROP3_HANDLERS(DPSano, ~(*src & *pat) | *dest, 0xbf); +ROP3_HANDLERS(SPDSnaoxn, ~(((~*src & *dest) | *pat) ^ *src), 0xc1); +ROP3_HANDLERS(SPDSonoxn, ~((~(*src | *dest) | *pat) ^ *src), 0xc2); +ROP3_HANDLERS(SPDnoa, (~*dest | *pat) & *src, 0xc4); +ROP3_HANDLERS(SPDSxoxn, ~(((*src ^ *dest) | *pat) ^ *src), 0xc5); +ROP3_HANDLERS(SDPnax, (~*pat & *dest) ^ *src, 0xc6); +ROP3_HANDLERS(PSDPoaxn, ~(((*pat | *dest) & *src) ^ *pat), 0xc7); +ROP3_HANDLERS(SDPoa, (*pat | *dest) & *src, 0xc8); +ROP3_HANDLERS(SPDoxn, ~((*dest | *pat) ^ *src), 0xc9); +ROP3_HANDLERS(DPSDxax, ((*dest ^ *src) & *pat) ^ *dest, 0xca); +ROP3_HANDLERS(SPDSaoxn, ~(((*src & *dest) | *pat) ^ *src), 0xcb); +ROP3_HANDLERS(SDPono, ~(*pat | *dest) | *src, 0xcd); +ROP3_HANDLERS(SDPnao, (~*pat & *dest) | *src, 0xce); +ROP3_HANDLERS(PSDnoa, (~*dest | *src) & *pat, 0xd0); +ROP3_HANDLERS(PSDPxoxn, ~(((*pat ^ *dest) | *src) ^ *pat), 0xd1); +ROP3_HANDLERS(PDSnax, (~*src & *dest) ^ *pat, 0xd2); +ROP3_HANDLERS(SPDSoaxn, ~(((*src | *dest) & *pat) ^ *src), 0xd3); +ROP3_HANDLERS(SSPxPDxax, ((*dest ^ *pat) & (*pat ^ *src)) ^ *src, 0xd4); +ROP3_HANDLERS(DPSanan, ~(~(*src & *pat) & *dest), 0xd5); +ROP3_HANDLERS(PSDPSaoxx, ((*src & *pat) | *dest) ^ *src ^ *pat, 0xd6); +ROP3_HANDLERS(DPSxan, ~((*src ^ *pat) & *dest), 0xd7); +ROP3_HANDLERS(PDSPxax, ((*pat ^ *src) & *dest) ^ *pat, 0xd8); +ROP3_HANDLERS(SDPSaoxn, ~(((*src & *pat) | *dest) ^ *src), 0xd9); +ROP3_HANDLERS(DPSDanax, (~(*dest & *src) & *pat) ^ *dest, 0xda); +ROP3_HANDLERS(SPxDSxan, ~((*src ^ *dest) & (*pat ^ *src)), 0xdb); +ROP3_HANDLERS(SPDnao, (~*dest & *pat) | *src, 0xdc); +ROP3_HANDLERS(SDPxo, (*pat ^ *dest) | *src, 0xde); +ROP3_HANDLERS(SDPano, ~(*pat & *dest) | *src, 0xdf); +ROP3_HANDLERS(PDSoa, (*src | *dest) & *pat, 0xe0); +ROP3_HANDLERS(PDSoxn, ~((*src | *dest) ^ *pat), 0xe1); +ROP3_HANDLERS(DSPDxax, ((*dest ^ *pat) & *src) ^ *dest, 0xe2); +ROP3_HANDLERS(PSDPaoxn, ~(((*pat & *dest) | *src) ^ *pat), 0xe3); +ROP3_HANDLERS(SDPSxax, ((*src ^ *pat) & *dest) ^ *src, 0xe4); +ROP3_HANDLERS(PDSPaoxn, ~(((*pat & *src) | *dest) ^ *pat), 0xe5); +ROP3_HANDLERS(SDPSanax, (~(*src & *pat) & *dest) ^ *src, 0xe6); +ROP3_HANDLERS(SPxPDxan, ~((*dest ^ *pat) & (*pat ^ *src)), 0xe7); +ROP3_HANDLERS(SSPxDSxax, ((*src ^ *dest) & (*pat ^ *src)) ^ *src, 0xe8); +ROP3_HANDLERS(DSPDSanaxxn, ~((~(*src & *dest) & *pat) ^ *src ^ *dest), 0xe9); +ROP3_HANDLERS(DPSao, (*src & *pat) | *dest, 0xea); +ROP3_HANDLERS(DPSxno, ~(*src ^ *pat) | *dest, 0xeb); +ROP3_HANDLERS(SDPao, (*pat & *dest) | *src, 0xec); +ROP3_HANDLERS(SDPxno, ~(*pat ^ *dest) | *src, 0xed); +ROP3_HANDLERS(SDPnoo, ~*pat | *dest | *src, 0xef); +ROP3_HANDLERS(PDSono, ~(*src | *dest) | *pat, 0xf1); +ROP3_HANDLERS(PDSnao, (~*src & *dest) | *pat, 0xf2); +ROP3_HANDLERS(PSDnao, (~*dest & *src) | *pat, 0xf4); +ROP3_HANDLERS(PDSxo, (*src ^ *dest) | *pat, 0xf6); +ROP3_HANDLERS(PDSano, ~(*src & *dest) | *pat, 0xf7); +ROP3_HANDLERS(PDSao, (*src & *dest) | *pat, 0xf8); +ROP3_HANDLERS(PDSxno, ~(*src ^ *dest) | *pat, 0xf9); +ROP3_HANDLERS(DPSnoo, ~*src | *pat | *dest, 0xfb); +ROP3_HANDLERS(PSDnoo, ~*dest | *src | *pat, 0xfd); +ROP3_HANDLERS(DPSoo, *src | *pat | *dest, 0xfe); + + +#define ROP3_FILL_HANDLERS(op, index) \ + rop3_with_pattern_handlers_32[index] = rop3_handle_p32_##op; \ + rop3_with_pattern_handlers_16[index] = rop3_handle_p16_##op; \ + rop3_with_color_handlers_32[index] = rop3_handle_c32_##op; \ + rop3_with_color_handlers_16[index] = rop3_handle_c16_##op; \ + rop3_test_handlers_32[index] = rop3_test32_##op; \ + rop3_test_handlers_16[index] = rop3_test16_##op; + +void rop3_init(void) +{ + static int need_init = 1; + int i; + + if (!need_init) { + return; + } + need_init = 0; + + for (i = 0; i < ROP3_NUM_OPS; i++) { + rop3_with_pattern_handlers_32[i] = default_rop3_with_pattern_handler; + rop3_with_pattern_handlers_16[i] = default_rop3_with_pattern_handler; + rop3_with_color_handlers_32[i] = default_rop3_withe_color_handler; + rop3_with_color_handlers_16[i] = default_rop3_withe_color_handler; + rop3_test_handlers_32[i] = default_rop3_test_handler; + rop3_test_handlers_16[i] = default_rop3_test_handler; + } + + ROP3_FILL_HANDLERS(DPSoon, 0x01); + ROP3_FILL_HANDLERS(DPSona, 0x02); + ROP3_FILL_HANDLERS(SDPona, 0x04); + ROP3_FILL_HANDLERS(PDSxnon, 0x06); + ROP3_FILL_HANDLERS(PDSaon, 0x07); + ROP3_FILL_HANDLERS(SDPnaa, 0x08); + ROP3_FILL_HANDLERS(PDSxon, 0x09); + ROP3_FILL_HANDLERS(PSDnaon, 0x0b); + ROP3_FILL_HANDLERS(PDSnaon, 0x0d); + ROP3_FILL_HANDLERS(PDSonon, 0x0e); + ROP3_FILL_HANDLERS(PDSona, 0x10); + ROP3_FILL_HANDLERS(SDPxnon, 0x12); + ROP3_FILL_HANDLERS(SDPaon, 0x13); + ROP3_FILL_HANDLERS(DPSxnon, 0x14); + ROP3_FILL_HANDLERS(DPSaon, 0x15); + ROP3_FILL_HANDLERS(PSDPSanaxx, 0x16); + ROP3_FILL_HANDLERS(SSPxDSxaxn, 0x17); + ROP3_FILL_HANDLERS(SPxPDxa, 0x18); + ROP3_FILL_HANDLERS(SDPSanaxn, 0x19); + ROP3_FILL_HANDLERS(PDSPaox, 0x1a); + ROP3_FILL_HANDLERS(SDPSxaxn, 0x1b); + ROP3_FILL_HANDLERS(PSDPaox, 0x1c); + ROP3_FILL_HANDLERS(DSPDxaxn, 0x1d); + ROP3_FILL_HANDLERS(PDSox, 0x1e); + ROP3_FILL_HANDLERS(PDSoan, 0x1f); + ROP3_FILL_HANDLERS(DPSnaa, 0x20); + ROP3_FILL_HANDLERS(SDPxon, 0x21); + ROP3_FILL_HANDLERS(SPDnaon, 0x23); + ROP3_FILL_HANDLERS(SPxDSxa, 0x24); + ROP3_FILL_HANDLERS(PDSPanaxn, 0x25); + ROP3_FILL_HANDLERS(SDPSaox, 0x26); + ROP3_FILL_HANDLERS(SDPSxnox, 0x27); + ROP3_FILL_HANDLERS(DPSxa, 0x28); + ROP3_FILL_HANDLERS(PSDPSaoxxn, 0x29); + ROP3_FILL_HANDLERS(DPSana, 0x2a); + ROP3_FILL_HANDLERS(SSPxPDxaxn, 0x2b); + ROP3_FILL_HANDLERS(SPDSoax, 0x2c); + ROP3_FILL_HANDLERS(PSDnox, 0x2d); + ROP3_FILL_HANDLERS(PSDPxox, 0x2e); + ROP3_FILL_HANDLERS(PSDnoan, 0x2f); + ROP3_FILL_HANDLERS(SDPnaon, 0x31); + ROP3_FILL_HANDLERS(SDPSoox, 0x32); + ROP3_FILL_HANDLERS(SPDSaox, 0x34); + ROP3_FILL_HANDLERS(SPDSxnox, 0x35); + ROP3_FILL_HANDLERS(SDPox, 0x36); + ROP3_FILL_HANDLERS(SDPoan, 0x37); + ROP3_FILL_HANDLERS(PSDPoax, 0x38); + ROP3_FILL_HANDLERS(SPDnox, 0x39); + ROP3_FILL_HANDLERS(SPDSxox, 0x3a); + ROP3_FILL_HANDLERS(SPDnoan, 0x3b); + ROP3_FILL_HANDLERS(SPDSonox, 0x3d); + ROP3_FILL_HANDLERS(SPDSnaox, 0x3e); + ROP3_FILL_HANDLERS(PSDnaa, 0x40); + ROP3_FILL_HANDLERS(DPSxon, 0x41); + ROP3_FILL_HANDLERS(SDxPDxa, 0x42); + ROP3_FILL_HANDLERS(SPDSanaxn, 0x43); + ROP3_FILL_HANDLERS(DPSnaon, 0x45); + ROP3_FILL_HANDLERS(DSPDaox, 0x46); + ROP3_FILL_HANDLERS(PSDPxaxn, 0x47); + ROP3_FILL_HANDLERS(SDPxa, 0x48); + ROP3_FILL_HANDLERS(PDSPDaoxxn, 0x49); + ROP3_FILL_HANDLERS(DPSDoax, 0x4a); + ROP3_FILL_HANDLERS(PDSnox, 0x4b); + ROP3_FILL_HANDLERS(SDPana, 0x4c); + ROP3_FILL_HANDLERS(SSPxDSxoxn, 0x4d); + ROP3_FILL_HANDLERS(PDSPxox, 0x4e); + ROP3_FILL_HANDLERS(PDSnoan, 0x4f); + ROP3_FILL_HANDLERS(DSPnaon, 0x51); + ROP3_FILL_HANDLERS(DPSDaox, 0x52); + ROP3_FILL_HANDLERS(SPDSxaxn, 0x53); + ROP3_FILL_HANDLERS(DPSonon, 0x54); + ROP3_FILL_HANDLERS(DPSox, 0x56); + ROP3_FILL_HANDLERS(DPSoan, 0x57); + ROP3_FILL_HANDLERS(PDSPoax, 0x58); + ROP3_FILL_HANDLERS(DPSnox, 0x59); + ROP3_FILL_HANDLERS(DPSDonox, 0x5b); + ROP3_FILL_HANDLERS(DPSDxox, 0x5c); + ROP3_FILL_HANDLERS(DPSnoan, 0x5d); + ROP3_FILL_HANDLERS(DPSDnaox, 0x5e); + ROP3_FILL_HANDLERS(PDSxa, 0x60); + ROP3_FILL_HANDLERS(DSPDSaoxxn, 0x61); + ROP3_FILL_HANDLERS(DSPDoax, 0x62); + ROP3_FILL_HANDLERS(SDPnox, 0x63); + ROP3_FILL_HANDLERS(SDPSoax, 0x64); + ROP3_FILL_HANDLERS(DSPnox, 0x65); + ROP3_FILL_HANDLERS(SDPSonox, 0x67); + ROP3_FILL_HANDLERS(DSPDSonoxxn, 0x68); + ROP3_FILL_HANDLERS(PDSxxn, 0x69); + ROP3_FILL_HANDLERS(DPSax, 0x6a); + ROP3_FILL_HANDLERS(PSDPSoaxxn, 0x6b); + ROP3_FILL_HANDLERS(SDPax, 0x6c); + ROP3_FILL_HANDLERS(PDSPDoaxxn, 0x6d); + ROP3_FILL_HANDLERS(SDPSnoax, 0x6e); + ROP3_FILL_HANDLERS(PDSxnan, 0x6f); + ROP3_FILL_HANDLERS(PDSana, 0x70); + ROP3_FILL_HANDLERS(SSDxPDxaxn, 0x71); + ROP3_FILL_HANDLERS(SDPSxox, 0x72); + ROP3_FILL_HANDLERS(SDPnoan, 0x73); + ROP3_FILL_HANDLERS(DSPDxox, 0x74); + ROP3_FILL_HANDLERS(DSPnoan, 0x75); + ROP3_FILL_HANDLERS(SDPSnaox, 0x76); + ROP3_FILL_HANDLERS(PDSax, 0x78); + ROP3_FILL_HANDLERS(DSPDSoaxxn, 0x79); + ROP3_FILL_HANDLERS(DPSDnoax, 0x7a); + ROP3_FILL_HANDLERS(SDPxnan, 0x7b); + ROP3_FILL_HANDLERS(SPDSnoax, 0x7c); + ROP3_FILL_HANDLERS(DPSxnan, 0x7d); + ROP3_FILL_HANDLERS(SPxDSxo, 0x7e); + ROP3_FILL_HANDLERS(DPSaan, 0x7f); + ROP3_FILL_HANDLERS(DPSaa, 0x80); + ROP3_FILL_HANDLERS(SPxDSxon, 0x81); + ROP3_FILL_HANDLERS(DPSxna, 0x82); + ROP3_FILL_HANDLERS(SPDSnoaxn, 0x83); + ROP3_FILL_HANDLERS(SDPxna, 0x84); + ROP3_FILL_HANDLERS(PDSPnoaxn, 0x85); + ROP3_FILL_HANDLERS(DSPDSoaxx, 0x86); + ROP3_FILL_HANDLERS(PDSaxn, 0x87); + ROP3_FILL_HANDLERS(SDPSnaoxn, 0x89); + ROP3_FILL_HANDLERS(DSPnoa, 0x8a); + ROP3_FILL_HANDLERS(DSPDxoxn, 0x8b); + ROP3_FILL_HANDLERS(SDPnoa, 0x8c); + ROP3_FILL_HANDLERS(SDPSxoxn, 0x8d); + ROP3_FILL_HANDLERS(SSDxPDxax, 0x8e); + ROP3_FILL_HANDLERS(PDSanan, 0x8f); + ROP3_FILL_HANDLERS(PDSxna, 0x90); + ROP3_FILL_HANDLERS(SDPSnoaxn, 0x91); + ROP3_FILL_HANDLERS(DPSDPoaxx, 0x92); + ROP3_FILL_HANDLERS(SPDaxn, 0x93); + ROP3_FILL_HANDLERS(PSDPSoaxx, 0x94); + ROP3_FILL_HANDLERS(DPSaxn, 0x95); + ROP3_FILL_HANDLERS(DPSxx, 0x96); + ROP3_FILL_HANDLERS(PSDPSonoxx, 0x97); + ROP3_FILL_HANDLERS(SDPSonoxn, 0x98); + ROP3_FILL_HANDLERS(DPSnax, 0x9a); + ROP3_FILL_HANDLERS(SDPSoaxn, 0x9b); + ROP3_FILL_HANDLERS(SPDnax, 0x9c); + ROP3_FILL_HANDLERS(DSPDoaxn, 0x9d); + ROP3_FILL_HANDLERS(DSPDSaoxx, 0x9e); + ROP3_FILL_HANDLERS(PDSxan, 0x9f); + ROP3_FILL_HANDLERS(PDSPnaoxn, 0xa1); + ROP3_FILL_HANDLERS(DPSnoa, 0xa2); + ROP3_FILL_HANDLERS(DPSDxoxn, 0xa3); + ROP3_FILL_HANDLERS(PDSPonoxn, 0xa4); + ROP3_FILL_HANDLERS(DSPnax, 0xa6); + ROP3_FILL_HANDLERS(PDSPoaxn, 0xa7); + ROP3_FILL_HANDLERS(DPSoa, 0xa8); + ROP3_FILL_HANDLERS(DPSoxn, 0xa9); + ROP3_FILL_HANDLERS(DPSono, 0xab); + ROP3_FILL_HANDLERS(SPDSxax, 0xac); + ROP3_FILL_HANDLERS(DPSDaoxn, 0xad); + ROP3_FILL_HANDLERS(DSPnao, 0xae); + ROP3_FILL_HANDLERS(PDSnoa, 0xb0); + ROP3_FILL_HANDLERS(PDSPxoxn, 0xb1); + ROP3_FILL_HANDLERS(SSPxDSxox, 0xb2); + ROP3_FILL_HANDLERS(SDPanan, 0xb3); + ROP3_FILL_HANDLERS(PSDnax, 0xb4); + ROP3_FILL_HANDLERS(DPSDoaxn, 0xb5); + ROP3_FILL_HANDLERS(DPSDPaoxx, 0xb6); + ROP3_FILL_HANDLERS(SDPxan, 0xb7); + ROP3_FILL_HANDLERS(PSDPxax, 0xb8); + ROP3_FILL_HANDLERS(DSPDaoxn, 0xb9); + ROP3_FILL_HANDLERS(DPSnao, 0xba); + ROP3_FILL_HANDLERS(SPDSanax, 0xbc); + ROP3_FILL_HANDLERS(SDxPDxan, 0xbd); + ROP3_FILL_HANDLERS(DPSxo, 0xbe); + ROP3_FILL_HANDLERS(DPSano, 0xbf); + ROP3_FILL_HANDLERS(SPDSnaoxn, 0xc1); + ROP3_FILL_HANDLERS(SPDSonoxn, 0xc2); + ROP3_FILL_HANDLERS(SPDnoa, 0xc4); + ROP3_FILL_HANDLERS(SPDSxoxn, 0xc5); + ROP3_FILL_HANDLERS(SDPnax, 0xc6); + ROP3_FILL_HANDLERS(PSDPoaxn, 0xc7); + ROP3_FILL_HANDLERS(SDPoa, 0xc8); + ROP3_FILL_HANDLERS(SPDoxn, 0xc9); + ROP3_FILL_HANDLERS(DPSDxax, 0xca); + ROP3_FILL_HANDLERS(SPDSaoxn, 0xcb); + ROP3_FILL_HANDLERS(SDPono, 0xcd); + ROP3_FILL_HANDLERS(SDPnao, 0xce); + ROP3_FILL_HANDLERS(PSDnoa, 0xd0); + ROP3_FILL_HANDLERS(PSDPxoxn, 0xd1); + ROP3_FILL_HANDLERS(PDSnax, 0xd2); + ROP3_FILL_HANDLERS(SPDSoaxn, 0xd3); + ROP3_FILL_HANDLERS(SSPxPDxax, 0xd4); + ROP3_FILL_HANDLERS(DPSanan, 0xd5); + ROP3_FILL_HANDLERS(PSDPSaoxx, 0xd6); + ROP3_FILL_HANDLERS(DPSxan, 0xd7); + ROP3_FILL_HANDLERS(PDSPxax, 0xd8); + ROP3_FILL_HANDLERS(SDPSaoxn, 0xd9); + ROP3_FILL_HANDLERS(DPSDanax, 0xda); + ROP3_FILL_HANDLERS(SPxDSxan, 0xdb); + ROP3_FILL_HANDLERS(SPDnao, 0xdc); + ROP3_FILL_HANDLERS(SDPxo, 0xde); + ROP3_FILL_HANDLERS(SDPano, 0xdf); + ROP3_FILL_HANDLERS(PDSoa, 0xe0); + ROP3_FILL_HANDLERS(PDSoxn, 0xe1); + ROP3_FILL_HANDLERS(DSPDxax, 0xe2); + ROP3_FILL_HANDLERS(PSDPaoxn, 0xe3); + ROP3_FILL_HANDLERS(SDPSxax, 0xe4); + ROP3_FILL_HANDLERS(PDSPaoxn, 0xe5); + ROP3_FILL_HANDLERS(SDPSanax, 0xe6); + ROP3_FILL_HANDLERS(SPxPDxan, 0xe7); + ROP3_FILL_HANDLERS(SSPxDSxax, 0xe8); + ROP3_FILL_HANDLERS(DSPDSanaxxn, 0xe9); + ROP3_FILL_HANDLERS(DPSao, 0xea); + ROP3_FILL_HANDLERS(DPSxno, 0xeb); + ROP3_FILL_HANDLERS(SDPao, 0xec); + ROP3_FILL_HANDLERS(SDPxno, 0xed); + ROP3_FILL_HANDLERS(SDPnoo, 0xef); + ROP3_FILL_HANDLERS(PDSono, 0xf1); + ROP3_FILL_HANDLERS(PDSnao, 0xf2); + ROP3_FILL_HANDLERS(PSDnao, 0xf4); + ROP3_FILL_HANDLERS(PDSxo, 0xf6); + ROP3_FILL_HANDLERS(PDSano, 0xf7); + ROP3_FILL_HANDLERS(PDSao, 0xf8); + ROP3_FILL_HANDLERS(PDSxno, 0xf9); + ROP3_FILL_HANDLERS(DPSnoo, 0xfb); + ROP3_FILL_HANDLERS(PSDnoo, 0xfd); + ROP3_FILL_HANDLERS(DPSoo, 0xfe); + + for (i = 0; i < ROP3_NUM_OPS; i++) { + rop3_test_handlers_32[i](); + rop3_test_handlers_16[i](); + } +} + +void do_rop3_with_pattern(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos, + pixman_image_t *p, SpicePoint *pat_pos) +{ + int bpp; + + bpp = spice_pixman_image_get_bpp(d); + spice_assert(bpp == spice_pixman_image_get_bpp(s)); + spice_assert(bpp == spice_pixman_image_get_bpp(p)); + + if (bpp == 32) { + rop3_with_pattern_handlers_32[rop3](d, s, src_pos, p, pat_pos); + } else { + rop3_with_pattern_handlers_16[rop3](d, s, src_pos, p, pat_pos); + } +} + +void do_rop3_with_color(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos, + uint32_t rgb) +{ + int bpp; + + bpp = spice_pixman_image_get_bpp(d); + spice_assert(bpp == spice_pixman_image_get_bpp(s)); + + if (bpp == 32) { + rop3_with_color_handlers_32[rop3](d, s, src_pos, rgb); + } else { + rop3_with_color_handlers_16[rop3](d, s, src_pos, rgb); + } +} diff -Nru spice-gtk-0.9/spice-common/common/rop3.h spice-gtk-0.12/spice-common/common/rop3.h --- spice-gtk-0.9/spice-common/common/rop3.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/rop3.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,39 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H_ROP3 +#define _H_ROP3 + +#include +#include + +#include "draw.h" +#include "pixman_utils.h" + +SPICE_BEGIN_DECLS + +void do_rop3_with_pattern(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos, + pixman_image_t *p, SpicePoint *pat_pos); +void do_rop3_with_color(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos, + uint32_t rgb); + +void rop3_init(void); + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/common/spice_common.h spice-gtk-0.12/spice-common/common/spice_common.h --- spice-gtk-0.9/spice-common/common/spice_common.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/spice_common.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,37 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef H_SPICE_COMMON +#define H_SPICE_COMMON + +#include +#include +#include +#include +#include + +#include +#include "backtrace.h" +#include "log.h" + +#ifdef SPICE_DISABLE_ABORT +#define spice_abort() do { } while(0) +#else +#define spice_abort() abort() +#endif + +#endif diff -Nru spice-gtk-0.9/spice-common/common/ssl_verify.c spice-gtk-0.12/spice-common/common/ssl_verify.c --- spice-gtk-0.9/spice-common/common/ssl_verify.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/ssl_verify.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,503 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2011 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "mem.h" +#include "ssl_verify.h" +#include "log.h" + +#ifndef WIN32 +#include +#include +#include +#endif +#include +#include + +#ifdef WIN32 +static int inet_aton(const char* ip, struct in_addr* in_addr) +{ + unsigned long addr = inet_addr(ip); + + if (addr == INADDR_NONE) { + return 0; + } + in_addr->S_un.S_addr = addr; + return 1; +} +#endif + +static int verify_pubkey(X509* cert, const char *key, size_t key_size) +{ + EVP_PKEY* cert_pubkey = NULL; + EVP_PKEY* orig_pubkey = NULL; + BIO* bio = NULL; + int ret = 0; + + if (!key || key_size == 0) + return 0; + + if (!cert) { + spice_debug("warning: no cert!"); + return 0; + } + + cert_pubkey = X509_get_pubkey(cert); + if (!cert_pubkey) { + spice_debug("warning: reading public key from certificate failed"); + goto finish; + } + + bio = BIO_new_mem_buf((void*)key, key_size); + if (!bio) { + spice_debug("creating BIO failed"); + goto finish; + } + + orig_pubkey = d2i_PUBKEY_bio(bio, NULL); + if (!orig_pubkey) { + spice_debug("reading pubkey from bio failed"); + goto finish; + } + + ret = EVP_PKEY_cmp(orig_pubkey, cert_pubkey); + + if (ret == 1) { + spice_debug("public keys match"); + } else if (ret == 0) { + spice_debug("public keys mismatch"); + } else { + spice_debug("public keys types mismatch"); + } + +finish: + if (bio) + BIO_free(bio); + + if (orig_pubkey) + EVP_PKEY_free(orig_pubkey); + + if (cert_pubkey) + EVP_PKEY_free(cert_pubkey); + + return ret; +} + +/* from gnutls + * compare hostname against certificate, taking account of wildcards + * return 1 on success or 0 on error + * + * note: certnamesize is required as X509 certs can contain embedded NULs in + * the strings such as CN or subjectAltName + */ +static int _gnutls_hostname_compare(const char *certname, + size_t certnamesize, const char *hostname) +{ + /* find the first different character */ + for (; *certname && *hostname && toupper (*certname) == toupper (*hostname); + certname++, hostname++, certnamesize--) + ; + + /* the strings are the same */ + if (certnamesize == 0 && *hostname == '\0') + return 1; + + if (*certname == '*') + { + /* a wildcard certificate */ + + certname++; + certnamesize--; + + while (1) + { + /* Use a recursive call to allow multiple wildcards */ + if (_gnutls_hostname_compare (certname, certnamesize, hostname)) + return 1; + + /* wildcards are only allowed to match a single domain + component or component fragment */ + if (*hostname == '\0' || *hostname == '.') + break; + hostname++; + } + + return 0; + } + + return 0; +} + +/** + * From gnutls and spice red_peer.c + * TODO: switch to gnutls and get rid of this + * + * This function will check if the given certificate's subject matches + * the given hostname. This is a basic implementation of the matching + * described in RFC2818 (HTTPS), which takes into account wildcards, + * and the DNSName/IPAddress subject alternative name PKIX extension. + * + * Returns: 1 for a successful match, and 0 on failure. + **/ +static int verify_hostname(X509* cert, const char *hostname) +{ + GENERAL_NAMES* subject_alt_names; + int found_dns_name = 0; + struct in_addr addr; + int addr_len = 0; + int cn_match = 0; + X509_NAME* subject; + + if (!cert) { + spice_debug("warning: no cert!"); + return 0; + } + + // only IpV4 supported + if (inet_aton(hostname, &addr)) { + addr_len = sizeof(struct in_addr); + } + + /* try matching against: + * 1) a DNS name as an alternative name (subjectAltName) extension + * in the certificate + * 2) the common name (CN) in the certificate + * + * either of these may be of the form: *.domain.tld + * + * only try (2) if there is no subjectAltName extension of + * type dNSName + */ + + /* Check through all included subjectAltName extensions, comparing + * against all those of type dNSName. + */ + subject_alt_names = (GENERAL_NAMES*)X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL); + + if (subject_alt_names) { + int num_alts = sk_GENERAL_NAME_num(subject_alt_names); + int i; + for (i = 0; i < num_alts; i++) { + const GENERAL_NAME* name = sk_GENERAL_NAME_value(subject_alt_names, i); + if (name->type == GEN_DNS) { + found_dns_name = 1; + if (_gnutls_hostname_compare((char *)ASN1_STRING_data(name->d.dNSName), + ASN1_STRING_length(name->d.dNSName), + hostname)) { + spice_debug("alt name match=%s", ASN1_STRING_data(name->d.dNSName)); + GENERAL_NAMES_free(subject_alt_names); + return 1; + } + } else if (name->type == GEN_IPADD) { + int alt_ip_len = ASN1_STRING_length(name->d.iPAddress); + found_dns_name = 1; + if ((addr_len == alt_ip_len)&& + !memcmp(ASN1_STRING_data(name->d.iPAddress), &addr, addr_len)) { + spice_debug("alt name IP match=%s", + inet_ntoa(*((struct in_addr*)ASN1_STRING_data(name->d.dNSName)))); + GENERAL_NAMES_free(subject_alt_names); + return 1; + } + } + } + GENERAL_NAMES_free(subject_alt_names); + } + + if (found_dns_name) { + spice_debug("warning: SubjectAltName mismatch"); + return 0; + } + + /* extracting commonNames */ + subject = X509_get_subject_name(cert); + if (subject) { + int pos = -1; + X509_NAME_ENTRY* cn_entry; + ASN1_STRING* cn_asn1; + + while ((pos = X509_NAME_get_index_by_NID(subject, NID_commonName, pos)) != -1) { + cn_entry = X509_NAME_get_entry(subject, pos); + if (!cn_entry) { + continue; + } + cn_asn1 = X509_NAME_ENTRY_get_data(cn_entry); + if (!cn_asn1) { + continue; + } + + if (_gnutls_hostname_compare((char*)ASN1_STRING_data(cn_asn1), + ASN1_STRING_length(cn_asn1), + hostname)) { + spice_debug("common name match=%s", (char*)ASN1_STRING_data(cn_asn1)); + cn_match = 1; + break; + } + } + } + + if (!cn_match) { + spice_debug("warning: common name mismatch"); + } + + return cn_match; +} + +static X509_NAME* subject_to_x509_name(const char *subject, int *nentries) +{ + X509_NAME* in_subject; + const char *p; + char *key, *val, *k, *v = NULL; + enum { + KEY, + VALUE + } state; + + key = (char*)alloca(strlen(subject)); + val = (char*)alloca(strlen(subject)); + in_subject = X509_NAME_new(); + + if (!in_subject || !key || !val) { + spice_debug("failed to allocate"); + return NULL; + } + + *nentries = 0; + + k = key; + state = KEY; + for (p = subject;; ++p) { + int escape = 0; + if (*p == '\\') { + ++p; + if (*p != '\\' && *p != ',') { + spice_debug("Invalid character after \\"); + goto fail; + } + escape = 1; + } + + switch (state) { + case KEY: + if (*p == ' ' && k == key) { + continue; /* skip spaces before key */ + } if (*p == 0) { + if (k == key) /* empty key, ending */ + goto success; + goto fail; + } else if (*p == ',' && !escape) { + goto fail; /* assignment is missing */ + } else if (*p == '=' && !escape) { + state = VALUE; + *k = 0; + v = val; + } else + *k++ = *p; + break; + case VALUE: + if (*p == 0 || (*p == ',' && !escape)) { + if (v == val) /* empty value */ + goto fail; + + *v = 0; + + if (!X509_NAME_add_entry_by_txt(in_subject, key, + MBSTRING_UTF8, + (const unsigned char*)val, + -1, -1, 0)) { + spice_debug("warning: failed to add entry %s=%s to X509_NAME", + key, val); + goto fail; + } + *nentries += 1; + + if (*p == 0) + goto success; + + state = KEY; + k = key; + } else + *v++ = *p; + break; + } + } + +success: + return in_subject; + +fail: + if (in_subject) + X509_NAME_free(in_subject); + + return NULL; +} + +static int verify_subject(X509* cert, SpiceOpenSSLVerify* verify) +{ + X509_NAME *cert_subject = NULL; + int ret; + int in_entries; + + if (!cert) { + spice_debug("warning: no cert!"); + return 0; + } + + cert_subject = X509_get_subject_name(cert); + if (!cert_subject) { + spice_debug("warning: reading certificate subject failed"); + return 0; + } + + if (!verify->in_subject) { + verify->in_subject = subject_to_x509_name(verify->subject, &in_entries); + if (!verify->in_subject) { + spice_debug("warning: no in_subject!"); + return 0; + } + } + + /* Note: this check is redundant with the pre-condition in X509_NAME_cmp */ + if (X509_NAME_entry_count(cert_subject) != in_entries) { + spice_debug("subject mismatch: #entries cert=%d, input=%d", + X509_NAME_entry_count(cert_subject), in_entries); + return 0; + } + + ret = X509_NAME_cmp(cert_subject, verify->in_subject); + + if (ret == 0) { + spice_debug("subjects match"); + } else { + spice_debug("subjects mismatch"); + + char *p; + p = X509_NAME_oneline(cert_subject, NULL, 0); + spice_debug("cert_subject: %s", p); + free(p); + + p = X509_NAME_oneline(verify->in_subject, NULL, 0); + spice_debug("in_subject: %s", p); + free(p); + } + + return !ret; +} + +static int openssl_verify(int preverify_ok, X509_STORE_CTX *ctx) +{ + int depth, err; + SpiceOpenSSLVerify *v; + SSL *ssl; + X509* cert; + char buf[256]; + + ssl = (SSL*)X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); + v = (SpiceOpenSSLVerify*)SSL_get_app_data(ssl); + + cert = X509_STORE_CTX_get_current_cert(ctx); + X509_NAME_oneline(X509_get_subject_name(cert), buf, 256); + depth = X509_STORE_CTX_get_error_depth(ctx); + err = X509_STORE_CTX_get_error(ctx); + if (depth > 0) { + if (!preverify_ok) { + spice_warning("openssl verify:num=%d:%s:depth=%d:%s", err, + X509_verify_cert_error_string(err), depth, buf); + v->all_preverify_ok = 0; + + /* if certificate verification failed, we can still authorize the server */ + /* if its public key matches the one we hold in the peer_connect_options. */ + if (err == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN && + v->verifyop & SPICE_SSL_VERIFY_OP_PUBKEY) + return 1; + + return 0; + } else + return 1; + } + + /* depth == 0 */ + if (!cert) { + spice_debug("failed to get server certificate"); + return 0; + } + + if (v->verifyop & SPICE_SSL_VERIFY_OP_PUBKEY && + verify_pubkey(cert, v->pubkey, v->pubkey_size)) + return 1; + + if (!v->all_preverify_ok || !preverify_ok) + return 0; + + if (v->verifyop & SPICE_SSL_VERIFY_OP_HOSTNAME && + verify_hostname(cert, v->hostname)) + return 1; + + if (v->verifyop & SPICE_SSL_VERIFY_OP_SUBJECT && + verify_subject(cert, v)) + return 1; + + return 0; +} + +SpiceOpenSSLVerify* spice_openssl_verify_new(SSL *ssl, SPICE_SSL_VERIFY_OP verifyop, + const char *hostname, + const char *pubkey, size_t pubkey_size, + const char *subject) +{ + SpiceOpenSSLVerify *v; + + if (!verifyop) + return NULL; + + v = spice_new0(SpiceOpenSSLVerify, 1); + + v->ssl = ssl; + v->verifyop = verifyop; + v->hostname = spice_strdup(hostname); + v->pubkey = (char*)spice_memdup(pubkey, pubkey_size); + v->pubkey_size = pubkey_size; + v->subject = spice_strdup(subject); + + v->all_preverify_ok = 1; + + SSL_set_app_data(ssl, v); + SSL_set_verify(ssl, + SSL_VERIFY_PEER, openssl_verify); + + return v; +} + +void spice_openssl_verify_free(SpiceOpenSSLVerify* verify) +{ + if (!verify) + return; + + free(verify->pubkey); + free(verify->subject); + free(verify->hostname); + + if (verify->in_subject) + X509_NAME_free(verify->in_subject); + + if (verify->ssl) + SSL_set_app_data(verify->ssl, NULL); + free(verify); +} diff -Nru spice-gtk-0.9/spice-common/common/ssl_verify.h spice-gtk-0.12/spice-common/common/ssl_verify.h --- spice-gtk-0.9/spice-common/common/ssl_verify.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/ssl_verify.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,68 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2011 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef SSL_VERIFY_H +#define SSL_VERIFY_H + +#if defined(WIN32) && !defined(__MINGW32__) +#include +#include +#endif + +#include +#include +#include +#include +#include +#ifdef X509_NAME +/* wincrypt.h has already a different define... */ +#undef X509_NAME +#endif +#include + +#include + +SPICE_BEGIN_DECLS + +typedef enum { + SPICE_SSL_VERIFY_OP_NONE = 0, + SPICE_SSL_VERIFY_OP_PUBKEY = (1 << 0), + SPICE_SSL_VERIFY_OP_HOSTNAME = (1 << 1), + SPICE_SSL_VERIFY_OP_SUBJECT = (1 << 2), +} SPICE_SSL_VERIFY_OP; + +typedef struct { + SSL *ssl; + SPICE_SSL_VERIFY_OP verifyop; + int all_preverify_ok; + char *hostname; + char *pubkey; + size_t pubkey_size; + char *subject; + X509_NAME *in_subject; +} SpiceOpenSSLVerify; + +SpiceOpenSSLVerify* spice_openssl_verify_new(SSL *ssl, SPICE_SSL_VERIFY_OP verifyop, + const char *hostname, + const char *pubkey, size_t pubkey_size, + const char *subject); +void spice_openssl_verify_free(SpiceOpenSSLVerify* verify); + +SPICE_END_DECLS + +#endif // SSL_VERIFY_H diff -Nru spice-gtk-0.9/spice-common/common/sw_canvas.c spice-gtk-0.12/spice-common/common/sw_canvas.c --- spice-gtk-0.9/spice-common/common/sw_canvas.c 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/sw_canvas.c 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,1329 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ +#ifdef HAVE_CONFIG_H +#ifdef __MINGW32__ +#undef HAVE_STDLIB_H +#endif +#include +#endif + +#include +#include "sw_canvas.h" +#define CANVAS_USE_PIXMAN +#define CANVAS_SINGLE_INSTANCE +#include "canvas_base.c" +#include "rect.h" +#include "region.h" +#include "pixman_utils.h" + +typedef struct SwCanvas SwCanvas; + +struct SwCanvas { + CanvasBase base; + uint32_t *private_data; + int private_data_size; + pixman_image_t *image; +}; + +static pixman_image_t *canvas_get_pixman_brush(SwCanvas *canvas, + SpiceBrush *brush) +{ + switch (brush->type) { + case SPICE_BRUSH_TYPE_SOLID: { + uint32_t color = brush->u.color; + pixman_color_t c; + + c.blue = ((color & canvas->base.color_mask) * 0xffff) / canvas->base.color_mask; + color >>= canvas->base.color_shift; + c.green = ((color & canvas->base.color_mask) * 0xffff) / canvas->base.color_mask; + color >>= canvas->base.color_shift; + c.red = ((color & canvas->base.color_mask) * 0xffff) / canvas->base.color_mask; + c.alpha = 0xffff; + + return pixman_image_create_solid_fill(&c); + } + case SPICE_BRUSH_TYPE_PATTERN: { + SwCanvas *surface_canvas; + pixman_image_t* surface; + pixman_transform_t t; + + surface_canvas = (SwCanvas *)canvas_get_surface(&canvas->base, brush->u.pattern.pat); + if (surface_canvas) { + surface = surface_canvas->image; + surface = pixman_image_ref(surface); + } else { + surface = canvas_get_image(&canvas->base, brush->u.pattern.pat, FALSE); + } + pixman_transform_init_translate(&t, + pixman_int_to_fixed(-brush->u.pattern.pos.x), + pixman_int_to_fixed(-brush->u.pattern.pos.y)); + pixman_image_set_transform(surface, &t); + pixman_image_set_repeat(surface, PIXMAN_REPEAT_NORMAL); + return surface; + } + case SPICE_BRUSH_TYPE_NONE: + return NULL; + default: + spice_warn_if_reached(); + return NULL; + } + return NULL; +} + +static pixman_image_t *get_image(SpiceCanvas *canvas) +{ + SwCanvas *sw_canvas = (SwCanvas *)canvas; + + pixman_image_ref(sw_canvas->image); + + return sw_canvas->image; +} + +static void copy_region(SpiceCanvas *spice_canvas, + pixman_region32_t *dest_region, + int dx, int dy) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + pixman_box32_t *dest_rects; + int n_rects; + int i, j, end_line; + + dest_rects = pixman_region32_rectangles(dest_region, &n_rects); + + if (dy > 0) { + if (dx >= 0) { + /* south-east: copy x and y in reverse order */ + for (i = n_rects - 1; i >= 0; i--) { + spice_pixman_copy_rect(canvas->image, + dest_rects[i].x1 - dx, dest_rects[i].y1 - dy, + dest_rects[i].x2 - dest_rects[i].x1, + dest_rects[i].y2 - dest_rects[i].y1, + dest_rects[i].x1, dest_rects[i].y1); + } + } else { + /* south-west: Copy y in reverse order, but x in forward order */ + i = n_rects - 1; + + while (i >= 0) { + /* Copy all rects with same y in forward order */ + for (end_line = i - 1; + end_line >= 0 && dest_rects[end_line].y1 == dest_rects[i].y1; + end_line--) { + } + for (j = end_line + 1; j <= i; j++) { + spice_pixman_copy_rect(canvas->image, + dest_rects[j].x1 - dx, dest_rects[j].y1 - dy, + dest_rects[j].x2 - dest_rects[j].x1, + dest_rects[j].y2 - dest_rects[j].y1, + dest_rects[j].x1, dest_rects[j].y1); + } + i = end_line; + } + } + } else { + if (dx > 0) { + /* north-east: copy y in forward order, but x in reverse order */ + i = 0; + + while (i < n_rects) { + /* Copy all rects with same y in reverse order */ + for (end_line = i; + end_line < n_rects && dest_rects[end_line].y1 == dest_rects[i].y1; + end_line++) { + } + for (j = end_line - 1; j >= i; j--) { + spice_pixman_copy_rect(canvas->image, + dest_rects[j].x1 - dx, dest_rects[j].y1 - dy, + dest_rects[j].x2 - dest_rects[j].x1, + dest_rects[j].y2 - dest_rects[j].y1, + dest_rects[j].x1, dest_rects[j].y1); + } + i = end_line; + } + } else { + /* north-west: Copy x and y in forward order */ + for (i = 0; i < n_rects; i++) { + spice_pixman_copy_rect(canvas->image, + dest_rects[i].x1 - dx, dest_rects[i].y1 - dy, + dest_rects[i].x2 - dest_rects[i].x1, + dest_rects[i].y2 - dest_rects[i].y1, + dest_rects[i].x1, dest_rects[i].y1); + } + } + } +} + +static void fill_solid_spans(SpiceCanvas *spice_canvas, + SpicePoint *points, + int *widths, + int n_spans, + uint32_t color) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + int i; + + for (i = 0; i < n_spans; i++) { + spice_pixman_fill_rect(canvas->image, + points[i].x, points[i].y, + widths[i], + 1, + color); + } +} + +static void fill_solid_rects(SpiceCanvas *spice_canvas, + pixman_box32_t *rects, + int n_rects, + uint32_t color) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + int i; + + for (i = 0; i < n_rects; i++) { + spice_pixman_fill_rect(canvas->image, + rects[i].x1, rects[i].y1, + rects[i].x2 - rects[i].x1, + rects[i].y2 - rects[i].y1, + color); + } +} + +static void fill_solid_rects_rop(SpiceCanvas *spice_canvas, + pixman_box32_t *rects, + int n_rects, + uint32_t color, + SpiceROP rop) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + int i; + + for (i = 0; i < n_rects; i++) { + spice_pixman_fill_rect_rop(canvas->image, + rects[i].x1, rects[i].y1, + rects[i].x2 - rects[i].x1, + rects[i].y2 - rects[i].y1, + color, rop); + } +} + +static void __fill_tiled_rects(SpiceCanvas *spice_canvas, + pixman_box32_t *rects, + int n_rects, + pixman_image_t *tile, + int offset_x, int offset_y) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + int i; + + for (i = 0; i < n_rects; i++) { + spice_pixman_tile_rect(canvas->image, + rects[i].x1, rects[i].y1, + rects[i].x2 - rects[i].x1, + rects[i].y2 - rects[i].y1, + tile, offset_x, offset_y); + } +} + +static void fill_tiled_rects(SpiceCanvas *spice_canvas, + pixman_box32_t *rects, + int n_rects, + pixman_image_t *tile, + int offset_x, int offset_y) +{ + __fill_tiled_rects(spice_canvas, rects, n_rects, tile, offset_x, offset_y); +} + +static void fill_tiled_rects_from_surface(SpiceCanvas *spice_canvas, + pixman_box32_t *rects, + int n_rects, + SpiceCanvas *surface_canvas, + int offset_x, int offset_y) +{ + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __fill_tiled_rects(spice_canvas, rects, n_rects, sw_surface_canvas->image, offset_x, + offset_y); +} + +static void __fill_tiled_rects_rop(SpiceCanvas *spice_canvas, + pixman_box32_t *rects, + int n_rects, + pixman_image_t *tile, + int offset_x, int offset_y, + SpiceROP rop) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + int i; + + for (i = 0; i < n_rects; i++) { + spice_pixman_tile_rect_rop(canvas->image, + rects[i].x1, rects[i].y1, + rects[i].x2 - rects[i].x1, + rects[i].y2 - rects[i].y1, + tile, offset_x, offset_y, + rop); + } +} +static void fill_tiled_rects_rop(SpiceCanvas *spice_canvas, + pixman_box32_t *rects, + int n_rects, + pixman_image_t *tile, + int offset_x, int offset_y, + SpiceROP rop) +{ + __fill_tiled_rects_rop(spice_canvas, rects, n_rects, tile, offset_x, offset_y, rop); +} + +static void fill_tiled_rects_rop_from_surface(SpiceCanvas *spice_canvas, + pixman_box32_t *rects, + int n_rects, + SpiceCanvas *surface_canvas, + int offset_x, int offset_y, + SpiceROP rop) +{ + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __fill_tiled_rects_rop(spice_canvas, rects, n_rects, sw_surface_canvas->image, offset_x, + offset_y, rop); +} + +/* Some pixman implementations of OP_OVER on xRGB32 sets + the high bit to 0xff (which is the right value if the + destination was ARGB32, and it should be ignored for + xRGB32. However, this fills our alpha bits with + data that is not wanted or expected by windows, and its + causing us to send rgba images rather than rgb images to + the client. So, we manually clear these bytes. */ +static void clear_dest_alpha(pixman_image_t *dest, + int x, int y, + int width, int height) +{ + uint32_t *data; + int stride; + int w, h; + + w = pixman_image_get_width(dest); + h = pixman_image_get_height(dest); + + if (x + width <= 0 || x >= w || + y + height <= 0 || y >= h || + width == 0 || height == 0) { + return; + } + + if (x < 0) { + width += x; + x = 0; + } + if (x + width > w) { + width = w - x; + } + + if (y < 0) { + height += y; + y = 0; + } + if (y + height > h) { + height = h - y; + } + + stride = pixman_image_get_stride(dest); + data = (uint32_t *) ( + (uint8_t *)pixman_image_get_data(dest) + y * stride + 4 * x); + + if ((*data & 0xff000000U) == 0xff000000U) { + spice_pixman_fill_rect_rop(dest, + x, y, width, height, + 0x00ffffff, SPICE_ROP_AND); + } +} + +static void __blit_image(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + pixman_image_t *src_image, + int offset_x, int offset_y) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + pixman_box32_t *rects; + int n_rects, i; + + rects = pixman_region32_rectangles(region, &n_rects); + + for (i = 0; i < n_rects; i++) { + int src_x, src_y, dest_x, dest_y, width, height; + + dest_x = rects[i].x1; + dest_y = rects[i].y1; + width = rects[i].x2 - rects[i].x1; + height = rects[i].y2 - rects[i].y1; + + src_x = rects[i].x1 - offset_x; + src_y = rects[i].y1 - offset_y; + + spice_pixman_blit(canvas->image, + src_image, + src_x, src_y, + dest_x, dest_y, + width, height); + } +} + +static void blit_image(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + pixman_image_t *src_image, + int offset_x, int offset_y) +{ + __blit_image(spice_canvas, region, src_image, offset_x, offset_y); +} + +static void blit_image_from_surface(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + SpiceCanvas *surface_canvas, + int offset_x, int offset_y) +{ + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __blit_image(spice_canvas, region, sw_surface_canvas->image, offset_x, offset_y); +} + +static void __blit_image_rop(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + pixman_image_t *src_image, + int offset_x, int offset_y, + SpiceROP rop) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + pixman_box32_t *rects; + int n_rects, i; + + rects = pixman_region32_rectangles(region, &n_rects); + + for (i = 0; i < n_rects; i++) { + int src_x, src_y, dest_x, dest_y, width, height; + + dest_x = rects[i].x1; + dest_y = rects[i].y1; + width = rects[i].x2 - rects[i].x1; + height = rects[i].y2 - rects[i].y1; + + src_x = rects[i].x1 - offset_x; + src_y = rects[i].y1 - offset_y; + + spice_pixman_blit_rop(canvas->image, + src_image, + src_x, src_y, + dest_x, dest_y, + width, height, rop); + } +} + +static void blit_image_rop(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + pixman_image_t *src_image, + int offset_x, int offset_y, + SpiceROP rop) +{ + __blit_image_rop(spice_canvas, region, src_image, offset_x, offset_y, rop); +} + +static void blit_image_rop_from_surface(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + SpiceCanvas *surface_canvas, + int offset_x, int offset_y, + SpiceROP rop) +{ + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __blit_image_rop(spice_canvas, region, sw_surface_canvas->image, offset_x, offset_y, rop); +} + + + +static void __scale_image(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + pixman_image_t *src, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + pixman_transform_t transform; + pixman_fixed_t fsx, fsy; + + fsx = ((pixman_fixed_48_16_t) src_width * 65536) / dest_width; + fsy = ((pixman_fixed_48_16_t) src_height * 65536) / dest_height; + + pixman_image_set_clip_region32(canvas->image, region); + + pixman_transform_init_scale(&transform, fsx, fsy); + pixman_transform_translate(&transform, NULL, + pixman_int_to_fixed (src_x), + pixman_int_to_fixed (src_y)); + + pixman_image_set_transform(src, &transform); + pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE); + spice_return_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE || + scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST); + pixman_image_set_filter(src, + (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ? + PIXMAN_FILTER_NEAREST : PIXMAN_FILTER_GOOD, + NULL, 0); + + pixman_image_composite32(PIXMAN_OP_SRC, + src, NULL, canvas->image, + 0, 0, /* src */ + 0, 0, /* mask */ + dest_x, dest_y, /* dst */ + dest_width, dest_height); + + pixman_transform_init_identity(&transform); + pixman_image_set_transform(src, &transform); + + pixman_image_set_clip_region32(canvas->image, NULL); +} + +static void scale_image(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + pixman_image_t *src, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode) +{ + __scale_image(spice_canvas, region, src, src_x, src_y, src_width, src_height, dest_x, dest_y, + dest_width,dest_height,scale_mode); +} + +static void scale_image_from_surface(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + SpiceCanvas *surface_canvas, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode) +{ + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __scale_image(spice_canvas, region, sw_surface_canvas->image, src_x, src_y, src_width, + src_height, dest_x, dest_y, dest_width,dest_height,scale_mode); +} + +static void __scale_image_rop(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + pixman_image_t *src, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode, SpiceROP rop) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + pixman_transform_t transform; + pixman_image_t *scaled; + pixman_box32_t *rects; + int n_rects, i; + pixman_fixed_t fsx, fsy; + pixman_format_code_t format; + + fsx = ((pixman_fixed_48_16_t) src_width * 65536) / dest_width; + fsy = ((pixman_fixed_48_16_t) src_height * 65536) / dest_height; + + spice_return_if_fail(spice_pixman_image_get_format(src, &format)); + scaled = pixman_image_create_bits(format, + dest_width, + dest_height, + NULL, 0); + + pixman_region32_translate(region, -dest_x, -dest_y); + pixman_image_set_clip_region32(scaled, region); + + pixman_transform_init_scale(&transform, fsx, fsy); + pixman_transform_translate(&transform, NULL, + pixman_int_to_fixed (src_x), + pixman_int_to_fixed (src_y)); + + pixman_image_set_transform(src, &transform); + pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE); + spice_return_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE || + scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST); + pixman_image_set_filter(src, + (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ? + PIXMAN_FILTER_NEAREST : PIXMAN_FILTER_GOOD, + NULL, 0); + + pixman_image_composite32(PIXMAN_OP_SRC, + src, NULL, scaled, + 0, 0, /* src */ + 0, 0, /* mask */ + 0, 0, /* dst */ + dest_width, + dest_height); + + pixman_transform_init_identity(&transform); + pixman_image_set_transform(src, &transform); + + /* Translate back */ + pixman_region32_translate(region, dest_x, dest_y); + + rects = pixman_region32_rectangles(region, &n_rects); + + for (i = 0; i < n_rects; i++) { + spice_pixman_blit_rop(canvas->image, + scaled, + rects[i].x1 - dest_x, + rects[i].y1 - dest_y, + rects[i].x1, rects[i].y1, + rects[i].x2 - rects[i].x1, + rects[i].y2 - rects[i].y1, + rop); + } + + pixman_image_unref(scaled); +} + +static void scale_image_rop(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + pixman_image_t *src, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode, SpiceROP rop) +{ + __scale_image_rop(spice_canvas, region, src, src_x, src_y, src_width, src_height, dest_x, + dest_y, dest_width, dest_height, scale_mode, rop); +} + +static void scale_image_rop_from_surface(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + SpiceCanvas *surface_canvas, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode, SpiceROP rop) +{ + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __scale_image_rop(spice_canvas, region, sw_surface_canvas->image, src_x, src_y, src_width, + src_height, dest_x, dest_y, dest_width, dest_height, scale_mode, rop); +} + +static pixman_image_t *canvas_get_as_surface(SwCanvas *canvas, + int with_alpha) +{ + pixman_image_t *target; + + if (with_alpha && + canvas->base.format == SPICE_SURFACE_FMT_32_xRGB) { + target = pixman_image_create_bits(PIXMAN_a8r8g8b8, + pixman_image_get_width(canvas->image), + pixman_image_get_height(canvas->image), + pixman_image_get_data(canvas->image), + pixman_image_get_stride(canvas->image)); + } else { + target = pixman_image_ref(canvas->image); + } + + return target; +} + +static void __blend_image(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + int dest_has_alpha, + pixman_image_t *src, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height, + int overall_alpha) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + pixman_image_t *mask, *dest; + + dest = canvas_get_as_surface(canvas, dest_has_alpha); + + pixman_image_set_clip_region32(dest, region); + + mask = NULL; + if (overall_alpha != 0xff) { + pixman_color_t color = { 0 }; + color.alpha = overall_alpha * 0x101; + mask = pixman_image_create_solid_fill(&color); + } + + pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE); + + pixman_image_composite32(PIXMAN_OP_OVER, + src, mask, dest, + src_x, src_y, /* src */ + 0, 0, /* mask */ + dest_x, dest_y, /* dst */ + width, + height); + + if (canvas->base.format == SPICE_SURFACE_FMT_32_xRGB && + !dest_has_alpha) { + clear_dest_alpha(dest, dest_x, dest_y, width, height); + } + + if (mask) { + pixman_image_unref(mask); + } + + pixman_image_set_clip_region32(dest, NULL); + pixman_image_unref(dest); +} + +static void blend_image(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + int dest_has_alpha, + pixman_image_t *src, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height, + int overall_alpha) +{ + __blend_image(spice_canvas, region, dest_has_alpha, src, src_x, src_y, + dest_x, dest_y, width, height, + overall_alpha); +} + +static void blend_image_from_surface(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + int dest_has_alpha, + SpiceCanvas *surface_canvas, + int src_has_alpha, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height, + int overall_alpha) +{ + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + pixman_image_t *src; + + src = canvas_get_as_surface(sw_surface_canvas, src_has_alpha); + __blend_image(spice_canvas, region, dest_has_alpha, + src, src_x, src_y, + dest_x, dest_y, + width, height, overall_alpha); + pixman_image_unref(src); +} + +static void __blend_scale_image(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + int dest_has_alpha, + pixman_image_t *src, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode, + int overall_alpha) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + pixman_transform_t transform; + pixman_image_t *mask, *dest; + pixman_fixed_t fsx, fsy; + + fsx = ((pixman_fixed_48_16_t) src_width * 65536) / dest_width; + fsy = ((pixman_fixed_48_16_t) src_height * 65536) / dest_height; + + dest = canvas_get_as_surface(canvas, dest_has_alpha); + + pixman_image_set_clip_region32(dest, region); + + pixman_transform_init_scale(&transform, fsx, fsy); + pixman_transform_translate(&transform, NULL, + pixman_int_to_fixed (src_x), + pixman_int_to_fixed (src_y)); + + mask = NULL; + if (overall_alpha != 0xff) { + pixman_color_t color = { 0 }; + color.alpha = overall_alpha * 0x101; + mask = pixman_image_create_solid_fill(&color); + } + + pixman_image_set_transform(src, &transform); + pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE); + spice_return_if_fail(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE || + scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST); + pixman_image_set_filter(src, + (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ? + PIXMAN_FILTER_NEAREST : PIXMAN_FILTER_GOOD, + NULL, 0); + + pixman_image_composite32(PIXMAN_OP_OVER, + src, mask, dest, + 0, 0, /* src */ + 0, 0, /* mask */ + dest_x, dest_y, /* dst */ + dest_width, dest_height); + + if (canvas->base.format == SPICE_SURFACE_FMT_32_xRGB && + !dest_has_alpha) { + clear_dest_alpha(dest, dest_x, dest_y, dest_width, dest_height); + } + + pixman_transform_init_identity(&transform); + pixman_image_set_transform(src, &transform); + + if (mask) { + pixman_image_unref(mask); + } + + pixman_image_set_clip_region32(dest, NULL); + pixman_image_unref(dest); +} + +static void blend_scale_image(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + int dest_has_alpha, + pixman_image_t *src, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode, + int overall_alpha) +{ + __blend_scale_image(spice_canvas, region, dest_has_alpha, + src, src_x, src_y, src_width, src_height, + dest_x, dest_y, dest_width, dest_height, + scale_mode, overall_alpha); +} + +static void blend_scale_image_from_surface(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + int dest_has_alpha, + SpiceCanvas *surface_canvas, + int src_has_alpha, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + int scale_mode, + int overall_alpha) +{ + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + pixman_image_t *src; + + src = canvas_get_as_surface(sw_surface_canvas, src_has_alpha); + __blend_scale_image(spice_canvas, region, dest_has_alpha, src, src_x, src_y, src_width, + src_height, dest_x, dest_y, dest_width, dest_height, scale_mode, + overall_alpha); + pixman_image_unref(src); +} + +static void __colorkey_image(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + pixman_image_t *src_image, + int offset_x, int offset_y, + uint32_t transparent_color) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + pixman_box32_t *rects; + int n_rects, i; + + rects = pixman_region32_rectangles(region, &n_rects); + + for (i = 0; i < n_rects; i++) { + int src_x, src_y, dest_x, dest_y, width, height; + + dest_x = rects[i].x1; + dest_y = rects[i].y1; + width = rects[i].x2 - rects[i].x1; + height = rects[i].y2 - rects[i].y1; + + src_x = rects[i].x1 - offset_x; + src_y = rects[i].y1 - offset_y; + + spice_pixman_blit_colorkey(canvas->image, + src_image, + src_x, src_y, + dest_x, dest_y, + width, height, + transparent_color); + } +} + +static void colorkey_image(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + pixman_image_t *src_image, + int offset_x, int offset_y, + uint32_t transparent_color) +{ + __colorkey_image(spice_canvas, region, src_image, offset_x, offset_y, transparent_color); +} + +static void colorkey_image_from_surface(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + SpiceCanvas *surface_canvas, + int offset_x, int offset_y, + uint32_t transparent_color) +{ + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __colorkey_image(spice_canvas, region, sw_surface_canvas->image, offset_x, offset_y, + transparent_color); +} + +static void __colorkey_scale_image(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + pixman_image_t *src, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + uint32_t transparent_color) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + pixman_transform_t transform; + pixman_image_t *scaled; + pixman_box32_t *rects; + int n_rects, i; + pixman_fixed_t fsx, fsy; + pixman_format_code_t format; + + fsx = ((pixman_fixed_48_16_t) src_width * 65536) / dest_width; + fsy = ((pixman_fixed_48_16_t) src_height * 65536) / dest_height; + + spice_return_if_fail(spice_pixman_image_get_format(src, &format)); + scaled = pixman_image_create_bits(format, + dest_width, + dest_height, + NULL, 0); + + pixman_region32_translate(region, -dest_x, -dest_y); + pixman_image_set_clip_region32(scaled, region); + + pixman_transform_init_scale(&transform, fsx, fsy); + pixman_transform_translate(&transform, NULL, + pixman_int_to_fixed (src_x), + pixman_int_to_fixed (src_y)); + + pixman_image_set_transform(src, &transform); + pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE); + pixman_image_set_filter(src, + PIXMAN_FILTER_NEAREST, + NULL, 0); + + pixman_image_composite32(PIXMAN_OP_SRC, + src, NULL, scaled, + 0, 0, /* src */ + 0, 0, /* mask */ + 0, 0, /* dst */ + dest_width, + dest_height); + + pixman_transform_init_identity(&transform); + pixman_image_set_transform(src, &transform); + + /* Translate back */ + pixman_region32_translate(region, dest_x, dest_y); + + rects = pixman_region32_rectangles(region, &n_rects); + + for (i = 0; i < n_rects; i++) { + spice_pixman_blit_colorkey(canvas->image, + scaled, + rects[i].x1 - dest_x, + rects[i].y1 - dest_y, + rects[i].x1, rects[i].y1, + rects[i].x2 - rects[i].x1, + rects[i].y2 - rects[i].y1, + transparent_color); + } + + pixman_image_unref(scaled); +} + +static void colorkey_scale_image(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + pixman_image_t *src, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + uint32_t transparent_color) +{ + __colorkey_scale_image(spice_canvas, region, src, src_x, src_y, src_width, src_height, dest_x, + dest_y, dest_width, dest_height, transparent_color); +} + +static void colorkey_scale_image_from_surface(SpiceCanvas *spice_canvas, + pixman_region32_t *region, + SpiceCanvas *surface_canvas, + int src_x, int src_y, + int src_width, int src_height, + int dest_x, int dest_y, + int dest_width, int dest_height, + uint32_t transparent_color) +{ + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __colorkey_scale_image(spice_canvas, region, sw_surface_canvas->image, src_x, src_y, + src_width, src_height, dest_x, dest_y, dest_width, dest_height, + transparent_color); +} + +static void canvas_put_image(SpiceCanvas *spice_canvas, +#ifdef WIN32 + HDC dc, +#endif + const SpiceRect *dest, const uint8_t *src_data, + uint32_t src_width, uint32_t src_height, int src_stride, + const QRegion *clip) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + pixman_image_t *src; + uint32_t dest_width; + uint32_t dest_height; + double sx, sy; + pixman_transform_t transform; + + src = pixman_image_create_bits(PIXMAN_x8r8g8b8, + src_width, + src_height, + (uint32_t*)src_data, + src_stride); + + + if (clip) { + pixman_image_set_clip_region32 (canvas->image, (pixman_region32_t *)clip); + } + + dest_width = dest->right - dest->left; + dest_height = dest->bottom - dest->top; + + if (dest_width != src_width || dest_height != src_height) { + sx = (double)(src_width) / (dest_width); + sy = (double)(src_height) / (dest_height); + + pixman_transform_init_scale(&transform, + pixman_double_to_fixed(sx), + pixman_double_to_fixed(sy)); + pixman_image_set_transform(src, &transform); + pixman_image_set_filter(src, + PIXMAN_FILTER_NEAREST, + NULL, 0); + } + + pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE); + + pixman_image_composite32(PIXMAN_OP_SRC, + src, NULL, canvas->image, + 0, 0, /* src */ + 0, 0, /* mask */ + dest->left, dest->top, /* dst */ + dest_width, dest_height); + + + if (clip) { + pixman_image_set_clip_region32(canvas->image, NULL); + } + pixman_image_unref(src); +} + + +static void canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox, + SpiceClip *clip, SpiceText *text) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + pixman_region32_t dest_region; + pixman_image_t *str_mask, *brush; + SpiceString *str; + SpicePoint pos = { 0, }; + int depth; + + pixman_region32_init_rect(&dest_region, + bbox->left, bbox->top, + bbox->right - bbox->left, + bbox->bottom - bbox->top); + + canvas_clip_pixman(&canvas->base, &dest_region, clip); + + if (!pixman_region32_not_empty(&dest_region)) { + touch_brush(&canvas->base, &text->fore_brush); + touch_brush(&canvas->base, &text->back_brush); + pixman_region32_fini(&dest_region); + return; + } + + if (!rect_is_empty(&text->back_area)) { + pixman_region32_t back_region; + + /* Nothing else makes sense for text and we should deprecate it + * and actually it means OVER really */ + spice_return_if_fail(text->fore_mode == SPICE_ROPD_OP_PUT); + + pixman_region32_init_rect(&back_region, + text->back_area.left, + text->back_area.top, + text->back_area.right - text->back_area.left, + text->back_area.bottom - text->back_area.top); + + pixman_region32_intersect(&back_region, &back_region, &dest_region); + + if (pixman_region32_not_empty(&back_region)) { + draw_brush(spice_canvas, &back_region, &text->back_brush, SPICE_ROP_COPY); + } + + pixman_region32_fini(&back_region); + } + str = (SpiceString *)SPICE_GET_ADDRESS(text->str); + + if (str->flags & SPICE_STRING_FLAGS_RASTER_A1) { + depth = 1; + } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A4) { + depth = 4; + } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A8) { + spice_warning("untested path A8 glyphs"); + depth = 8; + } else { + spice_warning("unsupported path vector glyphs"); + pixman_region32_fini (&dest_region); + return; + } + + brush = canvas_get_pixman_brush(canvas, &text->fore_brush); + + str_mask = canvas_get_str_mask(&canvas->base, str, depth, &pos); + if (brush) { + pixman_image_set_clip_region32(canvas->image, &dest_region); + + pixman_image_composite32(PIXMAN_OP_OVER, + brush, + str_mask, + canvas->image, + 0, 0, + 0, 0, + pos.x, pos.y, + pixman_image_get_width(str_mask), + pixman_image_get_height(str_mask)); + if (canvas->base.format == SPICE_SURFACE_FMT_32_xRGB) { + clear_dest_alpha(canvas->image, pos.x, pos.y, + pixman_image_get_width(str_mask), + pixman_image_get_height(str_mask)); + } + pixman_image_unref(brush); + + pixman_image_set_clip_region32(canvas->image, NULL); + } + pixman_image_unref(str_mask); + pixman_region32_fini(&dest_region); +} + +static void canvas_read_bits(SpiceCanvas *spice_canvas, uint8_t *dest, + int dest_stride, const SpiceRect *area) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + pixman_image_t* surface; + uint8_t *src; + int src_stride; + uint8_t *dest_end; + int bpp; + + spice_return_if_fail(canvas && area); + + surface = canvas->image; + + bpp = spice_pixman_image_get_bpp(surface) / 8; + + src_stride = pixman_image_get_stride(surface); + src = (uint8_t *)pixman_image_get_data(surface) + + area->top * src_stride + area->left * bpp; + dest_end = dest + (area->bottom - area->top) * dest_stride; + for (; dest != dest_end; dest += dest_stride, src += src_stride) { + memcpy(dest, src, (area->right - area->left) * bpp); + } +} + +static void canvas_clear(SpiceCanvas *spice_canvas) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + spice_pixman_fill_rect(canvas->image, + 0, 0, + pixman_image_get_width(canvas->image), + pixman_image_get_height(canvas->image), + 0); +} + +static void canvas_destroy(SpiceCanvas *spice_canvas) +{ + SwCanvas *canvas = (SwCanvas *)spice_canvas; + if (!canvas) { + return; + } + pixman_image_unref(canvas->image); + canvas_base_destroy(&canvas->base); + free(canvas->private_data); + free(canvas); +} + +static int need_init = 1; +static SpiceCanvasOps sw_canvas_ops; + +static SpiceCanvas *canvas_create_common(pixman_image_t *image, + uint32_t format +#ifdef SW_CANVAS_CACHE + , SpiceImageCache *bits_cache + , SpicePaletteCache *palette_cache +#elif defined(SW_CANVAS_IMAGE_CACHE) + , SpiceImageCache *bits_cache +#endif + , SpiceImageSurfaces *surfaces + , SpiceGlzDecoder *glz_decoder + , SpiceJpegDecoder *jpeg_decoder + , SpiceZlibDecoder *zlib_decoder + ) +{ + SwCanvas *canvas; + + if (need_init) { + return NULL; + } + spice_pixman_image_set_format(image, + spice_surface_format_to_pixman (format)); + + canvas = spice_new0(SwCanvas, 1); + canvas_base_init(&canvas->base, &sw_canvas_ops, + pixman_image_get_width (image), + pixman_image_get_height (image), + format +#ifdef SW_CANVAS_CACHE + , bits_cache + , palette_cache +#elif defined(SW_CANVAS_IMAGE_CACHE) + , bits_cache +#endif + , surfaces + , glz_decoder + , jpeg_decoder + , zlib_decoder + ); + canvas->private_data = NULL; + canvas->private_data_size = 0; + + canvas->image = image; + + return (SpiceCanvas *)canvas; +} + +SpiceCanvas *canvas_create(int width, int height, uint32_t format +#ifdef SW_CANVAS_CACHE + , SpiceImageCache *bits_cache + , SpicePaletteCache *palette_cache +#elif defined(SW_CANVAS_IMAGE_CACHE) + , SpiceImageCache *bits_cache +#endif + , SpiceImageSurfaces *surfaces + , SpiceGlzDecoder *glz_decoder + , SpiceJpegDecoder *jpeg_decoder + , SpiceZlibDecoder *zlib_decoder + ) +{ + pixman_image_t *image; + + image = pixman_image_create_bits(spice_surface_format_to_pixman (format), + width, height, NULL, 0); + + return canvas_create_common(image, format +#ifdef SW_CANVAS_CACHE + , bits_cache + , palette_cache +#elif defined(SW_CANVAS_IMAGE_CACHE) + , bits_cache +#endif + , surfaces + , glz_decoder + , jpeg_decoder + , zlib_decoder + ); +} + +SpiceCanvas *canvas_create_for_data(int width, int height, uint32_t format, + uint8_t *data, int stride +#ifdef SW_CANVAS_CACHE + , SpiceImageCache *bits_cache + , SpicePaletteCache *palette_cache +#elif defined(SW_CANVAS_IMAGE_CACHE) + , SpiceImageCache *bits_cache +#endif + , SpiceImageSurfaces *surfaces + , SpiceGlzDecoder *glz_decoder + , SpiceJpegDecoder *jpeg_decoder + , SpiceZlibDecoder *zlib_decoder + ) +{ + pixman_image_t *image; + + image = pixman_image_create_bits(spice_surface_format_to_pixman (format), + width, height, (uint32_t *)data, stride); + + return canvas_create_common(image, format +#ifdef SW_CANVAS_CACHE + , bits_cache + , palette_cache +#elif defined(SW_CANVAS_IMAGE_CACHE) + , bits_cache +#endif + , surfaces + , glz_decoder + , jpeg_decoder + , zlib_decoder + ); +} + +void sw_canvas_init(void) //unsafe global function +{ + if (!need_init) { + return; + } + need_init = 0; + + canvas_base_init_ops(&sw_canvas_ops); + sw_canvas_ops.draw_text = canvas_draw_text; + sw_canvas_ops.put_image = canvas_put_image; + sw_canvas_ops.clear = canvas_clear; + sw_canvas_ops.read_bits = canvas_read_bits; + sw_canvas_ops.destroy = canvas_destroy; + + sw_canvas_ops.fill_solid_spans = fill_solid_spans; + sw_canvas_ops.fill_solid_rects = fill_solid_rects; + sw_canvas_ops.fill_solid_rects_rop = fill_solid_rects_rop; + sw_canvas_ops.fill_tiled_rects = fill_tiled_rects; + sw_canvas_ops.fill_tiled_rects_from_surface = fill_tiled_rects_from_surface; + sw_canvas_ops.fill_tiled_rects_rop = fill_tiled_rects_rop; + sw_canvas_ops.fill_tiled_rects_rop_from_surface = fill_tiled_rects_rop_from_surface; + sw_canvas_ops.blit_image = blit_image; + sw_canvas_ops.blit_image_from_surface = blit_image_from_surface; + sw_canvas_ops.blit_image_rop = blit_image_rop; + sw_canvas_ops.blit_image_rop_from_surface = blit_image_rop_from_surface; + sw_canvas_ops.scale_image = scale_image; + sw_canvas_ops.scale_image_from_surface = scale_image_from_surface; + sw_canvas_ops.scale_image_rop = scale_image_rop; + sw_canvas_ops.scale_image_rop_from_surface = scale_image_rop_from_surface; + sw_canvas_ops.blend_image = blend_image; + sw_canvas_ops.blend_image_from_surface = blend_image_from_surface; + sw_canvas_ops.blend_scale_image = blend_scale_image; + sw_canvas_ops.blend_scale_image_from_surface = blend_scale_image_from_surface; + sw_canvas_ops.colorkey_image = colorkey_image; + sw_canvas_ops.colorkey_image_from_surface = colorkey_image_from_surface; + sw_canvas_ops.colorkey_scale_image = colorkey_scale_image; + sw_canvas_ops.colorkey_scale_image_from_surface = colorkey_scale_image_from_surface; + sw_canvas_ops.copy_region = copy_region; + sw_canvas_ops.get_image = get_image; + rop3_init(); +} diff -Nru spice-gtk-0.9/spice-common/common/sw_canvas.h spice-gtk-0.12/spice-common/common/sw_canvas.h --- spice-gtk-0.9/spice-common/common/sw_canvas.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/common/sw_canvas.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,63 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H__CANVAS +#define _H__CANVAS + +#include +#include + +#include "draw.h" +#include "pixman_utils.h" +#include "canvas_base.h" +#include "region.h" + +SPICE_BEGIN_DECLS + +SpiceCanvas *canvas_create(int width, int height, uint32_t format +#ifdef SW_CANVAS_CACHE + , SpiceImageCache *bits_cache + , SpicePaletteCache *palette_cache +#elif defined(SW_CANVAS_IMAGE_CACHE) + , SpiceImageCache *bits_cache +#endif + , SpiceImageSurfaces *surfaces + , SpiceGlzDecoder *glz_decoder + , SpiceJpegDecoder *jpeg_decoder + , SpiceZlibDecoder *zlib_decoder + ); + +SpiceCanvas *canvas_create_for_data(int width, int height, uint32_t format, uint8_t *data, int stride +#ifdef SW_CANVAS_CACHE + , SpiceImageCache *bits_cache + , SpicePaletteCache *palette_cache +#elif defined(SW_CANVAS_IMAGE_CACHE) + , SpiceImageCache *bits_cache +#endif + , SpiceImageSurfaces *surfaces + , SpiceGlzDecoder *glz_decoder + , SpiceJpegDecoder *jpeg_decoder + , SpiceZlibDecoder *zlib_decoder + ); + + +void sw_canvas_init(void); + +SPICE_END_DECLS + +#endif diff -Nru spice-gtk-0.9/spice-common/config.h.in spice-gtk-0.12/spice-common/config.h.in --- spice-gtk-0.9/spice-common/config.h.in 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/config.h.in 2012-04-24 11:20:54.000000000 +0000 @@ -0,0 +1,217 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Enable GLExt prototypes */ +#undef GL_GLEXT_PROTOTYPES + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `dup2' function. */ +#undef HAVE_DUP2 + +/* Define to 1 if you have the `floor' function. */ +#undef HAVE_FLOOR + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the `inet_ntoa' function. */ +#undef HAVE_INET_NTOA + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the `pow' function. */ +#undef HAVE_POW + +/* Define to 1 if you have the `sqrt' function. */ +#undef HAVE_SQRT + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the header file. */ +#undef HAVE_VFORK_H + +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to build with OpenGL support */ +#undef USE_OPENGL + +/* Define if supporting smartcard proxying */ +#undef USE_SMARTCARD + +/* Version number of package */ +#undef VERSION + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT32_T + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT64_T + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT8_T + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to the type of a signed integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#undef int16_t + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef int32_t + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#undef int64_t + +/* Define to the type of a signed integer type of width exactly 8 bits if such + a type exists and the standard includes do not define it. */ +#undef int8_t + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#undef uint16_t + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef uint32_t + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#undef uint64_t + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +#undef uint8_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork + + +/* argh.. this is evil */ +#if defined(FIXME_SERVER_SMARTCARD) && defined(USE_SMARTCARD) +%:undef USE_SMARTCARD +#endif + diff -Nru spice-gtk-0.9/spice-common/configure spice-gtk-0.12/spice-common/configure --- spice-gtk-0.9/spice-common/configure 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/configure 2012-04-24 11:20:53.000000000 +0000 @@ -0,0 +1,16485 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.68 for spice-common UNKNOWN. +# +# Report bugs to . +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: spice-devel@lists.freedesktop.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + +SHELL=${CONFIG_SHELL-/bin/sh} + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='spice-common' +PACKAGE_TARNAME='spice-common' +PACKAGE_VERSION='UNKNOWN' +PACKAGE_STRING='spice-common UNKNOWN' +PACKAGE_BUGREPORT='spice-devel@lists.freedesktop.org' +PACKAGE_URL='' + +ac_unique_file="common/bitops.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +enable_option_checking=no +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +OS_WIN32_FALSE +OS_WIN32_TRUE +LIBOBJS +ALLOCA +XMKMF +GL_LIBS +GL_CFLAGS +SUPPORT_GL_FALSE +SUPPORT_GL_TRUE +SMARTCARD_LIBS +SMARTCARD_CFLAGS +WITH_SMARTCARD_FALSE +WITH_SMARTCARD_TRUE +PIXMAN_LIBS +PIXMAN_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +PROTOCOL_CFLAGS +subdirs +CPP +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +RANLIB +ac_ct_AR +AR +DLLTOOL +OBJDUMP +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +EGREP +GREP +SED +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +LIBTOOL +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_maintainer_mode +enable_silent_rules +enable_shared +enable_static +with_pic +enable_fast_install +enable_dependency_tracking +with_gnu_ld +with_sysroot +enable_libtool_lock +enable_smartcard +enable_opengl +with_x +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +PIXMAN_CFLAGS +PIXMAN_LIBS +SMARTCARD_CFLAGS +SMARTCARD_LIBS +XMKMF' +ac_subdirs_all='spice-protocol' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures spice-common UNKNOWN to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/spice-common] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +X features: + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of spice-common UNKNOWN:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-silent-rules less verbose build output (undo: `make V=1') + --disable-silent-rules verbose build output (undo: `make V=0') + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-smartcard=[yes/no] + Enable smartcard support [default=yes] + --enable-opengl=[yes/no] + Enable opengl support (not recommended) [default=no] + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). + --with-x use the X Window System + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + PIXMAN_CFLAGS + C compiler flags for PIXMAN, overriding pkg-config + PIXMAN_LIBS linker flags for PIXMAN, overriding pkg-config + SMARTCARD_CFLAGS + C compiler flags for SMARTCARD, overriding pkg-config + SMARTCARD_LIBS + linker flags for SMARTCARD, overriding pkg-config + XMKMF Path to xmkmf, Makefile generator for X Window System + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +spice-common configure UNKNOWN +generated by GNU Autoconf 2.68 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ------------------------------------------------ ## +## Report this to spice-devel@lists.freedesktop.org ## +## ------------------------------------------------ ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_find_intX_t LINENO BITS VAR +# ----------------------------------- +# Finds a signed integer type with width BITS, setting cache variable VAR +# accordingly. +ac_fn_c_find_intX_t () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 +$as_echo_n "checking for int$2_t... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + # Order is important - never check a type that is potentially smaller + # than half of the expected target width. + for ac_type in int$2_t 'int' 'long int' \ + 'long long int' 'short int' 'signed char'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + enum { N = $2 / 2 - 1 }; +int +main () +{ +static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + enum { N = $2 / 2 - 1 }; +int +main () +{ +static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) + < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + case $ac_type in #( + int$2_t) : + eval "$3=yes" ;; #( + *) : + eval "$3=\$ac_type" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no"; then : + +else + break +fi + done +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_find_intX_t + +# ac_fn_c_find_uintX_t LINENO BITS VAR +# ------------------------------------ +# Finds an unsigned integer type with width BITS, setting cache variable VAR +# accordingly. +ac_fn_c_find_uintX_t () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 +$as_echo_n "checking for uint$2_t... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + # Order is important - never check a type that is potentially smaller + # than half of the expected target width. + for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + case $ac_type in #( + uint$2_t) : + eval "$3=yes" ;; #( + *) : + eval "$3=\$ac_type" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no"; then : + +else + break +fi + done +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_find_uintX_t +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by spice-common $as_me UNKNOWN, which was +generated by GNU Autoconf 2.68. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + +ac_config_headers="$ac_config_headers config.h" + +ac_aux_dir= +for ac_dir in build-aux "$srcdir"/build-aux; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + +# Checks for programs +am__api_version='1.11' + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='spice-common' + VERSION='UNKNOWN' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5 +$as_echo_n "checking how to create a ustar tar archive... " >&6; } +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar plaintar pax cpio none' +_am_tools=${am_cv_prog_tar_ustar-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + { echo "$as_me:$LINENO: $_am_tar --version" >&5 + ($_am_tar --version) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && break + done + am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=ustar -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x ustar -w "$$tardir"' + am__tar_='pax -L -x ustar -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H ustar -L' + am__tar_='find "$tardir" -print | cpio -o -H ustar -L' + am__untar='cpio -i -H ustar -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_ustar}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5 + (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + rm -rf conftest.dir + if test -s conftest.tar; then + { echo "$as_me:$LINENO: $am__untar &5 + ($am__untar &5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +if ${am_cv_prog_tar_ustar+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_prog_tar_ustar=$_am_tool +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5 +$as_echo "$am_cv_prog_tar_ustar" >&6; } + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in +yes) AM_DEFAULT_VERBOSITY=0;; +no) AM_DEFAULT_VERBOSITY=1;; +*) AM_DEFAULT_VERBOSITY=0;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4.2' +macro_revision='1.3337' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if ${lt_cv_sys_global_symbol_pipe+:} false; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi + + + + + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if ${lt_cv_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if ${ac_cv_lib_svld_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if ${ac_cv_lib_dld_dld_link+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self_static+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 +$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +if ${ac_cv_prog_cc_c99+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +#include + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str; + int number; + float fnumber; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} + +int +main () +{ + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c99" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c99" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c99" != xno; then : + +fi + + +if test "x$ac_cv_prog_cc_c99" = xno; then + as_fn_error $? "C99 compiler is required." "$LINENO" 5 +fi +if test "x$CC" != xcc; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 +$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 +$as_echo_n "checking whether cc understands -c and -o together... " >&6; } +fi +set dummy $CC; ac_cc=`$as_echo "$2" | + sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +rm -f conftest2.* +if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if { ac_try='cc -c conftest.$ac_ext >&5' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' + rm -f conftest2.* + if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f core conftest* + +fi +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h + +fi + +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi + + + +# Checks for libraries + + +subdirs="$subdirs spice-protocol" + +PROTOCOL_CFLAGS='-I ${top_srcdir}/spice-protocol' + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PIXMAN" >&5 +$as_echo_n "checking for PIXMAN... " >&6; } + +if test -n "$PIXMAN_CFLAGS"; then + pkg_cv_PIXMAN_CFLAGS="$PIXMAN_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pixman-1 >= 0.17.7\""; } >&5 + ($PKG_CONFIG --exists --print-errors "pixman-1 >= 0.17.7") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PIXMAN_CFLAGS=`$PKG_CONFIG --cflags "pixman-1 >= 0.17.7" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PIXMAN_LIBS"; then + pkg_cv_PIXMAN_LIBS="$PIXMAN_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pixman-1 >= 0.17.7\""; } >&5 + ($PKG_CONFIG --exists --print-errors "pixman-1 >= 0.17.7") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PIXMAN_LIBS=`$PKG_CONFIG --libs "pixman-1 >= 0.17.7" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + PIXMAN_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "pixman-1 >= 0.17.7" 2>&1` + else + PIXMAN_PKG_ERRORS=`$PKG_CONFIG --print-errors "pixman-1 >= 0.17.7" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$PIXMAN_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (pixman-1 >= 0.17.7) were not met: + +$PIXMAN_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables PIXMAN_CFLAGS +and PIXMAN_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables PIXMAN_CFLAGS +and PIXMAN_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } + +else + PIXMAN_CFLAGS=$pkg_cv_PIXMAN_CFLAGS + PIXMAN_LIBS=$pkg_cv_PIXMAN_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + +# Check whether --enable-smartcard was given. +if test "${enable_smartcard+set}" = set; then : + enableval=$enable_smartcard; +else + enable_smartcard="yes" +fi + + +if test "x$enable_smartcard" = "xno"; then + if false; then + WITH_SMARTCARD_TRUE= + WITH_SMARTCARD_FALSE='#' +else + WITH_SMARTCARD_TRUE='#' + WITH_SMARTCARD_FALSE= +fi + +else + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SMARTCARD" >&5 +$as_echo_n "checking for SMARTCARD... " >&6; } + +if test -n "$SMARTCARD_CFLAGS"; then + pkg_cv_SMARTCARD_CFLAGS="$SMARTCARD_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcacard >= 0.1.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libcacard >= 0.1.2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SMARTCARD_CFLAGS=`$PKG_CONFIG --cflags "libcacard >= 0.1.2" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SMARTCARD_LIBS"; then + pkg_cv_SMARTCARD_LIBS="$SMARTCARD_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcacard >= 0.1.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libcacard >= 0.1.2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SMARTCARD_LIBS=`$PKG_CONFIG --libs "libcacard >= 0.1.2" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SMARTCARD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libcacard >= 0.1.2" 2>&1` + else + SMARTCARD_PKG_ERRORS=`$PKG_CONFIG --print-errors "libcacard >= 0.1.2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SMARTCARD_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libcacard >= 0.1.2) were not met: + +$SMARTCARD_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables SMARTCARD_CFLAGS +and SMARTCARD_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables SMARTCARD_CFLAGS +and SMARTCARD_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } + +else + SMARTCARD_CFLAGS=$pkg_cv_SMARTCARD_CFLAGS + SMARTCARD_LIBS=$pkg_cv_SMARTCARD_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +$as_echo "#define USE_SMARTCARD 1" >>confdefs.h + + if true; then + WITH_SMARTCARD_TRUE= + WITH_SMARTCARD_FALSE='#' +else + WITH_SMARTCARD_TRUE='#' + WITH_SMARTCARD_FALSE= +fi + +fi + +# Check whether --enable-opengl was given. +if test "${enable_opengl+set}" = set; then : + enableval=$enable_opengl; +else + enable_opengl="no" +fi + + if test "x$enable_opengl" = "xyes"; then + SUPPORT_GL_TRUE= + SUPPORT_GL_FALSE='#' +else + SUPPORT_GL_TRUE='#' + SUPPORT_GL_FALSE= +fi + + +if test "x$enable_opengl" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glBlendFunc in -lGL" >&5 +$as_echo_n "checking for glBlendFunc in -lGL... " >&6; } +if ${ac_cv_lib_GL_glBlendFunc+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lGL $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char glBlendFunc (); +int +main () +{ +return glBlendFunc (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_GL_glBlendFunc=yes +else + ac_cv_lib_GL_glBlendFunc=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GL_glBlendFunc" >&5 +$as_echo "$ac_cv_lib_GL_glBlendFunc" >&6; } +if test "x$ac_cv_lib_GL_glBlendFunc" = xyes; then : + GL_LIBS="$GL_LIBS -lGL" +else + enable_opengl=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gluSphere in -lGLU" >&5 +$as_echo_n "checking for gluSphere in -lGLU... " >&6; } +if ${ac_cv_lib_GLU_gluSphere+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lGLU $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gluSphere (); +int +main () +{ +return gluSphere (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_GLU_gluSphere=yes +else + ac_cv_lib_GLU_gluSphere=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GLU_gluSphere" >&5 +$as_echo "$ac_cv_lib_GLU_gluSphere" >&6; } +if test "x$ac_cv_lib_GLU_gluSphere" = xyes; then : + GL_LIBS="$GL_LIBS -lGLU" +else + enable_opengl=no +fi + + +$as_echo "#define USE_OPENGL 1" >>confdefs.h + + +$as_echo "#define GL_GLEXT_PROTOTYPES /**/" >>confdefs.h + + + if test "x$enable_opengl" = "xno"; then + as_fn_error $? "GL libraries not available" "$LINENO" 5 + fi +fi + + + +# Checks for header files +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 +$as_echo_n "checking for X... " >&6; } + + +# Check whether --with-x was given. +if test "${with_x+set}" = set; then : + withval=$with_x; +fi + +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + case $x_includes,$x_libraries in #( + *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( + *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : + $as_echo_n "(cached) " >&6 +else + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=no ac_x_libraries=no +rm -f -r conftest.dir +if mkdir conftest.dir; then + cd conftest.dir + cat >Imakefile <<'_ACEOF' +incroot: + @echo incroot='${INCROOT}' +usrlibdir: + @echo usrlibdir='${USRLIBDIR}' +libdir: + @echo libdir='${LIBDIR}' +_ACEOF + if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. + for ac_var in incroot usrlibdir libdir; do + eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" + done + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl dylib la dll; do + if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && + test -f "$ac_im_libdir/libX11.$ac_extension"; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case $ac_im_incroot in + /usr/include) ac_x_includes= ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; + esac + case $ac_im_usrlibdir in + /usr/lib | /usr/lib64 | /lib | /lib64) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; + esac + fi + cd .. + rm -f -r conftest.dir +fi + +# Standard set of common directories for X headers. +# Check X11 before X11Rn because it is often a symlink to the current release. +ac_x_header_dirs=' +/usr/X11/include +/usr/X11R7/include +/usr/X11R6/include +/usr/X11R5/include +/usr/X11R4/include + +/usr/include/X11 +/usr/include/X11R7 +/usr/include/X11R6 +/usr/include/X11R5 +/usr/include/X11R4 + +/usr/local/X11/include +/usr/local/X11R7/include +/usr/local/X11R6/include +/usr/local/X11R5/include +/usr/local/X11R4/include + +/usr/local/include/X11 +/usr/local/include/X11R7 +/usr/local/include/X11R6 +/usr/local/include/X11R5 +/usr/local/include/X11R4 + +/usr/X386/include +/usr/x386/include +/usr/XFree86/include/X11 + +/usr/include +/usr/local/include +/usr/unsupported/include +/usr/athena/include +/usr/local/x11r5/include +/usr/lpp/Xamples/include + +/usr/openwin/include +/usr/openwin/share/include' + +if test "$ac_x_includes" = no; then + # Guess where to find include files, by looking for Xlib.h. + # First, try using that file with no special directory specified. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # We can compile using X headers with no special include directory. +ac_x_includes= +else + for ac_dir in $ac_x_header_dirs; do + if test -r "$ac_dir/X11/Xlib.h"; then + ac_x_includes=$ac_dir + break + fi +done +fi +rm -f conftest.err conftest.i conftest.$ac_ext +fi # $ac_x_includes = no + +if test "$ac_x_libraries" = no; then + # Check for the libraries. + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS=$LIBS + LIBS="-lX11 $LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +XrmInitialize () + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + LIBS=$ac_save_LIBS +# We can link X programs with no special library path. +ac_x_libraries= +else + LIBS=$ac_save_LIBS +for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +do + # Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl dylib la dll; do + if test -r "$ac_dir/libX11.$ac_extension"; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi # $ac_x_libraries = no + +case $ac_x_includes,$ac_x_libraries in #( + no,* | *,no | *\'*) + # Didn't find X, or a directory has "'" in its name. + ac_cv_have_x="have_x=no";; #( + *) + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes\ + ac_x_includes='$ac_x_includes'\ + ac_x_libraries='$ac_x_libraries'" +esac +fi +;; #( + *) have_x=yes;; + esac + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 +$as_echo "$have_x" >&6; } + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes\ + ac_x_includes='$x_includes'\ + ac_x_libraries='$x_libraries'" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 +$as_echo "libraries $x_libraries, headers $x_includes" >&6; } +fi + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 +$as_echo_n "checking for working alloca.h... " >&6; } +if ${ac_cv_working_alloca_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_working_alloca_h=yes +else + ac_cv_working_alloca_h=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 +$as_echo "$ac_cv_working_alloca_h" >&6; } +if test $ac_cv_working_alloca_h = yes; then + +$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 +$as_echo_n "checking for alloca... " >&6; } +if ${ac_cv_func_alloca_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include +# define alloca _alloca +# else +# ifdef HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +void *alloca (size_t); +# endif +# endif +# endif +# endif +#endif + +int +main () +{ +char *p = (char *) alloca (1); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_alloca_works=yes +else + ac_cv_func_alloca_works=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +$as_echo "$ac_cv_func_alloca_works" >&6; } + +if test $ac_cv_func_alloca_works = yes; then + +$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext + +$as_echo "#define C_ALLOCA 1" >>confdefs.h + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 +$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } +if ${ac_cv_os_cray+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined CRAY && ! defined CRAY2 +webecray +#else +wenotbecray +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "webecray" >/dev/null 2>&1; then : + ac_cv_os_cray=yes +else + ac_cv_os_cray=no +fi +rm -f conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 +$as_echo "$ac_cv_os_cray" >&6; } +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + +cat >>confdefs.h <<_ACEOF +#define CRAY_STACKSEG_END $ac_func +_ACEOF + + break +fi + + done +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 +$as_echo_n "checking stack direction for C alloca... " >&6; } +if ${ac_cv_c_stack_direction+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_c_stack_direction=0 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} + +int +main () +{ + return find_stack_direction () < 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_stack_direction=1 +else + ac_cv_c_stack_direction=-1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 +$as_echo "$ac_cv_c_stack_direction" >&6; } +cat >>confdefs.h <<_ACEOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +_ACEOF + + +fi + +for ac_header in arpa/inet.h malloc.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/socket.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +# Checks for typedefs, structures, and compiler characteristics +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" +case $ac_cv_c_int16_t in #( + no|yes) ;; #( + *) + +cat >>confdefs.h <<_ACEOF +#define int16_t $ac_cv_c_int16_t +_ACEOF +;; +esac + +ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" +case $ac_cv_c_int32_t in #( + no|yes) ;; #( + *) + +cat >>confdefs.h <<_ACEOF +#define int32_t $ac_cv_c_int32_t +_ACEOF +;; +esac + +ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" +case $ac_cv_c_int64_t in #( + no|yes) ;; #( + *) + +cat >>confdefs.h <<_ACEOF +#define int64_t $ac_cv_c_int64_t +_ACEOF +;; +esac + +ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" +case $ac_cv_c_int8_t in #( + no|yes) ;; #( + *) + +cat >>confdefs.h <<_ACEOF +#define int8_t $ac_cv_c_int8_t +_ACEOF +;; +esac + +ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" +if test "x$ac_cv_type_pid_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + +ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" +case $ac_cv_c_uint16_t in #( + no|yes) ;; #( + *) + + +cat >>confdefs.h <<_ACEOF +#define uint16_t $ac_cv_c_uint16_t +_ACEOF +;; + esac + +ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" +case $ac_cv_c_uint32_t in #( + no|yes) ;; #( + *) + +$as_echo "#define _UINT32_T 1" >>confdefs.h + + +cat >>confdefs.h <<_ACEOF +#define uint32_t $ac_cv_c_uint32_t +_ACEOF +;; + esac + +ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" +case $ac_cv_c_uint64_t in #( + no|yes) ;; #( + *) + +$as_echo "#define _UINT64_T 1" >>confdefs.h + + +cat >>confdefs.h <<_ACEOF +#define uint64_t $ac_cv_c_uint64_t +_ACEOF +;; + esac + +ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" +case $ac_cv_c_uint8_t in #( + no|yes) ;; #( + *) + +$as_echo "#define _UINT8_T 1" >>confdefs.h + + +cat >>confdefs.h <<_ACEOF +#define uint8_t $ac_cv_c_uint8_t +_ACEOF +;; + esac + + +# Checks for library functions +# do not check malloc or realloc, since that cannot be cross-compiled checked +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5 +$as_echo_n "checking for error_at_line... " >&6; } +if ${ac_cv_lib_error_at_line+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +error_at_line (0, 0, "", 0, "an error occurred"); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_error_at_line=yes +else + ac_cv_lib_error_at_line=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5 +$as_echo "$ac_cv_lib_error_at_line" >&6; } +if test $ac_cv_lib_error_at_line = no; then + case " $LIBOBJS " in + *" error.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS error.$ac_objext" + ;; +esac + +fi + +for ac_header in vfork.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" +if test "x$ac_cv_header_vfork_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_VFORK_H 1 +_ACEOF + +fi + +done + +for ac_func in fork vfork +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "x$ac_cv_func_fork" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 +$as_echo_n "checking for working fork... " >&6; } +if ${ac_cv_func_fork_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_fork_works=cross +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* By Ruediger Kuhlmann. */ + return fork () < 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_fork_works=yes +else + ac_cv_func_fork_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 +$as_echo "$ac_cv_func_fork_works" >&6; } + +else + ac_cv_func_fork_works=$ac_cv_func_fork +fi +if test "x$ac_cv_func_fork_works" = xcross; then + case $host in + *-*-amigaos* | *-*-msdosdjgpp*) + # Override, as these systems have only a dummy fork() stub + ac_cv_func_fork_works=no + ;; + *) + ac_cv_func_fork_works=yes + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} +fi +ac_cv_func_vfork_works=$ac_cv_func_vfork +if test "x$ac_cv_func_vfork" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 +$as_echo_n "checking for working vfork... " >&6; } +if ${ac_cv_func_vfork_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_vfork_works=cross +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Thanks to Paul Eggert for this test. */ +$ac_includes_default +#include +#ifdef HAVE_VFORK_H +# include +#endif +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. The compiler + is told about this with #include , but some compilers + (e.g. gcc -O) don't grok . Test for this by using a + static variable whose address is put into a register that is + clobbered by the vfork. */ +static void +#ifdef __cplusplus +sparc_address_test (int arg) +# else +sparc_address_test (arg) int arg; +#endif +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} + +int +main () +{ + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (0); + + child = vfork (); + + if (child == 0) { + /* Here is another test for sparc vfork register problems. This + test uses lots of local variables, at least as many local + variables as main has allocated so far including compiler + temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris + 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should + reuse the register of parent for one of the local variables, + since it will think that parent can't possibly be used any more + in this routine. Assigning to the local variable will thus + munge parent in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); + + /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent + from child file descriptors. If the child closes a descriptor + before it execs or exits, this munges the parent's descriptor + as well. Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + return ( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_vfork_works=yes +else + ac_cv_func_vfork_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 +$as_echo "$ac_cv_func_vfork_works" >&6; } + +fi; +if test "x$ac_cv_func_fork_works" = xcross; then + ac_cv_func_vfork_works=$ac_cv_func_vfork + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} +fi + +if test "x$ac_cv_func_vfork_works" = xyes; then + +$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h + +else + +$as_echo "#define vfork fork" >>confdefs.h + +fi +if test "x$ac_cv_func_fork_works" = xyes; then + +$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h + +fi + +for ac_func in dup2 floor inet_ntoa memmove memset pow sqrt +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +# Others + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for native Win32" >&5 +$as_echo_n "checking for native Win32... " >&6; } +case "$host_os" in + *mingw*|*cygwin*) + os_win32=yes + ;; + *) + os_win32=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $os_win32" >&5 +$as_echo "$os_win32" >&6; } + if test "$os_win32" = "yes"; then + OS_WIN32_TRUE= + OS_WIN32_FALSE='#' +else + OS_WIN32_TRUE='#' + OS_WIN32_FALSE= +fi + + +# The End! +ac_config_files="$ac_config_files Makefile common/Makefile python_modules/Makefile" + + + + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${WITH_SMARTCARD_TRUE}" && test -z "${WITH_SMARTCARD_FALSE}"; then + as_fn_error $? "conditional \"WITH_SMARTCARD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${WITH_SMARTCARD_TRUE}" && test -z "${WITH_SMARTCARD_FALSE}"; then + as_fn_error $? "conditional \"WITH_SMARTCARD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SUPPORT_GL_TRUE}" && test -z "${SUPPORT_GL_FALSE}"; then + as_fn_error $? "conditional \"SUPPORT_GL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${OS_WIN32_TRUE}" && test -z "${OS_WIN32_FALSE}"; then + as_fn_error $? "conditional \"OS_WIN32\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by spice-common $as_me UNKNOWN, which was +generated by GNU Autoconf 2.68. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +spice-common config.status UNKNOWN +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ +AR \ +AR_FLAGS \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +nm_file_list_spec \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "common/Makefile") CONFIG_FILES="$CONFIG_FILES common/Makefile" ;; + "python_modules/Makefile") CONFIG_FILES="$CONFIG_FILES python_modules/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="" + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive. +AR_FLAGS=$lt_AR_FLAGS + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi + +# +# CONFIG_SUBDIRS section. +# +if test "$no_recursion" != yes; then + + # Remove --cache-file, --srcdir, and --disable-option-checking arguments + # so they do not pile up. + ac_sub_configure_args= + ac_prev= + eval "set x $ac_configure_args" + shift + for ac_arg + do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + ;; + --disable-option-checking) + ;; + *) + case $ac_arg in + *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_sub_configure_args " '$ac_arg'" ;; + esac + done + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ac_arg="--prefix=$prefix" + case $ac_arg in + *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" + + # Pass --silent + if test "$silent" = yes; then + ac_sub_configure_args="--silent $ac_sub_configure_args" + fi + + # Always prepend --disable-option-checking to silence warnings, since + # different subdirs can have different --enable and --with options. + ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" + + ac_popdir=`pwd` + for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d "$srcdir/$ac_dir" || continue + + ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" + $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 + $as_echo "$ac_msg" >&6 + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + cd "$ac_dir" + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f "$ac_srcdir/configure.gnu"; then + ac_sub_configure=$ac_srcdir/configure.gnu + elif test -f "$ac_srcdir/configure"; then + ac_sub_configure=$ac_srcdir/configure + elif test -f "$ac_srcdir/configure.in"; then + # This should be Cygnus configure. + ac_sub_configure=$ac_aux_dir/configure + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 +$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative name. + ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + # The eval makes quoting arguments work. + eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ + --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || + as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 + fi + + cd "$ac_popdir" + done +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff -Nru spice-gtk-0.9/spice-common/configure.ac spice-gtk-0.12/spice-common/configure.ac --- spice-gtk-0.9/spice-common/configure.ac 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/configure.ac 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,120 @@ +AC_PREREQ([2.63]) + +AC_INIT([spice-common], + [m4_esyscmd(build-aux/git-version-gen .tarball-version)], + [spice-devel@lists.freedesktop.org]) + +AC_CONFIG_SRCDIR([common/bitops.h]) +AC_CONFIG_MACRO_DIR([m4]) +AM_CONFIG_HEADER([config.h]) +AC_CONFIG_AUX_DIR([build-aux]) + +# Checks for programs +AM_INIT_AUTOMAKE([1.11 dist-xz no-dist-gzip tar-ustar foreign -Wall -Werror]) +AM_MAINTAINER_MODE +AM_SILENT_RULES([yes]) +LT_INIT + +AC_PROG_CC +AC_PROG_CC_C99 +if test "x$ac_cv_prog_cc_c99" = xno; then + AC_MSG_ERROR([C99 compiler is required.]) +fi +AM_PROG_CC_C_O + +# Checks for libraries +AC_CONFIG_SUBDIRS([spice-protocol]) +PROTOCOL_CFLAGS='-I ${top_srcdir}/spice-protocol' +AC_SUBST(PROTOCOL_CFLAGS) + +PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.17.7) +AC_SUBST(PIXMAN_CFLAGS) + +AC_ARG_ENABLE([smartcard], + AS_HELP_STRING([--enable-smartcard=@<:@yes/no@:>@], + [Enable smartcard support @<:@default=yes@:>@]), + [], + [enable_smartcard="yes"]) + +if test "x$enable_smartcard" = "xno"; then + AM_CONDITIONAL(WITH_SMARTCARD, false) +else + PKG_CHECK_MODULES(SMARTCARD, libcacard >= 0.1.2) + AC_DEFINE(USE_SMARTCARD, [1], [Define if supporting smartcard proxying]) + AM_CONDITIONAL(WITH_SMARTCARD, true) +fi + +AC_ARG_ENABLE([opengl], + AS_HELP_STRING([--enable-opengl=@<:@yes/no@:>@], + [Enable opengl support (not recommended) @<:@default=no@:>@]), + [], + [enable_opengl="no"]) +AM_CONDITIONAL(SUPPORT_GL, test "x$enable_opengl" = "xyes") + +if test "x$enable_opengl" = "xyes"; then + AC_CHECK_LIB(GL, glBlendFunc, GL_LIBS="$GL_LIBS -lGL", enable_opengl=no) + AC_CHECK_LIB(GLU, gluSphere, GL_LIBS="$GL_LIBS -lGLU", enable_opengl=no) + AC_DEFINE([USE_OPENGL], [1], [Define to build with OpenGL support]) + AC_DEFINE([GL_GLEXT_PROTOTYPES], [], [Enable GLExt prototypes]) + + if test "x$enable_opengl" = "xno"; then + AC_MSG_ERROR([GL libraries not available]) + fi +fi +AC_SUBST(GL_CFLAGS) +AC_SUBST(GL_LIBS) + +# Checks for header files +AC_PATH_X +AC_FUNC_ALLOCA +AC_CHECK_HEADERS([arpa/inet.h malloc.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/socket.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics +AC_C_INLINE +AC_TYPE_INT16_T +AC_TYPE_INT32_T +AC_TYPE_INT64_T +AC_TYPE_INT8_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T +AC_TYPE_UINT8_T + +# Checks for library functions +# do not check malloc or realloc, since that cannot be cross-compiled checked +AC_FUNC_ERROR_AT_LINE +AC_FUNC_FORK +AC_CHECK_FUNCS([dup2 floor inet_ntoa memmove memset pow sqrt]) + +# Others +AC_CANONICAL_HOST + +AC_MSG_CHECKING([for native Win32]) +case "$host_os" in + *mingw*|*cygwin*) + os_win32=yes + ;; + *) + os_win32=no + ;; +esac +AC_MSG_RESULT([$os_win32]) +AM_CONDITIONAL([OS_WIN32],[test "$os_win32" = "yes"]) + +# The End! +AC_CONFIG_FILES([ + Makefile + common/Makefile + python_modules/Makefile +]) + +AH_BOTTOM([ +/* argh.. this is evil */ +#if defined(FIXME_SERVER_SMARTCARD) && defined(USE_SMARTCARD) +%:undef USE_SMARTCARD +#endif +]) + +AC_OUTPUT diff -Nru spice-gtk-0.9/spice-common/m4/libtool.m4 spice-gtk-0.12/spice-common/m4/libtool.m4 --- spice-gtk-0.9/spice-common/m4/libtool.m4 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/m4/libtool.m4 2012-04-24 11:20:49.000000000 +0000 @@ -0,0 +1,7986 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +]) + +# serial 57 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +m4_defun([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from `configure', and `config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# `config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain="$ac_aux_dir/ltmain.sh" +])# _LT_PROG_LTMAIN + + +## ------------------------------------- ## +## Accumulate code for creating libtool. ## +## ------------------------------------- ## + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the `libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + +## ------------------------ ## +## FIXME: Eliminate VARNAME ## +## ------------------------ ## + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to `config.status' so that its +# declaration there will have the same value as in `configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags="_LT_TAGS"dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into `config.status', and then the shell code to quote escape them in +# for loops in `config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +_LT_OUTPUT_LIBTOOL_INIT +]) + +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# `#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test $lt_write_fail = 0 && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +\`$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test $[#] != 0 +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try \`$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try \`$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +_LT_COPYING +_LT_LIBTOOL_TAGS + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + _LT_PROG_REPLACE_SHELLFNS + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +m4_ifndef([AC_PROG_GO], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + m4_if([$1], [CXX], +[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script which will find a shell with a builtin +# printf (which we can use as an echo command). +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case "$ECHO" in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac + +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[ --with-sysroot[=DIR] Search for dependent libraries within DIR + (or the compiler's sysroot if not specified).], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([${with_sysroot}]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and in which our libraries should be installed.])]) + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" +])# _LT_ENABLE_LOCK + + +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[_LT_PROG_AR + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test x"[$]$2" = xyes; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links="nottested" +if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", + [Define to the sub-directory in which libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || + test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[[4-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[23]].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[[3-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], + [Run-time system search path for libraries]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program which can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program which can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi]) +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT@&t@_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64 which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS="$save_LDFLAGS"]) + if test "$lt_cv_irix_exported_symbol" = yes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting ${shlibpath_var} if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report which library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC="$lt_save_CC" +])# _LT_LANG_C_CONFIG + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_caught_CXX_error" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared + # libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + gnu*) + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd2*) + # C++ shared libraries are fairly broken + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + + _LT_TAGVAR(GCC, $1)="$GXX" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test "$_lt_caught_CXX_error" != yes + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case ${prev}${p} in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" || + test $p = "-R"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test "$pre_test_object_deps_done" = no; then + case ${prev} in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)="$p" + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)="$p" + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC* | sunCC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_F77" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${F77-"f77"} + CFLAGS=$FFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$G77" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC="$lt_save_CC" + CFLAGS="$lt_save_CFLAGS" +fi # test "$_lt_disable_F77" != yes + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_FC" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${FC-"f95"} + CFLAGS=$FCFLAGS + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test "$_lt_disable_FC" != yes + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +AC_MSG_RESULT([$xsi_shell]) +_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) + +AC_MSG_CHECKING([whether the shell understands "+="]) +lt_shell_append=no +( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +AC_MSG_RESULT([$lt_shell_append]) +_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) +# ------------------------------------------------------ +# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and +# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. +m4_defun([_LT_PROG_FUNCTION_REPLACE], +[dnl { +sed -e '/^$1 ()$/,/^} # $1 /c\ +$1 ()\ +{\ +m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) +} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: +]) + + +# _LT_PROG_REPLACE_SHELLFNS +# ------------------------- +# Replace existing portable implementations of several shell functions with +# equivalent extended shell implementations where those features are available.. +m4_defun([_LT_PROG_REPLACE_SHELLFNS], +[if test x"$xsi_shell" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl + func_split_long_opt_name=${1%%=*} + func_split_long_opt_arg=${1#*=}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) + + _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) + + _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) + + _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) +fi + +if test x"$lt_shell_append" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) + + _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl + func_quote_for_eval "${2}" +dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ + eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) +fi +]) + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine which file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff -Nru spice-gtk-0.9/spice-common/m4/lt~obsolete.m4 spice-gtk-0.12/spice-common/m4/lt~obsolete.m4 --- spice-gtk-0.9/spice-common/m4/lt~obsolete.m4 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/m4/lt~obsolete.m4 2012-04-24 11:20:49.000000000 +0000 @@ -0,0 +1,98 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 5 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff -Nru spice-gtk-0.9/spice-common/m4/ltoptions.m4 spice-gtk-0.12/spice-common/m4/ltoptions.m4 --- spice-gtk-0.9/spice-common/m4/ltoptions.m4 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/m4/ltoptions.m4 2012-04-24 11:20:49.000000000 +0000 @@ -0,0 +1,384 @@ +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 7 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option `$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl `shared' nor `disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + ]) +])# _LT_SET_OPTIONS + + +## --------------------------------- ## +## Macros to handle LT_INIT options. ## +## --------------------------------- ## + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [1], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the `shared' and +# `disable-shared' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the `static' and +# `disable-static' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the `fast-install' +# and `disable-fast-install' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the `pic-only' and `no-pic' +# LT_INIT options. +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [pic_mode=default]) + +test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + +## ----------------- ## +## LTDL_INIT Options ## +## ----------------- ## + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) diff -Nru spice-gtk-0.9/spice-common/m4/ltsugar.m4 spice-gtk-0.12/spice-common/m4/ltsugar.m4 --- spice-gtk-0.9/spice-common/m4/ltsugar.m4 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/m4/ltsugar.m4 2012-04-24 11:20:49.000000000 +0000 @@ -0,0 +1,123 @@ +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59 which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) diff -Nru spice-gtk-0.9/spice-common/m4/ltversion.m4 spice-gtk-0.12/spice-common/m4/ltversion.m4 --- spice-gtk-0.9/spice-common/m4/ltversion.m4 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/m4/ltversion.m4 2012-04-24 11:20:49.000000000 +0000 @@ -0,0 +1,23 @@ +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# @configure_input@ + +# serial 3337 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4.2]) +m4_define([LT_PACKAGE_REVISION], [1.3337]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4.2' +macro_revision='1.3337' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) diff -Nru spice-gtk-0.9/spice-common/Makefile.am spice-gtk-0.12/spice-common/Makefile.am --- spice-gtk-0.9/spice-common/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/Makefile.am 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,27 @@ +NULL = +ACLOCAL_AMFLAGS = -I m4 + +SUBDIRS = python_modules common +DIST_SUBDIRS = spice-protocol $(SUBDIRS) + +EXTRA_DIST = \ + spice_codegen.py \ + spice.proto \ + spice1.proto \ + $(NULL) + +MAINTAINERCLEANFILES = \ + $(srcdir)/INSTALL \ + $(srcdir)/aclocal.m4 \ + $(srcdir)/autoscan.log \ + $(srcdir)/build-aux \ + $(srcdir)/config.h.in \ + $(srcdir)/m4/libtool.m4 \ + $(srcdir)/m4/ltoptions.m4 \ + $(srcdir)/m4/ltsugar.m4 \ + $(srcdir)/m4/ltversion.m4 \ + $(srcdir)/m4/lt~obsolete.m4 \ + `find "$(srcdir)" -type f -name Makefile.in -print` \ + $(NULL) + +-include $(top_srcdir)/git.mk diff -Nru spice-gtk-0.9/spice-common/Makefile.in spice-gtk-0.12/spice-common/Makefile.in --- spice-gtk-0.9/spice-common/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/Makefile.in 2012-04-24 11:20:55.000000000 +0000 @@ -0,0 +1,786 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure build-aux/compile \ + build-aux/config.guess build-aux/config.sub build-aux/depcomp \ + build-aux/install-sh build-aux/ltmain.sh build-aux/missing +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir dist dist-all distcheck +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +GZIP_ENV = --best +DIST_ARCHIVES = $(distdir).tar.xz +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PROTOCOL_CFLAGS = @PROTOCOL_CFLAGS@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SMARTCARD_CFLAGS = @SMARTCARD_CFLAGS@ +SMARTCARD_LIBS = @SMARTCARD_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +ACLOCAL_AMFLAGS = -I m4 +SUBDIRS = python_modules common +DIST_SUBDIRS = spice-protocol $(SUBDIRS) +EXTRA_DIST = \ + spice_codegen.py \ + spice.proto \ + spice1.proto \ + $(NULL) + +MAINTAINERCLEANFILES = \ + $(srcdir)/INSTALL \ + $(srcdir)/aclocal.m4 \ + $(srcdir)/autoscan.log \ + $(srcdir)/build-aux \ + $(srcdir)/config.h.in \ + $(srcdir)/m4/libtool.m4 \ + $(srcdir)/m4/ltoptions.m4 \ + $(srcdir)/m4/ltsugar.m4 \ + $(srcdir)/m4/ltversion.m4 \ + $(srcdir)/m4/lt~obsolete.m4 \ + `find "$(srcdir)" -type f -name Makefile.in -print` \ + $(NULL) + +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @if test ! -f $@; then rm -f stamp-h1; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ + ctags-recursive install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ + dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \ + dist-zip distcheck distclean distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-recursive uninstall uninstall-am + + +-include $(top_srcdir)/git.mk + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru spice-gtk-0.9/spice-common/python_modules/codegen.py spice-gtk-0.12/spice-common/python_modules/codegen.py --- spice-gtk-0.9/spice-common/python_modules/codegen.py 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/python_modules/codegen.py 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,374 @@ +from __future__ import with_statement +from cStringIO import StringIO + +def camel_to_underscores(s, upper = False): + res = "" + for i in range(len(s)): + c = s[i] + if i > 0 and c.isupper(): + res = res + "_" + if upper: + res = res + c.upper() + else: + res = res + c.lower() + return res + +def underscores_to_camel(s): + res = "" + do_upper = True + for i in range(len(s)): + c = s[i] + if c == "_": + do_upper = True + else: + if do_upper: + res = res + c.upper() + else: + res = res + c + do_upper = False + return res + +proto_prefix = "Temp" + +def set_prefix(prefix): + global proto_prefix + global proto_prefix_upper + global proto_prefix_lower + proto_prefix = prefix + proto_prefix_upper = prefix.upper() + proto_prefix_lower = prefix.lower() + +def prefix_underscore_upper(*args): + s = proto_prefix_upper + for arg in args: + s = s + "_" + arg + return s + +def prefix_underscore_lower(*args): + s = proto_prefix_lower + for arg in args: + s = s + "_" + arg + return s + +def prefix_camel(*args): + s = proto_prefix + for arg in args: + s = s + underscores_to_camel(arg) + return s + +def increment_identifier(idf): + v = idf[-1:] + if v.isdigit(): + return idf[:-1] + str(int(v) + 1) + return idf + "2" + +def sum_array(array): + if len(array) == 0: + return 0 + return " + ".join(array) + +class CodeWriter: + def __init__(self): + self.out = StringIO() + self.contents = [self.out] + self.indentation = 0 + self.at_line_start = True + self.indexes = ["i", "j", "k", "ii", "jj", "kk"] + self.current_index = 0 + self.generated = {} + self.vars = [] + self.has_error_check = False + self.options = {} + self.function_helper_writer = None + + def set_option(self, opt, value = True): + self.options[opt] = value + + def has_option(self, opt): + return self.options.has_key(opt) + + def set_is_generated(self, kind, name): + if not self.generated.has_key(kind): + v = {} + self.generated[kind] = v + else: + v = self.generated[kind] + v[name] = 1 + + def is_generated(self, kind, name): + if not self.generated.has_key(kind): + return False + v = self.generated[kind] + return v.has_key(name) + + def getvalue(self): + strs = map(lambda writer: writer.getvalue(), self.contents) + return "".join(strs) + + def get_subwriter(self): + writer = CodeWriter() + self.contents.append(writer) + self.out = StringIO() + self.contents.append(self.out) + writer.indentation = self.indentation + writer.at_line_start = self.at_line_start + writer.generated = self.generated + writer.options = self.options + writer.public_prefix = self.public_prefix + + return writer + + def write(self, s): + # Ensure its a string + s = str(s) + + if len(s) == 0: + return + + if self.at_line_start: + for i in range(self.indentation): + self.out.write(" ") + self.at_line_start = False + self.out.write(s) + return self + + def newline(self): + self.out.write("\n") + self.at_line_start = True + return self + + def writeln(self, s): + self.write(s) + self.newline() + return self + + def label(self, s): + self.indentation = self.indentation - 1 + self.write(s + ":") + self.indentation = self.indentation + 1 + self.newline() + + def statement(self, s): + self.write(s) + self.write(";") + self.newline() + return self + + def assign(self, var, val): + self.write("%s = %s" % (var, val)) + self.write(";") + self.newline() + return self + + def increment(self, var, val): + self.write("%s += %s" % (var, val)) + self.write(";") + self.newline() + return self + + def comment(self, str): + self.write("/* " + str + " */") + return self + + def todo(self, str): + self.comment("TODO: *** %s ***" % str).newline() + return self + + def error_check(self, check, label = "error"): + self.has_error_check = True + with self.block("if (SPICE_UNLIKELY(%s))" % check): + if self.has_option("print_error"): + self.statement('printf("%%s: Caught error - %s", __PRETTY_FUNCTION__)' % check) + if self.has_option("assert_on_error"): + self.statement("assert(0)") + self.statement("goto %s" % label) + + def indent(self): + self.indentation += 4 + + def unindent(self): + self.indentation -= 4 + if self.indentation < 0: + self.indenttation = 0 + + def begin_block(self, prefix= "", comment = ""): + if len(prefix) > 0: + self.write(prefix) + if self.at_line_start: + self.write("{") + else: + self.write(" {") + if len(comment) > 0: + self.write(" ") + self.comment(comment) + self.newline() + self.indent() + + def end_block(self, semicolon=False, newline=True): + self.unindent() + if self.at_line_start: + self.write("}") + else: + self.write(" }") + if semicolon: + self.write(";") + if newline: + self.newline() + + class Block: + def __init__(self, writer, semicolon, newline): + self.writer = writer + self.semicolon = semicolon + self.newline = newline + + def __enter__(self): + return self.writer.get_subwriter() + + def __exit__(self, exc_type, exc_value, traceback): + self.writer.end_block(self.semicolon, self.newline) + + class PartialBlock: + def __init__(self, writer, scope, semicolon, newline): + self.writer = writer + self.scope = scope + self.semicolon = semicolon + self.newline = newline + + def __enter__(self): + return self.scope + + def __exit__(self, exc_type, exc_value, traceback): + self.writer.end_block(self.semicolon, self.newline) + + class NoBlock: + def __init__(self, scope): + self.scope = scope + + def __enter__(self): + return self.scope + + def __exit__(self, exc_type, exc_value, traceback): + pass + + def block(self, prefix= "", comment = "", semicolon=False, newline=True): + self.begin_block(prefix, comment) + return self.Block(self, semicolon, newline) + + def partial_block(self, scope, semicolon=False, newline=True): + return self.PartialBlock(self, scope, semicolon, newline) + + def no_block(self, scope): + return self.NoBlock(scope) + + def optional_block(self, scope): + if scope != None: + return self.NoBlock(scope) + return self.block() + + def for_loop(self, index, limit): + return self.block("for (%s = 0; %s < %s; %s++)" % (index, index, limit, index)) + + def while_loop(self, expr): + return self.block("while (%s)" % (expr)) + + def if_block(self, check, elseif=False, newline=True): + s = "if (%s)" % (check) + if elseif: + s = " else " + s + self.begin_block(s, "") + return self.Block(self, False, newline) + + def variable_defined(self, name): + for n in self.vars: + if n == name: + return True + return False + + def variable_def(self, ctype, *names): + for n in names: + # Strip away initialization + i = n.find("=") + if i != -1: + n = n[0:i] + self.vars.append(n.strip()) + # only add space for non-pointer types + if ctype[-1] == "*": + ctype = ctype[:-1].rstrip() + self.writeln("%s *%s;"%(ctype, ", *".join(names))) + else: + self.writeln("%s %s;"%(ctype, ", ".join(names))) + return self + + def function_helper(self): + if self.function_helper_writer != None: + writer = self.function_helper_writer.get_subwriter() + self.function_helper_writer.newline() + else: + writer = self.get_subwriter() + return writer + + def function(self, name, return_type, args, static = False): + self.has_error_check = False + self.function_helper_writer = self.get_subwriter() + if static: + self.write("static ") + self.write(return_type) + self.write(" %s(%s)"% (name, args)).newline() + self.begin_block() + self.function_variables_writer = self.get_subwriter() + self.function_variables = {} + return self.function_variables_writer + + def macro(self, name, args, define): + self.write("#define %s(%s) %s" % (name, args, define)).newline() + + def ifdef(self, name): + indentation = self.indentation + self.indentation = 0; + self.write("#ifdef %s" % (name)).newline() + self.indentation = indentation + + def ifdef_else(self, name): + indentation = self.indentation + self.indentation = 0; + self.write("#else /* %s */" % (name)).newline() + self.indentation = indentation + + def endif(self, name): + indentation = self.indentation + self.indentation = 0; + self.write("#endif /* %s */" % (name)).newline() + self.indentation = indentation + + def add_function_variable(self, ctype, name): + if self.function_variables.has_key(name): + assert(self.function_variables[name] == ctype) + else: + self.function_variables[name] = ctype + self.function_variables_writer.variable_def(ctype, name) + + def pop_index(self): + index = self.indexes[self.current_index] + self.current_index = self.current_index + 1 + self.add_function_variable("uint32_t", index) + return index + + def push_index(self): + self.current_index = self.current_index - 1 + + class Index: + def __init__(self, writer, val): + self.writer = writer + self.val = val + + def __enter__(self): + return self.val + + def __exit__(self, exc_type, exc_value, traceback): + self.writer.push_index() + + def index(self, no_block = False): + if no_block: + return self.no_block(None) + val = self.pop_index() + return self.Index(self, val) diff -Nru spice-gtk-0.9/spice-common/python_modules/demarshal.py spice-gtk-0.12/spice-common/python_modules/demarshal.py --- spice-gtk-0.9/spice-common/python_modules/demarshal.py 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/python_modules/demarshal.py 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,1257 @@ +from __future__ import with_statement +import ptypes +import codegen + +# The handling of sizes is somewhat complex, as there are several types of size: +# * nw_size +# This is the network size, i.e. the number of bytes on the network +# +# * mem_size +# The total amount of memory used for the representation of something inside +# spice. This is generally sizeof(C struct), but can be larger if for instance +# the type has a variable size array at the end or has a pointer in it that +# points to another data chunk (which will be allocated after the main +# data chunk). This is essentially how much memory you need to allocate to +# contain the data type. +# +# * extra_size +# This is the size of anything that is not part of the containing structure. +# For instance, a primitive (say uint32_t) member has no extra size, because +# when allocating its part of the sizeof(MessageStructType) struct. However +# a variable array can be places at the end of a structure (@end) and its +# size is then extra_size. Note that this extra_size is included in the +# mem_size of the enclosing struct, and even if you request the mem_size +# of the array itself. However, extra_size is typically not requested +# when the full mem_size is also requested. +# +# extra sizes come in two flavours. contains_extra_size means that the item +# has a normal presence in the parent container, but has some additional +# extra_size it references. For instance via a pointer somewhere in it. +# There is also is_extra_size(). This indicates that the whole elements +# "normal" mem size should be considered extra size for the container, so +# when computing the parent mem_size you should add the mem_size of this +# part as extra_size + +def write_parser_helpers(writer): + if writer.is_generated("helper", "demarshaller"): + return + + writer.set_is_generated("helper", "demarshaller") + + writer = writer.function_helper() + + writer.writeln("#ifdef WORDS_BIGENDIAN") + for size in [8, 16, 32, 64]: + for sign in ["", "u"]: + utype = "uint%d" % (size) + type = "%sint%d" % (sign, size) + swap = "SPICE_BYTESWAP%d" % size + if size == 8: + writer.macro("read_%s" % type, "ptr", "(*((%s_t *)(ptr)))" % type) + writer.macro("write_%s" % type, "ptr, val", "*(%s_t *)(ptr) = val" % (type)) + else: + writer.macro("read_%s" % type, "ptr", "((%s_t)%s(*((%s_t *)(ptr)))" % (type, swap, utype)) + writer.macro("write_%s" % type, "ptr, val", "*(%s_t *)(ptr) = %s((%s_t)val)" % (utype, swap, utype)) + writer.writeln("#else") + for size in [8, 16, 32, 64]: + for sign in ["", "u"]: + type = "%sint%d" % (sign, size) + writer.macro("read_%s" % type, "ptr", "(*((%s_t *)(ptr)))" % type) + writer.macro("write_%s" % type, "ptr, val", "(*((%s_t *)(ptr))) = val" % type) + writer.writeln("#endif") + + for size in [8, 16, 32, 64]: + for sign in ["", "u"]: + writer.newline() + type = "%sint%d" % (sign, size) + ctype = "%s_t" % type + scope = writer.function("SPICE_GNUC_UNUSED consume_%s" % type, ctype, "uint8_t **ptr", True) + scope.variable_def(ctype, "val") + writer.assign("val", "read_%s(*ptr)" % type) + writer.increment("*ptr", size / 8) + writer.statement("return val") + writer.end_block() + + writer.newline() + writer.statement("typedef struct PointerInfo PointerInfo") + writer.statement("typedef void (*message_destructor_t)(uint8_t *message)") + writer.statement("typedef uint8_t * (*parse_func_t)(uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *ptr_info, int minor)") + writer.statement("typedef uint8_t * (*parse_msg_func_t)(uint8_t *message_start, uint8_t *message_end, int minor, size_t *size_out, message_destructor_t *free_message)") + writer.statement("typedef uint8_t * (*spice_parse_channel_func_t)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message)") + + writer.newline() + writer.begin_block("struct PointerInfo") + writer.variable_def("uint64_t", "offset") + writer.variable_def("parse_func_t", "parse") + writer.variable_def("void **", "dest") + writer.variable_def("uint32_t", "nelements") + writer.end_block(semicolon=True) + +def write_read_primitive(writer, start, container, name, scope): + m = container.lookup_member(name) + assert(m.is_primitive()) + writer.assign("pos", start + " + " + container.get_nw_offset(m, "", "__nw_size")) + writer.error_check("pos + %s > message_end" % m.member_type.get_fixed_nw_size()) + + var = "%s__value" % (name.replace(".", "_")) + if not scope.variable_defined(var): + scope.variable_def(m.member_type.c_type(), var) + writer.assign(var, "read_%s(pos)" % (m.member_type.primitive_type())) + return var + +def write_write_primitive(writer, start, container, name, val): + m = container.lookup_member(name) + assert(m.is_primitive()) + writer.assign("pos", start + " + " + container.get_nw_offset(m, "", "__nw_size")) + + var = "%s__value" % (name) + writer.statement("write_%s(pos, %s)" % (m.member_type.primitive_type(), val)) + return var + +def write_read_primitive_item(writer, item, scope): + assert(item.type.is_primitive()) + writer.assign("pos", item.get_position()) + writer.error_check("pos + %s > message_end" % item.type.get_fixed_nw_size()) + var = "%s__value" % (item.subprefix.replace(".", "_")) + scope.variable_def(item.type.c_type(), var) + writer.assign(var, "read_%s(pos)" % (item.type.primitive_type())) + return var + +class ItemInfo: + def __init__(self, type, prefix, position): + self.type = type + self.prefix = prefix + self.subprefix = prefix + self.position = position + self.member = None + + def nw_size(self): + return self.prefix + "__nw_size" + + def mem_size(self): + return self.prefix + "__mem_size" + + def extra_size(self): + return self.prefix + "__extra_size" + + def get_position(self): + return self.position + +class MemberItemInfo(ItemInfo): + def __init__(self, member, container, start): + if not member.is_switch(): + self.type = member.member_type + self.prefix = member.name + self.subprefix = member.name + self.position = "(%s + %s)" % (start, container.get_nw_offset(member, "", "__nw_size")) + self.member = member + +def write_validate_switch_member(writer, container, switch_member, scope, parent_scope, start, + want_nw_size, want_mem_size, want_extra_size): + var = container.lookup_member(switch_member.variable) + var_type = var.member_type + + v = write_read_primitive(writer, start, container, switch_member.variable, parent_scope) + + item = MemberItemInfo(switch_member, container, start) + + first = True + for c in switch_member.cases: + check = c.get_check(v, var_type) + m = c.member + with writer.if_block(check, not first, False) as if_scope: + item.type = c.member.member_type + item.subprefix = item.prefix + "_" + m.name + item.member = c.member + + all_as_extra_size = m.is_extra_size() and want_extra_size + if not want_mem_size and all_as_extra_size and not scope.variable_defined(item.mem_size()): + scope.variable_def("uint32_t", item.mem_size()) + + sub_want_mem_size = want_mem_size or all_as_extra_size + sub_want_extra_size = want_extra_size and not all_as_extra_size + + write_validate_item(writer, container, item, if_scope, scope, start, + want_nw_size, sub_want_mem_size, sub_want_extra_size) + + if all_as_extra_size: + writer.assign(item.extra_size(), item.mem_size()) + + first = False + + with writer.block(" else"): + if want_nw_size: + writer.assign(item.nw_size(), 0) + if want_mem_size: + writer.assign(item.mem_size(), 0) + if want_extra_size: + writer.assign(item.extra_size(), 0) + + writer.newline() + +def write_validate_struct_function(writer, struct): + validate_function = "validate_%s" % struct.c_type() + if writer.is_generated("validator", validate_function): + return validate_function + + writer.set_is_generated("validator", validate_function) + writer = writer.function_helper() + scope = writer.function(validate_function, "static intptr_t", "uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor") + scope.variable_def("uint8_t *", "start = message_start + offset") + scope.variable_def("SPICE_GNUC_UNUSED uint8_t *", "pos") + scope.variable_def("size_t", "mem_size", "nw_size") + num_pointers = struct.get_num_pointers() + if num_pointers != 0: + scope.variable_def("SPICE_GNUC_UNUSED intptr_t", "ptr_size") + + writer.newline() + with writer.if_block("offset == 0"): + writer.statement("return 0") + + writer.newline() + writer.error_check("start >= message_end") + + writer.newline() + write_validate_container(writer, None, struct, "start", scope, True, True, False) + + writer.newline() + writer.comment("Check if struct fits in reported side").newline() + writer.error_check("start + nw_size > message_end") + + writer.statement("return mem_size") + + writer.newline() + writer.label("error") + writer.statement("return -1") + + writer.end_block() + + return validate_function + +def write_validate_pointer_item(writer, container, item, scope, parent_scope, start, + want_nw_size, want_mem_size, want_extra_size): + if want_nw_size: + writer.assign(item.nw_size(), item.type.get_fixed_nw_size()) + + if want_mem_size or want_extra_size: + target_type = item.type.target_type + + v = write_read_primitive_item(writer, item, scope) + if item.type.has_attr("nonnull"): + writer.error_check("%s == 0" % v) + + # pointer target is struct, or array of primitives + # if array, need no function check + + if target_type.is_array(): + writer.error_check("message_start + %s >= message_end" % v) + + + assert target_type.element_type.is_primitive() + + array_item = ItemInfo(target_type, "%s__array" % item.prefix, start) + scope.variable_def("uint32_t", array_item.nw_size()) + # don't create a variable that isn't used, fixes -Werror=unused-but-set-variable + need_mem_size = want_mem_size or ( + want_extra_size and not item.member.has_attr("chunk") + and not target_type.is_cstring_length()) + if need_mem_size: + scope.variable_def("uint32_t", array_item.mem_size()) + if target_type.is_cstring_length(): + writer.assign(array_item.nw_size(), "spice_strnlen((char *)message_start + %s, message_end - (message_start + %s))" % (v, v)) + writer.error_check("*(message_start + %s + %s) != 0" % (v, array_item.nw_size())) + else: + write_validate_array_item(writer, container, array_item, scope, parent_scope, start, + True, want_mem_size=need_mem_size, want_extra_size=False) + writer.error_check("message_start + %s + %s > message_end" % (v, array_item.nw_size())) + + if want_extra_size: + if item.member and item.member.has_attr("chunk"): + writer.assign(item.extra_size(), "sizeof(SpiceChunks) + sizeof(SpiceChunk)") + elif item.member and item.member.has_attr("nocopy"): + writer.comment("@nocopy, so no extra size").newline() + writer.assign(item.extra_size(), 0) + elif target_type.element_type.get_fixed_nw_size == 1: + writer.assign(item.extra_size(), array_item.mem_size()) + # If not bytes or zero, add padding needed for alignment + else: + writer.assign(item.extra_size(), "%s + /* for alignment */ 3" % array_item.mem_size()) + if want_mem_size: + writer.assign(item.mem_size(), "sizeof(void *) + %s" % array_item.mem_size()) + + elif target_type.is_struct(): + validate_function = write_validate_struct_function(writer, target_type) + writer.assign("ptr_size", "%s(message_start, message_end, %s, minor)" % (validate_function, v)) + writer.error_check("ptr_size < 0") + + if want_extra_size: + writer.assign(item.extra_size(), "ptr_size + /* for alignment */ 3") + if want_mem_size: + writer.assign(item.mem_size(), "sizeof(void *) + ptr_size") + else: + raise NotImplementedError("pointer to unsupported type %s" % target_type) + + +def write_validate_array_item(writer, container, item, scope, parent_scope, start, + want_nw_size, want_mem_size, want_extra_size): + array = item.type + is_byte_size = False + element_type = array.element_type + if array.is_bytes_length(): + nelements = "%s__nbytes" %(item.prefix) + real_nelements = "%s__nelements" %(item.prefix) + if not parent_scope.variable_defined(real_nelements): + parent_scope.variable_def("uint32_t", real_nelements) + else: + nelements = "%s__nelements" %(item.prefix) + if not parent_scope.variable_defined(nelements): + parent_scope.variable_def("uint32_t", nelements) + + if array.is_constant_length(): + writer.assign(nelements, array.size) + elif array.is_remaining_length(): + if element_type.is_fixed_nw_size(): + if element_type.get_fixed_nw_size() == 1: + writer.assign(nelements, "message_end - %s" % item.get_position()) + else: + writer.assign(nelements, "(message_end - %s) / (%s)" %(item.get_position(), element_type.get_fixed_nw_size())) + else: + raise NotImplementedError("TODO array[] of dynamic element size not done yet") + elif array.is_identifier_length(): + v = write_read_primitive(writer, start, container, array.size, scope) + writer.assign(nelements, v) + elif array.is_image_size_length(): + bpp = array.size[1] + width = array.size[2] + rows = array.size[3] + width_v = write_read_primitive(writer, start, container, width, scope) + rows_v = write_read_primitive(writer, start, container, rows, scope) + # TODO: Handle multiplication overflow + if bpp == 8: + writer.assign(nelements, "%s * %s" % (width_v, rows_v)) + elif bpp == 1: + writer.assign(nelements, "((%s + 7) / 8 ) * %s" % (width_v, rows_v)) + else: + writer.assign(nelements, "((%s * %s + 7) / 8 ) * %s" % (bpp, width_v, rows_v)) + elif array.is_bytes_length(): + is_byte_size = True + v = write_read_primitive(writer, start, container, array.size[1], scope) + writer.assign(nelements, v) + writer.assign(real_nelements, 0) + elif array.is_cstring_length(): + writer.todo("cstring array size type not handled yet") + else: + writer.todo("array size type not handled yet") + + writer.newline() + + nw_size = item.nw_size() + mem_size = item.mem_size() + extra_size = item.extra_size() + + if is_byte_size and want_nw_size: + writer.assign(nw_size, nelements) + want_nw_size = False + + if element_type.is_fixed_nw_size() and want_nw_size: + element_size = element_type.get_fixed_nw_size() + # TODO: Overflow check the multiplication + if element_size == 1: + writer.assign(nw_size, nelements) + else: + writer.assign(nw_size, "(%s) * %s" % (element_size, nelements)) + want_nw_size = False + + if array.has_attr("as_ptr") and want_mem_size: + writer.assign(mem_size, "sizeof(void *)") + want_mem_size = False + + if array.has_attr("chunk"): + if want_mem_size: + writer.assign(extra_size, "sizeof(SpiceChunks *)") + want_mem_size = False + if want_extra_size: + writer.assign(extra_size, "sizeof(SpiceChunks) + sizeof(SpiceChunk)") + want_extra_size = False + + if element_type.is_fixed_sizeof() and want_mem_size and not is_byte_size: + # TODO: Overflow check the multiplication + if array.has_attr("ptr_array"): + writer.assign(mem_size, "sizeof(void *) + SPICE_ALIGN(%s * %s, 4)" % (element_type.sizeof(), nelements)) + else: + writer.assign(mem_size, "%s * %s" % (element_type.sizeof(), nelements)) + want_mem_size = False + + if not element_type.contains_extra_size() and want_extra_size: + writer.assign(extra_size, 0) + want_extra_size = False + + if not (want_mem_size or want_nw_size or want_extra_size): + return + + start2 = codegen.increment_identifier(start) + scope.variable_def("uint8_t *", "%s = %s" % (start2, item.get_position())) + if is_byte_size: + start2_end = "%s_array_end" % start2 + scope.variable_def("uint8_t *", start2_end) + + element_item = ItemInfo(element_type, "%s__element" % item.prefix, start2) + + element_nw_size = element_item.nw_size() + element_mem_size = element_item.mem_size() + element_extra_size = element_item.extra_size() + scope.variable_def("uint32_t", element_nw_size) + scope.variable_def("uint32_t", element_mem_size) + if want_extra_size: + scope.variable_def("uint32_t", element_extra_size) + + if want_nw_size: + writer.assign(nw_size, 0) + if want_mem_size: + writer.assign(mem_size, 0) + if want_extra_size: + writer.assign(extra_size, 0) + + want_element_nw_size = want_nw_size + if element_type.is_fixed_nw_size(): + start_increment = element_type.get_fixed_nw_size() + else: + want_element_nw_size = True + start_increment = element_nw_size + + if is_byte_size: + writer.assign(start2_end, "%s + %s" % (start2, nelements)) + + with writer.index(no_block = is_byte_size) as index: + with writer.while_loop("%s < %s" % (start2, start2_end) ) if is_byte_size else writer.for_loop(index, nelements) as scope: + if is_byte_size: + writer.increment(real_nelements, 1) + write_validate_item(writer, container, element_item, scope, parent_scope, start2, + want_element_nw_size, want_mem_size, want_extra_size) + + if want_nw_size: + writer.increment(nw_size, element_nw_size) + if want_mem_size: + if array.has_attr("ptr_array"): + writer.increment(mem_size, "sizeof(void *) + SPICE_ALIGN(%s, 4)" % element_mem_size) + else: + writer.increment(mem_size, element_mem_size) + if want_extra_size: + writer.increment(extra_size, element_extra_size) + + writer.increment(start2, start_increment) + if is_byte_size: + writer.error_check("%s != %s" % (start2, start2_end)) + write_write_primitive(writer, start, container, array.size[1], real_nelements) + +def write_validate_struct_item(writer, container, item, scope, parent_scope, start, + want_nw_size, want_mem_size, want_extra_size): + struct = item.type + start2 = codegen.increment_identifier(start) + scope.variable_def("SPICE_GNUC_UNUSED uint8_t *", start2 + " = %s" % (item.get_position())) + + write_validate_container(writer, item.prefix, struct, start2, scope, want_nw_size, want_mem_size, want_extra_size) + +def write_validate_primitive_item(writer, container, item, scope, parent_scope, start, + want_nw_size, want_mem_size, want_extra_size): + if want_nw_size: + nw_size = item.nw_size() + writer.assign(nw_size, item.type.get_fixed_nw_size()) + if want_mem_size: + mem_size = item.mem_size() + writer.assign(mem_size, item.type.sizeof()) + if want_extra_size: + writer.assign(item.extra_size(), 0) + +def write_validate_item(writer, container, item, scope, parent_scope, start, + want_nw_size, want_mem_size, want_extra_size): + if item.member and item.member.has_attr("to_ptr"): + want_nw_size = True + if item.type.is_pointer(): + write_validate_pointer_item(writer, container, item, scope, parent_scope, start, + want_nw_size, want_mem_size, want_extra_size) + elif item.type.is_array(): + write_validate_array_item(writer, container, item, scope, parent_scope, start, + want_nw_size, want_mem_size, want_extra_size) + elif item.type.is_struct(): + write_validate_struct_item(writer, container, item, scope, parent_scope, start, + want_nw_size, want_mem_size, want_extra_size) + elif item.type.is_primitive(): + write_validate_primitive_item(writer, container, item, scope, parent_scope, start, + want_nw_size, want_mem_size, want_extra_size) + else: + writer.todo("Implement validation of %s" % item.type) + + if item.member and item.member.has_attr("to_ptr"): + saved_size = "%s__saved_size" % item.member.name + writer.add_function_variable("uint32_t", saved_size + " = 0") + writer.assign(saved_size, item.nw_size()) + +def write_validate_member(writer, container, member, parent_scope, start, + want_nw_size, want_mem_size, want_extra_size): + if member.has_attr("virtual"): + return + + if member.has_minor_attr(): + prefix = "if (minor >= %s)" % (member.get_minor_attr()) + newline = False + else: + prefix = "" + newline = True + item = MemberItemInfo(member, container, start) + with writer.block(prefix, newline=newline, comment=member.name) as scope: + if member.is_switch(): + write_validate_switch_member(writer, container, member, scope, parent_scope, start, + want_nw_size, want_mem_size, want_extra_size) + else: + write_validate_item(writer, container, item, scope, parent_scope, start, + want_nw_size, want_mem_size, want_extra_size) + + if member.has_minor_attr(): + with writer.block(" else", comment = "minor < %s" % (member.get_minor_attr())): + if member.is_array(): + nelements = "%s__nelements" %(item.prefix) + writer.assign(nelements, 0) + if want_nw_size: + writer.assign(item.nw_size(), 0) + + if want_mem_size: + if member.is_fixed_sizeof(): + writer.assign(item.mem_size(), member.sizeof()) + elif member.is_array(): + writer.assign(item.mem_size(), 0) + else: + raise NotImplementedError("TODO minor check for non-constant items") + + assert not want_extra_size + +def write_validate_container(writer, prefix, container, start, parent_scope, want_nw_size, want_mem_size, want_extra_size): + for m in container.members: + sub_want_nw_size = want_nw_size and not m.is_fixed_nw_size() + sub_want_mem_size = m.is_extra_size() and want_mem_size + sub_want_extra_size = not m.is_extra_size() and m.contains_extra_size() + + defs = ["size_t"] + if sub_want_nw_size: + defs.append (m.name + "__nw_size") + if sub_want_mem_size: + defs.append (m.name + "__mem_size") + if sub_want_extra_size: + defs.append (m.name + "__extra_size") + + if sub_want_nw_size or sub_want_mem_size or sub_want_extra_size: + parent_scope.variable_def(*defs) + write_validate_member(writer, container, m, parent_scope, start, + sub_want_nw_size, sub_want_mem_size, sub_want_extra_size) + writer.newline() + + if want_nw_size: + if prefix: + nw_size = prefix + "__nw_size" + else: + nw_size = "nw_size" + + size = 0 + for m in container.members: + if m.is_fixed_nw_size(): + size = size + m.get_fixed_nw_size() + + nm_sum = str(size) + for m in container.members: + if not m.is_fixed_nw_size(): + nm_sum = nm_sum + " + " + m.name + "__nw_size" + + writer.assign(nw_size, nm_sum) + + if want_mem_size: + if prefix: + mem_size = prefix + "__mem_size" + else: + mem_size = "mem_size" + + mem_sum = container.sizeof() + for m in container.members: + if m.is_extra_size(): + mem_sum = mem_sum + " + " + m.name + "__mem_size" + elif m.contains_extra_size(): + mem_sum = mem_sum + " + " + m.name + "__extra_size" + + writer.assign(mem_size, mem_sum) + + if want_extra_size: + if prefix: + extra_size = prefix + "__extra_size" + else: + extra_size = "extra_size" + + extra_sum = [] + for m in container.members: + if m.is_extra_size(): + extra_sum.append(m.name + "__mem_size") + elif m.contains_extra_size(): + extra_sum.append(m.name + "__extra_size") + writer.assign(extra_size, codegen.sum_array(extra_sum)) + +class DemarshallingDestination: + def __init__(self): + pass + + def child_at_end(self, writer, t): + return RootDemarshallingDestination(self, t.c_type(), t.sizeof()) + + def child_sub(self, member): + return SubDemarshallingDestination(self, member) + + def declare(self, writer): + return writer.optional_block(self.reuse_scope) + + def is_toplevel(self): + return self.parent_dest == None and not self.is_helper + +class RootDemarshallingDestination(DemarshallingDestination): + def __init__(self, parent_dest, c_type, sizeof, pointer = None): + self.is_helper = False + self.reuse_scope = None + self.parent_dest = parent_dest + if parent_dest: + self.base_var = codegen.increment_identifier(parent_dest.base_var) + else: + self.base_var = "out" + self.c_type = c_type + self.sizeof = sizeof + self.pointer = pointer # None == at "end" + + def get_ref(self, member): + return self.base_var + "->" + member + + def declare(self, writer): + if self.reuse_scope: + scope = self.reuse_scope + else: + writer.begin_block() + scope = writer.get_subwriter() + + scope.variable_def(self.c_type + " *", self.base_var) + if not self.reuse_scope: + scope.newline() + + if self.pointer: + writer.assign(self.base_var, "(%s *)%s" % (self.c_type, self.pointer)) + else: + writer.assign(self.base_var, "(%s *)end" % (self.c_type)) + writer.increment("end", self.sizeof) + writer.newline() + + if self.reuse_scope: + return writer.no_block(self.reuse_scope) + else: + return writer.partial_block(scope) + +class SubDemarshallingDestination(DemarshallingDestination): + def __init__(self, parent_dest, member): + self.reuse_scope = None + self.parent_dest = parent_dest + self.base_var = parent_dest.base_var + self.member = member + self.is_helper = False + + def get_ref(self, member): + return self.parent_dest.get_ref(self.member) + "." + member + +# Note: during parsing, byte_size types have been converted to count during validation +def read_array_len(writer, prefix, array, dest, scope, is_ptr): + if is_ptr: + nelements = "%s__array__nelements" % prefix + else: + nelements = "%s__nelements" % prefix + if dest.is_toplevel() and scope.variable_defined(nelements): + return nelements # Already there for toplevel, need not recalculate + element_type = array.element_type + scope.variable_def("uint32_t", nelements) + if array.is_constant_length(): + writer.assign(nelements, array.size) + elif array.is_identifier_length(): + writer.assign(nelements, dest.get_ref(array.size)) + elif array.is_remaining_length(): + if element_type.is_fixed_nw_size(): + writer.assign(nelements, "(message_end - in) / (%s)" %(element_type.get_fixed_nw_size())) + else: + raise NotImplementedError("TODO array[] of dynamic element size not done yet") + elif array.is_image_size_length(): + bpp = array.size[1] + width = array.size[2] + rows = array.size[3] + width_v = dest.get_ref(width) + rows_v = dest.get_ref(rows) + # TODO: Handle multiplication overflow + if bpp == 8: + writer.assign(nelements, "%s * %s" % (width_v, rows_v)) + elif bpp == 1: + writer.assign(nelements, "((%s + 7) / 8 ) * %s" % (width_v, rows_v)) + else: + writer.assign(nelements, "((%s * %s + 7) / 8 ) * %s" % (bpp, width_v, rows_v)) + elif array.is_bytes_length(): + writer.assign(nelements, dest.get_ref(array.size[2])) + else: + raise NotImplementedError("TODO array size type not handled yet") + return nelements + +def write_switch_parser(writer, container, switch, dest, scope): + var = container.lookup_member(switch.variable) + var_type = var.member_type + + if switch.has_attr("fixedsize"): + scope.variable_def("uint8_t *", "in_save") + writer.assign("in_save", "in") + + first = True + for c in switch.cases: + check = c.get_check(dest.get_ref(switch.variable), var_type) + m = c.member + with writer.if_block(check, not first, False) as block: + t = m.member_type + if switch.has_end_attr(): + dest2 = dest.child_at_end(writer, m.member_type) + elif switch.has_attr("anon"): + if t.is_struct() and not m.has_attr("to_ptr"): + dest2 = dest.child_sub(m.name) + else: + dest2 = dest + else: + if t.is_struct(): + dest2 = dest.child_sub(switch.name + "." + m.name) + else: + dest2 = dest.child_sub(switch.name) + dest2.reuse_scope = block + + if m.has_attr("to_ptr"): + write_parse_to_pointer(writer, t, False, dest2, m.name, block) + elif t.is_pointer(): + write_parse_pointer(writer, t, False, dest2, m.name, block) + elif t.is_struct(): + write_container_parser(writer, t, dest2) + elif t.is_primitive(): + if m.has_attr("zero"): + writer.statement("consume_%s(&in)" % (t.primitive_type())) + else: + writer.assign(dest2.get_ref(m.name), "consume_%s(&in)" % (t.primitive_type())) + #TODO validate e.g. flags and enums + elif t.is_array(): + nelements = read_array_len(writer, m.name, t, dest, block, False) + write_array_parser(writer, m, nelements, t, dest2, block) + else: + writer.todo("Can't handle type %s" % m.member_type) + + first = False + + writer.newline() + + if switch.has_attr("fixedsize"): + writer.assign("in", "in_save + %s" % switch.get_fixed_nw_size()) + +def write_parse_ptr_function(writer, target_type): + if target_type.is_array(): + parse_function = "parse_array_%s" % target_type.element_type.primitive_type() + else: + parse_function = "parse_struct_%s" % target_type.c_type() + if writer.is_generated("parser", parse_function): + return parse_function + + writer.set_is_generated("parser", parse_function) + + writer = writer.function_helper() + scope = writer.function(parse_function, "static uint8_t *", "uint8_t *message_start, uint8_t *message_end, uint8_t *struct_data, PointerInfo *this_ptr_info, int minor") + scope.variable_def("uint8_t *", "in = message_start + this_ptr_info->offset") + scope.variable_def("uint8_t *", "end") + + num_pointers = target_type.get_num_pointers() + if num_pointers != 0: + scope.variable_def("SPICE_GNUC_UNUSED intptr_t", "ptr_size") + scope.variable_def("uint32_t", "n_ptr=0") + scope.variable_def("PointerInfo", "ptr_info[%s]" % num_pointers) + + writer.newline() + if target_type.is_array(): + writer.assign("end", "struct_data") + else: + writer.assign("end", "struct_data + %s" % (target_type.sizeof())) + + dest = RootDemarshallingDestination(None, target_type.c_type(), target_type.sizeof(), "struct_data") + dest.is_helper = True + dest.reuse_scope = scope + if target_type.is_array(): + write_array_parser(writer, None, "this_ptr_info->nelements", target_type, dest, scope) + else: + write_container_parser(writer, target_type, dest) + + if num_pointers != 0: + write_ptr_info_check(writer) + + writer.statement("return end") + + if writer.has_error_check: + writer.newline() + writer.label("error") + writer.statement("return NULL") + + writer.end_block() + + return parse_function + +def write_array_parser(writer, member, nelements, array, dest, scope): + is_byte_size = array.is_bytes_length() + + element_type = array.element_type + if member: + array_start = dest.get_ref(member.name) + at_end = member.has_attr("end") + else: + array_start = "end" + at_end = True + + if element_type == ptypes.uint8 or element_type == ptypes.int8: + writer.statement("memcpy(%s, in, %s)" % (array_start, nelements)) + writer.increment("in", nelements) + if at_end: + writer.increment("end", nelements) + else: + with writer.index() as index: + if member: + array_pos = "%s[%s]" % (array_start, index) + else: + array_pos = "*(%s *)end" % (element_type.c_type()) + + if array.has_attr("ptr_array"): + scope.variable_def("void **", "ptr_array") + scope.variable_def("int", "ptr_array_index") + writer.assign("ptr_array_index", 0) + writer.assign("ptr_array", "(void **)%s" % array_start) + writer.increment("end", "sizeof(void *) * %s" % nelements) + array_start = "end" + array_pos = "*(%s *)end" % (element_type.c_type()) + at_end = True + + with writer.for_loop(index, nelements) as array_scope: + if array.has_attr("ptr_array"): + writer.statement("ptr_array[ptr_array_index++] = end") + if element_type.is_primitive(): + writer.statement("%s = consume_%s(&in)" % (array_pos, element_type.primitive_type())) + if at_end: + writer.increment("end", element_type.sizeof()) + else: + if at_end: + dest2 = dest.child_at_end(writer, element_type) + else: + dest2 = RootDemarshallingDestination(dest, element_type.c_type(), element_type.c_type(), array_pos) + dest2.reuse_scope = array_scope + write_container_parser(writer, element_type, dest2) + if array.has_attr("ptr_array"): + writer.comment("Align ptr_array element to 4 bytes").newline() + writer.assign("end", "(uint8_t *)SPICE_ALIGN((size_t)end, 4)") + +def write_parse_pointer_core(writer, target_type, offset, at_end, dest, member_name, scope): + writer.assign("ptr_info[n_ptr].offset", offset) + writer.assign("ptr_info[n_ptr].parse", write_parse_ptr_function(writer, target_type)) + if at_end: + writer.assign("ptr_info[n_ptr].dest", "(void **)end") + writer.increment("end", "sizeof(void *)") + else: + writer.assign("ptr_info[n_ptr].dest", "(void **)&%s" % dest.get_ref(member_name)) + if target_type.is_array(): + nelements = read_array_len(writer, member_name, target_type, dest, scope, True) + writer.assign("ptr_info[n_ptr].nelements", nelements) + + writer.statement("n_ptr++") + +def write_parse_pointer(writer, t, at_end, dest, member_name, scope): + write_parse_pointer_core(writer, t.target_type, "consume_%s(&in)" % t.primitive_type(), + at_end, dest, member_name, scope) + +def write_parse_to_pointer(writer, t, at_end, dest, member_name, scope): + write_parse_pointer_core(writer, t, "in - start", + at_end, dest, member_name, scope) + writer.increment("in", "%s__saved_size" % member_name) + +def write_member_parser(writer, container, member, dest, scope): + if member.has_attr("virtual"): + writer.assign(dest.get_ref(member.name), member.attributes["virtual"][0]) + return + + if member.is_switch(): + write_switch_parser(writer, container, member, dest, scope) + return + + t = member.member_type + + if member.has_attr("to_ptr"): + write_parse_to_pointer(writer, t, member.has_end_attr(), dest, member.name, scope) + elif t.is_pointer(): + if member.has_attr("chunk"): + assert(t.target_type.is_array()) + nelements = read_array_len(writer, member.name, t.target_type, dest, scope, True) + writer.comment("Reuse data from network message as chunk").newline() + scope.variable_def("SpiceChunks *", "chunks") + writer.assign("chunks", "(SpiceChunks *)end") + writer.increment("end", "sizeof(SpiceChunks) + sizeof(SpiceChunk)") + writer.assign(dest.get_ref(member.name), "chunks") + writer.assign("chunks->data_size", nelements) + writer.assign("chunks->flags", 0) + writer.assign("chunks->num_chunks", 1) + writer.assign("chunks->chunk[0].len", nelements) + writer.assign("chunks->chunk[0].data", "message_start + consume_%s(&in)" % t.primitive_type()) + elif member.has_attr("nocopy"): + writer.comment("Reuse data from network message").newline() + writer.assign(dest.get_ref(member.name), "(size_t)(message_start + consume_%s(&in))" % t.primitive_type()) + else: + write_parse_pointer(writer, t, member.has_end_attr(), dest, member.name, scope) + elif t.is_primitive(): + if member.has_attr("zero"): + writer.statement("consume_%s(&in)" % t.primitive_type()) + elif member.has_end_attr(): + writer.statement("*(%s *)end = consume_%s(&in)" % (t.c_type(), t.primitive_type())) + writer.increment("end", t.sizeof()) + else: + if member.has_attr("bytes_count"): + dest_var = dest.get_ref(member.attributes["bytes_count"][0]) + else: + dest_var = dest.get_ref(member.name) + writer.assign(dest_var, "consume_%s(&in)" % (t.primitive_type())) + #TODO validate e.g. flags and enums + elif t.is_array(): + nelements = read_array_len(writer, member.name, t, dest, scope, False) + if member.has_attr("chunk") and t.element_type.is_fixed_nw_size() and t.element_type.get_fixed_nw_size() == 1: + writer.comment("use array as chunk").newline() + + scope.variable_def("SpiceChunks *", "chunks") + writer.assign("chunks", "(SpiceChunks *)end") + writer.increment("end", "sizeof(SpiceChunks) + sizeof(SpiceChunk)") + writer.assign(dest.get_ref(member.name), "chunks") + writer.assign("chunks->data_size", nelements) + writer.assign("chunks->flags", 0) + writer.assign("chunks->num_chunks", 1) + writer.assign("chunks->chunk[0].len", nelements) + writer.assign("chunks->chunk[0].data", "in") + writer.increment("in", "%s" % (nelements)) + elif member.has_attr("as_ptr") and t.element_type.is_fixed_nw_size(): + writer.comment("use array as pointer").newline() + writer.assign(dest.get_ref(member.name), "(%s *)in" % t.element_type.c_type()) + len_var = member.attributes["as_ptr"] + if len(len_var) > 0: + writer.assign(dest.get_ref(len_var[0]), nelements) + el_size = t.element_type.get_fixed_nw_size() + if el_size != 1: + writer.increment("in", "%s * %s" % (nelements, el_size)) + else: + writer.increment("in", "%s" % (nelements)) + else: + write_array_parser(writer, member, nelements, t, dest, scope) + elif t.is_struct(): + if member.has_end_attr(): + dest2 = dest.child_at_end(writer, t) + else: + dest2 = dest.child_sub(member.name) + writer.comment(member.name) + write_container_parser(writer, t, dest2) + else: + raise NotImplementedError("TODO can't handle parsing of %s" % t) + +def write_container_parser(writer, container, dest): + with dest.declare(writer) as scope: + for m in container.members: + if m.has_minor_attr(): + writer.begin_block("if (minor >= %s)" % m.get_minor_attr()) + write_member_parser(writer, container, m, dest, scope) + if m.has_minor_attr(): + # We need to zero out the fixed part of all optional fields + if not m.member_type.is_array(): + writer.end_block(newline=False) + writer.begin_block(" else") + # TODO: This is not right for fields that don't exist in the struct + if m.has_attr("zero"): + pass + elif m.member_type.is_primitive(): + writer.assign(dest.get_ref(m.name), "0") + elif m.is_fixed_sizeof(): + writer.statement("memset ((char *)&%s, 0, %s)" % (dest.get_ref(m.name), m.sizeof())) + else: + raise NotImplementedError("TODO Clear optional dynamic fields") + writer.end_block() + +def write_ptr_info_check(writer): + writer.newline() + with writer.index() as index: + with writer.for_loop(index, "n_ptr") as scope: + offset = "ptr_info[%s].offset" % index + function = "ptr_info[%s].parse" % index + dest = "ptr_info[%s].dest" % index + with writer.if_block("%s == 0" % offset, newline=False): + writer.assign("*%s" % dest, "NULL") + with writer.block(" else"): + writer.comment("Align to 32 bit").newline() + writer.assign("end", "(uint8_t *)SPICE_ALIGN((size_t)end, 4)") + writer.assign("*%s" % dest, "(void *)end") + writer.assign("end", "%s(message_start, message_end, end, &ptr_info[%s], minor)" % (function, index)) + writer.error_check("end == NULL") + writer.newline() + +def write_nofree(writer): + if writer.is_generated("helper", "nofree"): + return + writer = writer.function_helper() + scope = writer.function("nofree", "static void", "uint8_t *data") + writer.end_block() + +def write_msg_parser(writer, message): + msg_name = message.c_name() + function_name = "parse_%s" % msg_name + if writer.is_generated("demarshaller", function_name): + return function_name + writer.set_is_generated("demarshaller", function_name) + + msg_type = message.c_type() + msg_sizeof = message.sizeof() + + want_mem_size = (len(message.members) != 1 or message.members[0].is_fixed_nw_size() + or not message.members[0].is_array()) + + writer.newline() + if message.has_attr("ifdef"): + writer.ifdef(message.attributes["ifdef"][0]) + parent_scope = writer.function(function_name, + "uint8_t *", + "uint8_t *message_start, uint8_t *message_end, int minor, size_t *size, message_destructor_t *free_message", True) + parent_scope.variable_def("SPICE_GNUC_UNUSED uint8_t *", "pos") + parent_scope.variable_def("uint8_t *", "start = message_start") + parent_scope.variable_def("uint8_t *", "data = NULL") + parent_scope.variable_def("size_t", "nw_size") + if want_mem_size: + parent_scope.variable_def("size_t", "mem_size") + if not message.has_attr("nocopy"): + parent_scope.variable_def("uint8_t *", "in", "end") + num_pointers = message.get_num_pointers() + if num_pointers != 0: + parent_scope.variable_def("SPICE_GNUC_UNUSED intptr_t", "ptr_size") + parent_scope.variable_def("uint32_t", "n_ptr=0") + parent_scope.variable_def("PointerInfo", "ptr_info[%s]" % num_pointers) + writer.newline() + + write_parser_helpers(writer) + + write_validate_container(writer, None, message, "start", parent_scope, True, + want_mem_size=want_mem_size, want_extra_size=False) + + writer.newline() + + writer.comment("Check if message fits in reported side").newline() + with writer.block("if (start + nw_size > message_end)"): + writer.statement("return NULL") + + writer.newline().comment("Validated extents and calculated size").newline() + + if message.has_attr("nocopy"): + write_nofree(writer) + writer.assign("data", "message_start") + writer.assign("*size", "message_end - message_start") + writer.assign("*free_message", "nofree") + else: + writer.assign("data", "(uint8_t *)malloc(mem_size)") + writer.error_check("data == NULL") + writer.assign("end", "data + %s" % (msg_sizeof)) + writer.assign("in", "start").newline() + + # avoid defined and assigned but not used warnings of gcc 4.6.0+ + if message.is_extra_size() or not message.is_fixed_nw_size() or message.get_fixed_nw_size() > 0: + dest = RootDemarshallingDestination(None, msg_type, msg_sizeof, "data") + dest.reuse_scope = parent_scope + write_container_parser(writer, message, dest) + + writer.newline() + writer.statement("assert(in <= message_end)") + + if num_pointers != 0: + write_ptr_info_check(writer) + + writer.statement("assert(end <= data + mem_size)") + + writer.newline() + writer.assign("*size", "end - data") + writer.assign("*free_message", "(message_destructor_t) free") + + writer.statement("return data") + writer.newline() + if writer.has_error_check: + writer.label("error") + with writer.block("if (data != NULL)"): + writer.statement("free(data)") + writer.statement("return NULL") + writer.end_block() + + if message.has_attr("ifdef"): + writer.endif(message.attributes["ifdef"][0]) + + return function_name + +def write_channel_parser(writer, channel, server): + writer.newline() + ids = {} + min_id = 1000000 + if server: + messages = channel.server_messages + else: + messages = channel.client_messages + for m in messages: + ids[m.value] = m + + ranges = [] + ids2 = ids.copy() + while len(ids2) > 0: + end = start = min(ids2.keys()) + while ids2.has_key(end): + del ids2[end] + end = end + 1 + + ranges.append( (start, end) ) + + if server: + function_name = "parse_%s_msg" % channel.name + else: + function_name = "parse_%s_msgc" % channel.name + writer.newline() + if channel.has_attr("ifdef"): + writer.ifdef(channel.attributes["ifdef"][0]) + scope = writer.function(function_name, + "static uint8_t *", + "uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message") + + helpers = writer.function_helper() + + d = 0 + for r in ranges: + d = d + 1 + writer.write("static parse_msg_func_t funcs%d[%d] = " % (d, r[1] - r[0])) + writer.begin_block() + for i in range(r[0], r[1]): + func = write_msg_parser(helpers, ids[i].message_type) + writer.write(func) + if i != r[1] -1: + writer.write(",") + writer.newline() + + writer.end_block(semicolon = True) + + d = 0 + for r in ranges: + d = d + 1 + with writer.if_block("message_type >= %d && message_type < %d" % (r[0], r[1]), d > 1, False): + writer.statement("return funcs%d[message_type-%d](message_start, message_end, minor, size_out, free_message)" % (d, r[0])) + writer.newline() + + writer.statement("return NULL") + writer.end_block() + if channel.has_attr("ifdef"): + writer.endif(channel.attributes["ifdef"][0]) + + return function_name + +def write_get_channel_parser(writer, channel_parsers, max_channel, is_server): + writer.newline() + if is_server: + function_name = "spice_get_server_channel_parser" + writer.public_prefix + else: + function_name = "spice_get_client_channel_parser" + writer.public_prefix + + scope = writer.function(function_name, + "spice_parse_channel_func_t", + "uint32_t channel, unsigned int *max_message_type") + + writer.write("static struct {spice_parse_channel_func_t func; unsigned int max_messages; } channels[%d] = " % (max_channel+1)) + writer.begin_block() + channel = None + for i in range(0, max_channel + 1): + if channel_parsers.has_key(i): + channel = channel_parsers[i][0] + if channel.has_attr("ifdef"): + writer.ifdef(channel.attributes["ifdef"][0]) + writer.write("{ ") + writer.write(channel_parsers[i][1]) + writer.write(", ") + + max_msg = 0 + if is_server: + messages = channel.server_messages + else: + messages = channel.client_messages + for m in messages: + max_msg = max(max_msg, m.value) + writer.write(max_msg) + writer.write("}") + else: + writer.write("{ NULL, 0 }") + + if i != max_channel: + writer.write(",") + writer.newline() + if channel and channel.has_attr("ifdef"): + writer.ifdef_else(channel.attributes["ifdef"][0]) + writer.write("{ NULL, 0 }") + if i != max_channel: + writer.write(",") + writer.newline() + writer.endif(channel.attributes["ifdef"][0]) + writer.end_block(semicolon = True) + + with writer.if_block("channel < %d" % (max_channel + 1)): + with writer.if_block("max_message_type != NULL"): + writer.assign("*max_message_type", "channels[channel].max_messages") + writer.statement("return channels[channel].func") + + writer.statement("return NULL") + writer.end_block() + + +def write_full_protocol_parser(writer, is_server): + writer.newline() + if is_server: + function_name = "spice_parse_msg" + else: + function_name = "spice_parse_reply" + scope = writer.function(function_name + writer.public_prefix, + "uint8_t *", + "uint8_t *message_start, uint8_t *message_end, uint32_t channel, uint16_t message_type, int minor, size_t *size_out, message_destructor_t *free_message") + scope.variable_def("spice_parse_channel_func_t", "func" ) + + if is_server: + writer.assign("func", "spice_get_server_channel_parser%s(channel, NULL)" % writer.public_prefix) + else: + writer.assign("func", "spice_get_client_channel_parser%s(channel, NULL)" % writer.public_prefix) + + with writer.if_block("func != NULL"): + writer.statement("return func(message_start, message_end, message_type, minor, size_out, free_message)") + + writer.statement("return NULL") + writer.end_block() + +def write_protocol_parser(writer, proto, is_server): + max_channel = 0 + parsers = {} + + for channel in proto.channels: + max_channel = max(max_channel, channel.value) + + parsers[channel.value] = (channel.channel_type, write_channel_parser(writer, channel.channel_type, is_server)) + + write_get_channel_parser(writer, parsers, max_channel, is_server) + write_full_protocol_parser(writer, is_server) + +def write_includes(writer): + writer.writeln("#include ") + writer.writeln("#include ") + writer.writeln("#include ") + writer.writeln("#include ") + writer.writeln("#include ") + writer.writeln("#include ") + writer.writeln('#include "mem.h"') + writer.newline() + writer.writeln("#ifdef _MSC_VER") + writer.writeln("#pragma warning(disable:4101)") + writer.writeln("#endif") diff -Nru spice-gtk-0.9/spice-common/python_modules/Makefile.am spice-gtk-0.12/spice-common/python_modules/Makefile.am --- spice-gtk-0.9/spice-common/python_modules/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/python_modules/Makefile.am 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,16 @@ +NULL = + +PYTHON_MODULES = \ + __init__.py \ + codegen.py \ + demarshal.py \ + marshal.py \ + ptypes.py \ + spice_parser.py \ + $(NULL) + +EXTRA_DIST = $(PYTHON_MODULES) + +DISTCLEANFILES = *.pyc + +-include $(top_srcdir)/git.mk diff -Nru spice-gtk-0.9/spice-common/python_modules/Makefile.in spice-gtk-0.12/spice-common/python_modules/Makefile.in --- spice-gtk-0.9/spice-common/python_modules/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/python_modules/Makefile.in 2012-04-24 11:20:55.000000000 +0000 @@ -0,0 +1,393 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = python_modules +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PROTOCOL_CFLAGS = @PROTOCOL_CFLAGS@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SMARTCARD_CFLAGS = @SMARTCARD_CFLAGS@ +SMARTCARD_LIBS = @SMARTCARD_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +PYTHON_MODULES = \ + __init__.py \ + codegen.py \ + demarshal.py \ + marshal.py \ + ptypes.py \ + spice_parser.py \ + $(NULL) + +EXTRA_DIST = $(PYTHON_MODULES) +DISTCLEANFILES = *.pyc +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign python_modules/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign python_modules/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am + + +-include $(top_srcdir)/git.mk + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru spice-gtk-0.9/spice-common/python_modules/marshal.py spice-gtk-0.12/spice-common/python_modules/marshal.py --- spice-gtk-0.9/spice-common/python_modules/marshal.py 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/python_modules/marshal.py 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,427 @@ +from __future__ import with_statement +import ptypes +import codegen + +def write_includes(writer): + writer.header.writeln("#include ") + writer.header.writeln('#include "marshaller.h"') + writer.header.newline() + writer.header.writeln("#ifndef _GENERATED_HEADERS_H") + writer.header.writeln("#define _GENERATED_HEADERS_H") + + writer.writeln("#include ") + writer.writeln("#include ") + writer.writeln("#include ") + writer.writeln("#include ") + writer.writeln("#include ") + writer.writeln("#include ") + writer.writeln('#include "marshaller.h"') + writer.newline() + writer.writeln("#ifdef _MSC_VER") + writer.writeln("#pragma warning(disable:4101)") + writer.writeln("#pragma warning(disable:4018)") + writer.writeln("#endif") + writer.newline() + +class MarshallingSource: + def __init__(self): + pass + + def child_at_end(self, t): + return RootMarshallingSource(self, t.c_type(), t.sizeof()) + + def child_sub(self, containee): + return SubMarshallingSource(self, containee) + + def declare(self, writer): + return writer.optional_block(self.reuse_scope) + + def is_toplevel(self): + return self.parent_src == None and not self.is_helper + +class RootMarshallingSource(MarshallingSource): + def __init__(self, parent_src, c_type, sizeof, pointer = None): + self.is_helper = False + self.reuse_scope = None + self.parent_src = parent_src + if parent_src: + self.base_var = codegen.increment_identifier(parent_src.base_var) + else: + self.base_var = "src" + self.c_type = c_type + self.sizeof = sizeof + self.pointer = pointer + assert pointer != None + + def get_self_ref(self): + return self.base_var + + def get_ref(self, member): + return self.base_var + "->" + member + + def declare(self, writer): + if self.reuse_scope: + scope = self.reuse_scope + else: + writer.begin_block() + scope = writer.get_subwriter() + + scope.variable_def(self.c_type + " *", self.base_var) + if not self.reuse_scope: + scope.newline() + + writer.assign(self.base_var, "(%s *)%s" % (self.c_type, self.pointer)) + writer.newline() + + if self.reuse_scope: + return writer.no_block(self.reuse_scope) + else: + return writer.partial_block(scope) + +class SubMarshallingSource(MarshallingSource): + def __init__(self, parent_src, containee): + self.reuse_scope = None + self.parent_src = parent_src + self.base_var = parent_src.base_var + self.containee = containee + self.name = containee.name + self.is_helper = False + + def get_self_ref(self): + if self.containee.has_attr("to_ptr"): + return "%s" % self.parent_src.get_ref(self.name) + else: + return "&%s" % self.parent_src.get_ref(self.name) + + def get_ref(self, member): + if self.containee.has_attr("to_ptr"): + return self.parent_src.get_ref(self.name) + "->" + member + else: + return self.parent_src.get_ref(self.name) + "." + member + +def write_marshal_ptr_function(writer, target_type, is_helper=True): + if target_type.is_array(): + marshal_function = "spice_marshall_array_%s" % target_type.element_type.primitive_type() + else: + marshal_function = "spice_marshall_%s" % target_type.name + if writer.is_generated("marshaller", marshal_function): + return marshal_function + + writer.set_is_generated("marshaller", marshal_function) + + names = target_type.get_pointer_names(False) + names_args = "" + if len(names) > 0: + n = map(lambda name: ", SpiceMarshaller **%s_out" % name, names) + names_args = "".join(n) + + header = writer.header + if is_helper: + writer = writer.function_helper() + writer.header = header + writer.out_prefix = "" + if target_type.is_array(): + scope = writer.function(marshal_function, "SPICE_GNUC_UNUSED static void", "SpiceMarshaller *m, %s_t *ptr, unsigned count" % target_type.element_type.primitive_type() + names_args) + else: + scope = writer.function(marshal_function, "void", "SpiceMarshaller *m, %s *ptr" % target_type.c_type() + names_args) + header.writeln("void " + marshal_function + "(SpiceMarshaller *m, %s *msg" % target_type.c_type() + names_args + ");") + scope.variable_def("SPICE_GNUC_UNUSED SpiceMarshaller *", "m2") + + for n in names: + writer.assign("*%s_out" % n, "NULL") + + writer.newline() + + if target_type.is_struct(): + src = RootMarshallingSource(None, target_type.c_type(), target_type.sizeof(), "ptr") + src.reuse_scope = scope + write_container_marshaller(writer, target_type, src) + elif target_type.is_array() and target_type.element_type.is_primitive(): + with writer.index() as index: + with writer.for_loop(index, "count") as array_scope: + writer.statement("spice_marshaller_add_%s(m, *ptr++)" % (target_type.element_type.primitive_type())) + else: + writer.todo("Unsuppored pointer marshaller type") + + writer.end_block() + + return marshal_function + +def get_array_size(array, container_src): + if array.is_constant_length(): + return array.size + elif array.is_identifier_length(): + return container_src.get_ref(array.size) + elif array.is_remaining_length(): + raise NotImplementedError("remaining size array sizes marshalling not supported") + elif array.is_image_size_length(): + bpp = array.size[1] + width = array.size[2] + rows = array.size[3] + width_v = container_src.get_ref(width) + rows_v = container_src.get_ref(rows) + # TODO: Handle multiplication overflow + if bpp == 8: + return "(%s * %s)" % (width_v, rows_v) + elif bpp == 1: + return "(((%s + 7) / 8 ) * %s)" % (width_v, rows_v) + else: + return "(((%s * %s + 7) / 8 ) * %s)" % (bpp, width_v, rows_v) + elif array.is_bytes_length(): + return container_src.get_ref(array.size[2]) + else: + raise NotImplementedError("TODO array size type not handled yet: %s" % array) + +def write_array_marshaller(writer, member, array, container_src, scope): + element_type = array.element_type + + if array.is_remaining_length(): + writer.comment("Remaining data must be appended manually").newline() + return + + nelements = get_array_size(array, container_src) + is_byte_size = array.is_bytes_length() + + element = "%s__element" % member.name + + if not scope.variable_defined(element): + if array.has_attr("ptr_array"): + stars = " **" + else: + stars = " *" + scope.variable_def(element_type.c_type() + stars, element) + element_array = element + if array.has_attr("ptr_array"): + element = "*" + element + + writer.assign(element_array, container_src.get_ref(member.name)) + + if is_byte_size: + size_start_var = "%s__size_start" % member.name + scope.variable_def("size_t", size_start_var) + writer.assign(size_start_var, "spice_marshaller_get_size(m)") + + with writer.index() as index: + with writer.for_loop(index, nelements) as array_scope: + if element_type.is_primitive(): + writer.statement("spice_marshaller_add_%s(m, *%s)" % (element_type.primitive_type(), element)) + elif element_type.is_struct(): + src2 = RootMarshallingSource(container_src, element_type.c_type(), element_type.sizeof(), element) + src2.reuse_scope = array_scope + write_container_marshaller(writer, element_type, src2) + else: + writer.todo("array element unhandled type").newline() + + writer.statement("%s++" % element_array) + + if is_byte_size: + size_var = member.container.lookup_member(array.size[1]) + size_var_type = size_var.member_type + var = "%s__ref" % array.size[1] + writer.statement("spice_marshaller_set_%s(m, %s, spice_marshaller_get_size(m) - %s)" % (size_var_type.primitive_type(), var, size_start_var)) + +def write_pointer_marshaller(writer, member, src): + t = member.member_type + ptr_func = write_marshal_ptr_function(writer, t.target_type) + submarshaller = "spice_marshaller_get_ptr_submarshaller(m, %d)" % (1 if member.get_fixed_nw_size() == 8 else 0) + if member.has_attr("marshall"): + rest_args = "" + if t.target_type.is_array(): + rest_args = ", %s" % get_array_size(t.target_type, src) + writer.assign("m2", submarshaller) + if t.has_attr("nonnull"): + writer.statement("%s(m2, %s%s)" % (ptr_func, src.get_ref(member.name), rest_args)) + else: + with writer.if_block("%s != NULL" % src.get_ref(member.name)) as block: + writer.statement("%s(m2, %s%s)" % (ptr_func, src.get_ref(member.name), rest_args)) + else: + writer.assign("*%s_out" % (writer.out_prefix + member.name), submarshaller) + +def write_switch_marshaller(writer, container, switch, src, scope): + var = container.lookup_member(switch.variable) + var_type = var.member_type + + saved_out_prefix = writer.out_prefix + first = True + for c in switch.cases: + check = c.get_check(src.get_ref(switch.variable), var_type) + m = c.member + writer.out_prefix = saved_out_prefix + if m.has_attr("outvar"): + writer.out_prefix = "%s_%s" % (m.attributes["outvar"][0], writer.out_prefix) + with writer.if_block(check, not first, False) as block: + t = m.member_type + if switch.has_attr("anon"): + if t.is_struct(): + src2 = src.child_sub(m) + else: + src2 = src + else: + if t.is_struct(): + src2 = src.child_sub(switch).child_sub(m) + else: + src2 = src.child_sub(switch) + src2.reuse_scope = block + + if t.is_struct(): + write_container_marshaller(writer, t, src2) + elif t.is_pointer(): + write_pointer_marshaller(writer, m, src2) + elif t.is_primitive(): + if m.has_attr("zero"): + writer.statement("spice_marshaller_add_%s(m, 0)" % (t.primitive_type())) + else: + writer.statement("spice_marshaller_add_%s(m, %s)" % (t.primitive_type(), src2.get_ref(m.name))) + #TODO validate e.g. flags and enums + elif t.is_array(): + write_array_marshaller(writer, m, t, src2, scope) + else: + writer.todo("Can't handle type %s" % m.member_type) + + if switch.has_attr("fixedsize"): + remaining = switch.get_fixed_nw_size() - t.get_fixed_nw_size() + if remaining != 0: + writer.statement("spice_marshaller_reserve_space(m, %s)" % remaining) + + first = False + if switch.has_attr("fixedsize"): + with writer.block(" else"): + writer.statement("spice_marshaller_reserve_space(m, %s)" % switch.get_fixed_nw_size()) + + writer.newline() + +def write_member_marshaller(writer, container, member, src, scope): + if member.has_attr("outvar"): + writer.out_prefix = "%s_%s" % (member.attributes["outvar"][0], writer.out_prefix) + if member.has_attr("virtual"): + writer.comment("Don't marshall @virtual %s" % member.name).newline() + return + if member.has_attr("nomarshal"): + writer.comment("Don't marshall @nomarshal %s" % member.name).newline() + return + if member.is_switch(): + write_switch_marshaller(writer, container, member, src, scope) + return + + t = member.member_type + + if t.is_pointer(): + write_pointer_marshaller(writer, member, src) + elif t.is_primitive(): + if member.has_attr("zero"): + writer.statement("spice_marshaller_add_%s(m, 0)" % (t.primitive_type())) + if member.has_attr("bytes_count"): + var = "%s__ref" % member.name + scope.variable_def("void *", var) + writer.statement("%s = spice_marshaller_add_%s(m, %s)" % (var, t.primitive_type(), 0)) + + else: + writer.statement("spice_marshaller_add_%s(m, %s)" % (t.primitive_type(), src.get_ref(member.name))) + elif t.is_array(): + write_array_marshaller(writer, member, t, src, scope) + elif t.is_struct(): + src2 = src.child_sub(member) + writer.comment(member.name) + write_container_marshaller(writer, t, src2) + else: + raise NotImplementedError("TODO can't handle parsing of %s" % t) + +def write_container_marshaller(writer, container, src): + saved_out_prefix = writer.out_prefix + with src.declare(writer) as scope: + for m in container.members: + writer.out_prefix = saved_out_prefix + write_member_marshaller(writer, container, m, src, scope) + +def write_message_marshaller(writer, message, is_server, private): + if message.has_attr("ifdef"): + writer.ifdef(message.attributes["ifdef"][0]) + writer.out_prefix = "" + function_name = "spice_marshall_" + message.c_name() + if writer.is_generated("marshaller", function_name): + return function_name + writer.set_is_generated("marshaller", function_name) + + names = message.get_pointer_names(False) + names_args = "" + if len(names) > 0: + n = map(lambda name: ", SpiceMarshaller **%s_out" % name, names) + names_args = "".join(n) + + if not private: + writer.header.writeln("void " + function_name + "(SpiceMarshaller *m, %s *msg" % message.c_type() + names_args + ");") + + scope = writer.function(function_name, + "static void" if private else "void", + "SpiceMarshaller *m, %s *msg" % message.c_type() + names_args) + scope.variable_def("SPICE_GNUC_UNUSED SpiceMarshaller *", "m2") + + for n in names: + writer.assign("*%s_out" % n, "NULL") + + # fix warnings about unused variables by not creating body if no members to parse + if any(x.is_fixed_nw_size() for x in message.members): + src = RootMarshallingSource(None, message.c_type(), message.sizeof(), "msg") + src.reuse_scope = scope + + write_container_marshaller(writer, message, src) + + writer.end_block() + if message.has_attr("ifdef"): + writer.endif(message.attributes["ifdef"][0]) + writer.newline() + return function_name + +def write_protocol_marshaller(writer, proto, is_server, private_marshallers): + functions = {} + for c in proto.channels: + channel = c.channel_type + if channel.has_attr("ifdef"): + writer.ifdef(channel.attributes["ifdef"][0]) + writer.header.ifdef(channel.attributes["ifdef"][0]) + if is_server: + for m in channel.client_messages: + message = m.message_type + f = write_message_marshaller(writer, message, is_server, private_marshallers) + if channel.has_attr("ifdef") and not functions.has_key(f): + functions[f] = channel.attributes["ifdef"][0] + elif message.has_attr("ifdef") and not functions.has_key(f): + functions[f] = message.attributes["ifdef"][0] + else: + functions[f] = True + else: + for m in channel.server_messages: + message = m.message_type + f = write_message_marshaller(writer, message, is_server, private_marshallers) + if channel.has_attr("ifdef") and not functions.has_key(f): + functions[f] = channel.attributes["ifdef"][0] + elif message.has_attr("ifdef") and not functions.has_key(f): + functions[f] = message.attributes["ifdef"][0] + else: + functions[f] = True + if channel.has_attr("ifdef"): + writer.endif(channel.attributes["ifdef"][0]) + writer.header.endif(channel.attributes["ifdef"][0]) + + if private_marshallers: + scope = writer.function("spice_message_marshallers_get" + writer.public_prefix, + "SpiceMessageMarshallers *", + "void") + writer.writeln("static SpiceMessageMarshallers marshallers = {NULL};").newline() + for f in sorted(functions.keys()): + member = f[len("spice_marshall_"):] + if not member.startswith("msg"): + member = "msg_" + member + if functions[f] != True: + writer.ifdef(functions[f]) + writer.assign("marshallers.%s" % member, f) + if functions[f] != True: + writer.endif(functions[f]) + + writer.newline() + writer.statement("return &marshallers") + writer.end_block() + writer.newline() + +def write_trailer(writer): + writer.header.writeln("#endif") diff -Nru spice-gtk-0.9/spice-common/python_modules/ptypes.py spice-gtk-0.12/spice-common/python_modules/ptypes.py --- spice-gtk-0.9/spice-common/python_modules/ptypes.py 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/python_modules/ptypes.py 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,1044 @@ +import codegen +import types + +_types_by_name = {} +_types = [] + +default_pointer_size = 4 + +def type_exists(name): + return _types_by_name.has_key(name) + +def lookup_type(name): + return _types_by_name[name] + +def get_named_types(): + return _types + +class FixedSize: + def __init__(self, val = 0, minor = 0): + if isinstance(val, FixedSize): + self.vals = val.vals + else: + self.vals = [0] * (minor + 1) + self.vals[minor] = val + + def __add__(self, other): + if isinstance(other, types.IntType): + other = FixedSize(other) + + new = FixedSize() + l = max(len(self.vals), len(other.vals)) + shared = min(len(self.vals), len(other.vals)) + + new.vals = [0] * l + + for i in range(shared): + new.vals[i] = self.vals[i] + other.vals[i] + + for i in range(shared,len(self.vals)): + new.vals[i] = self.vals[i] + + for i in range(shared,len(other.vals)): + new.vals[i] = new.vals[i] + other.vals[i] + + return new + + def __radd__(self, other): + return self.__add__(other) + + def __str__(self): + s = "%d" % (self.vals[0]) + + for i in range(1,len(self.vals)): + if self.vals[i] > 0: + s = s + " + ((minor >= %d)?%d:0)" % (i, self.vals[i]) + return s + +# Some attribute are propagated from member to the type as they really +# are part of the type definition, rather than the member. This applies +# only to attributes that affect pointer or array attributes, as these +# are member local types, unlike e.g. a Struct that may be used by +# other members +propagated_attributes=["ptr_array", "nonnull", "chunk"] + +class Type: + def __init__(self): + self.attributes = {} + self.registred = False + self.name = None + + def has_name(self): + return self.name != None + + def get_type(self, recursive=False): + return self + + def is_primitive(self): + return False + + def is_fixed_sizeof(self): + return True + + def is_extra_size(self): + return False + + def contains_extra_size(self): + return False + + def is_fixed_nw_size(self): + return True + + def is_array(self): + return isinstance(self, ArrayType) + + def contains_member(self, member): + return False + + def is_struct(self): + return isinstance(self, StructType) + + def is_pointer(self): + return isinstance(self, PointerType) + + def get_num_pointers(self): + return 0 + + def get_pointer_names(self, marshalled): + return [] + + def sizeof(self): + return "sizeof(%s)" % (self.c_type()) + + def __repr__(self): + return self.__str__() + + def __str__(self): + if self.name != None: + return self.name + return "anonymous type" + + def resolve(self): + return self + + def register(self): + if self.registred or self.name == None: + return + self.registred = True + if _types_by_name.has_key(self.name): + raise Exception, "Type %s already defined" % self.name + _types.append(self) + _types_by_name[self.name] = self + + def has_attr(self, name): + return self.attributes.has_key(name) + +class TypeRef(Type): + def __init__(self, name): + Type.__init__(self) + self.name = name + + def __str__(self): + return "ref to %s" % (self.name) + + def resolve(self): + if not _types_by_name.has_key(self.name): + raise Exception, "Unknown type %s" % self.name + return _types_by_name[self.name] + + def register(self): + assert True, "Can't register TypeRef!" + + +class IntegerType(Type): + def __init__(self, bits, signed): + Type.__init__(self) + self.bits = bits + self.signed = signed + + if signed: + self.name = "int%d" % bits + else: + self.name = "uint%d" % bits + + def primitive_type(self): + return self.name + + def c_type(self): + return self.name + "_t" + + def get_fixed_nw_size(self): + return self.bits / 8 + + def is_primitive(self): + return True + +class TypeAlias(Type): + def __init__(self, name, the_type, attribute_list): + Type.__init__(self) + self.name = name + self.the_type = the_type + for attr in attribute_list: + self.attributes[attr[0][1:]] = attr[1:] + + def get_type(self, recursive=False): + if recursive: + return self.the_type.get_type(True) + else: + return self.the_type + + def primitive_type(self): + return self.the_type.primitive_type() + + def resolve(self): + self.the_type = self.the_type.resolve() + return self + + def __str__(self): + return "alias %s" % self.name + + def is_primitive(self): + return self.the_type.is_primitive() + + def is_fixed_sizeof(self): + return self.the_type.is_fixed_sizeof() + + def is_fixed_nw_size(self): + return self.the_type.is_fixed_nw_size() + + def get_fixed_nw_size(self): + return self.the_type.get_fixed_nw_size() + + def get_num_pointers(self): + return self.the_type.get_num_pointers() + + def get_pointer_names(self, marshalled): + return self.the_type.get_pointer_names(marshalled) + + def c_type(self): + if self.has_attr("ctype"): + return self.attributes["ctype"][0] + return self.name + +class EnumBaseType(Type): + def is_enum(self): + return isinstance(self, EnumType) + + def primitive_type(self): + return "uint%d" % (self.bits) + + def c_type(self): + return "uint%d_t" % (self.bits) + + def c_name(self): + return codegen.prefix_camel(self.name) + + def c_enumname(self, value): + self.c_enumname_by_name(self.names[value]) + + def c_enumname_by_name(self, name): + if self.has_attr("prefix"): + return self.attributes["prefix"][0] + name + return codegen.prefix_underscore_upper(self.name.upper(), name) + + def is_primitive(self): + return True + + def get_fixed_nw_size(self): + return self.bits / 8 + +class EnumType(EnumBaseType): + def __init__(self, bits, name, enums, attribute_list): + Type.__init__(self) + self.bits = bits + self.name = name + + last = -1 + names = {} + values = {} + for v in enums: + name = v[0] + if len(v) > 1: + value = v[1] + else: + value = last + 1 + last = value + + assert not names.has_key(value) + names[value] = name + values[name] = value + + self.names = names + self.values = values + + for attr in attribute_list: + self.attributes[attr[0][1:]] = attr[1:] + + def __str__(self): + return "enum %s" % self.name + + def c_define(self, writer): + writer.write("typedef enum ") + writer.write(self.c_name()) + writer.begin_block() + values = self.names.keys() + values.sort() + current_default = 0 + for i in values: + writer.write(self.c_enumname(i)) + if i != current_default: + writer.write(" = %d" % (i)) + writer.write(",") + writer.newline() + current_default = i + 1 + writer.newline() + writer.write(codegen.prefix_underscore_upper(self.name.upper(), "ENUM_END")) + writer.newline() + writer.end_block(newline=False) + writer.write(" ") + writer.write(self.c_name()) + writer.write(";") + writer.newline() + writer.newline() + +class FlagsType(EnumBaseType): + def __init__(self, bits, name, flags, attribute_list): + Type.__init__(self) + self.bits = bits + self.name = name + + last = -1 + names = {} + values = {} + for v in flags: + name = v[0] + if len(v) > 1: + value = v[1] + else: + value = last + 1 + last = value + + assert not names.has_key(value) + names[value] = name + values[name] = value + + self.names = names + self.values = values + + for attr in attribute_list: + self.attributes[attr[0][1:]] = attr[1:] + + def __str__(self): + return "flags %s" % self.name + + def c_define(self, writer): + writer.write("typedef enum ") + writer.write(self.c_name()) + writer.begin_block() + values = self.names.keys() + values.sort() + mask = 0 + for i in values: + writer.write(self.c_enumname(i)) + mask = mask | (1< 0 + + def is_image_size_length(self): + if isinstance(self.size, types.IntType) or isinstance(self.size, types.StringType): + return False + return self.size[0] == "image_size" + + def is_bytes_length(self): + if isinstance(self.size, types.IntType) or isinstance(self.size, types.StringType): + return False + return self.size[0] == "bytes" + + def is_cstring_length(self): + if isinstance(self.size, types.IntType) or isinstance(self.size, types.StringType): + return False + return self.size[0] == "cstring" + + def is_fixed_sizeof(self): + return self.is_constant_length() and self.element_type.is_fixed_sizeof() + + def is_fixed_nw_size(self): + return self.is_constant_length() and self.element_type.is_fixed_nw_size() + + def get_fixed_nw_size(self): + if not self.is_fixed_nw_size(): + raise Exception, "Not a fixed size type" + + return self.element_type.get_fixed_nw_size() * self.size + + def get_num_pointers(self): + element_count = self.element_type.get_num_pointers() + if element_count == 0: + return 0 + if self.is_constant_length(self): + return element_count * self.size + raise Exception, "Pointers in dynamic arrays not supported" + + def get_pointer_names(self, marshalled): + element_count = self.element_type.get_num_pointers() + if element_count == 0: + return [] + raise Exception, "Pointer names in arrays not supported" + + def is_extra_size(self): + return self.has_attr("ptr_array") + + def contains_extra_size(self): + return self.element_type.contains_extra_size() or self.has_attr("chunk") + + def sizeof(self): + return "%s * %s" % (self.element_type.sizeof(), self.size) + + def c_type(self): + return self.element_type.c_type() + +class PointerType(Type): + def __init__(self, target_type): + Type.__init__(self) + self.name = None + self.target_type = target_type + self.pointer_size = default_pointer_size + + def __str__(self): + return "%s*" % (str(self.target_type)) + + def resolve(self): + self.target_type = self.target_type.resolve() + return self + + def set_ptr_size(self, new_size): + self.pointer_size = new_size + + def is_fixed_nw_size(self): + return True + + def is_primitive(self): + return True + + def primitive_type(self): + if self.pointer_size == 4: + return "uint32" + else: + return "uint64" + + def get_fixed_nw_size(self): + return self.pointer_size + + def c_type(self): + if self.pointer_size == 4: + return "uint32_t" + else: + return "uint64_t" + + def contains_extra_size(self): + return True + + def get_num_pointers(self): + return 1 + +class Containee: + def __init__(self): + self.attributes = {} + + def is_switch(self): + return False + + def is_pointer(self): + return not self.is_switch() and self.member_type.is_pointer() + + def is_array(self): + return not self.is_switch() and self.member_type.is_array() + + def is_struct(self): + return not self.is_switch() and self.member_type.is_struct() + + def is_primitive(self): + return not self.is_switch() and self.member_type.is_primitive() + + def has_attr(self, name): + return self.attributes.has_key(name) + + def has_minor_attr(self): + return self.has_attr("minor") + + def has_end_attr(self): + return self.has_attr("end") + + def get_minor_attr(self): + return self.attributes["minor"][0] + +class Member(Containee): + def __init__(self, name, member_type, attribute_list): + Containee.__init__(self) + self.name = name + self.member_type = member_type + for attr in attribute_list: + self.attributes[attr[0][1:]] = attr[1:] + + def resolve(self, container): + self.container = container + self.member_type = self.member_type.resolve() + self.member_type.register() + if self.has_attr("ptr32") and self.member_type.is_pointer(): + self.member_type.set_ptr_size(4) + for i in propagated_attributes: + if self.has_attr(i): + self.member_type.attributes[i] = self.attributes[i] + return self + + def contains_member(self, member): + return self.member_type.contains_member(member) + + def is_primitive(self): + return self.member_type.is_primitive() + + def is_fixed_sizeof(self): + if self.has_end_attr(): + return False + return self.member_type.is_fixed_sizeof() + + def is_extra_size(self): + return self.has_end_attr() or self.has_attr("to_ptr") or self.member_type.is_extra_size() + + def is_fixed_nw_size(self): + if self.has_attr("virtual"): + return True + return self.member_type.is_fixed_nw_size() + + def get_fixed_nw_size(self): + if self.has_attr("virtual"): + return 0 + size = self.member_type.get_fixed_nw_size() + if self.has_minor_attr(): + minor = self.get_minor_attr() + size = FixedSize(size, minor) + return size + + def contains_extra_size(self): + return self.member_type.contains_extra_size() + + def sizeof(self): + return self.member_type.sizeof() + + def __repr__(self): + return "%s (%s)" % (str(self.name), str(self.member_type)) + + def get_num_pointers(self): + if self.has_attr("to_ptr"): + return 1 + return self.member_type.get_num_pointers() + + def get_pointer_names(self, marshalled): + if self.member_type.is_pointer(): + if self.has_attr("marshall") == marshalled: + names = [self.name] + else: + names = [] + else: + names = self.member_type.get_pointer_names(marshalled) + if self.has_attr("outvar"): + prefix = self.attributes["outvar"][0] + names = map(lambda name: prefix + "_" + name, names) + return names + +class SwitchCase: + def __init__(self, values, member): + self.values = values + self.member = member + self.members = [member] + + def get_check(self, var_cname, var_type): + checks = [] + for v in self.values: + if v == None: + return "1" + elif var_type.is_enum(): + checks.append("%s == %s" % (var_cname, var_type.c_enumname_by_name(v[1]))) + else: + checks.append("%s(%s & %s)" % (v[0], var_cname, var_type.c_enumname_by_name(v[1]))) + return " || ".join(checks) + + def resolve(self, container): + self.switch = container + self.member = self.member.resolve(self) + return self + + def get_num_pointers(self): + return self.member.get_num_pointers() + + def get_pointer_names(self, marshalled): + return self.member.get_pointer_names(marshalled) + +class Switch(Containee): + def __init__(self, variable, cases, name, attribute_list): + Containee.__init__(self) + self.variable = variable + self.name = name + self.cases = cases + for attr in attribute_list: + self.attributes[attr[0][1:]] = attr[1:] + + def is_switch(self): + return True + + def lookup_case_member(self, name): + for c in self.cases: + if c.member.name == name: + return c.member + return None + + def has_switch_member(self, member): + for c in self.cases: + if c.member == member: + return True + return False + + def resolve(self, container): + self.container = container + self.cases = map(lambda c : c.resolve(self), self.cases) + return self + + def __repr__(self): + return "switch on %s %s" % (str(self.variable),str(self.name)) + + def is_fixed_sizeof(self): + # Kinda weird, but we're unlikely to have a real struct if there is an @end + if self.has_end_attr(): + return False + return True + + def is_fixed_nw_size(self): + if self.has_attr("fixedsize"): + return True + + size = None + has_default = False + for c in self.cases: + for v in c.values: + if v == None: + has_default = True + if not c.member.is_fixed_nw_size(): + return False + if size == None: + size = c.member.get_fixed_nw_size() + elif size != c.member.get_fixed_nw_size(): + return False + # Fixed size if all elements listed, or has default + if has_default: + return True + key = self.container.lookup_member(self.variable) + return len(self.cases) == len(key.member_type.values) + + def is_extra_size(self): + return self.has_end_attr() + + def contains_extra_size(self): + for c in self.cases: + if c.member.is_extra_size(): + return True + if c.member.contains_extra_size(): + return True + return False + + def get_fixed_nw_size(self): + if not self.is_fixed_nw_size(): + raise Exception, "Not a fixed size type" + size = 0 + for c in self.cases: + size = max(size, c.member.get_fixed_nw_size()) + return size + + def sizeof(self): + return "sizeof(((%s *)NULL)->%s)" % (self.container.c_type(), + self.name) + + def contains_member(self, member): + return False # TODO: Don't support switch deep member lookup yet + + def get_num_pointers(self): + count = 0 + for c in self.cases: + count = max(count, c.get_num_pointers()) + return count + + def get_pointer_names(self, marshalled): + names = [] + for c in self.cases: + names = names + c.get_pointer_names(marshalled) + return names + +class ContainerType(Type): + def is_fixed_sizeof(self): + for m in self.members: + if not m.is_fixed_sizeof(): + return False + return True + + def contains_extra_size(self): + for m in self.members: + if m.is_extra_size(): + return True + if m.contains_extra_size(): + return True + return False + + def is_fixed_nw_size(self): + for i in self.members: + if not i.is_fixed_nw_size(): + return False + return True + + def get_fixed_nw_size(self): + size = 0 + for i in self.members: + size = size + i.get_fixed_nw_size() + return size + + def contains_member(self, member): + for m in self.members: + if m == member or m.contains_member(member): + return True + return False + + def get_fixed_nw_offset(self, member): + size = 0 + for i in self.members: + if i == member: + break + if i.contains_member(member): + size = size + i.member_type.get_fixed_nw_offset(member) + break + if i.is_fixed_nw_size(): + size = size + i.get_fixed_nw_size() + return size + + def resolve(self): + self.members = map(lambda m : m.resolve(self), self.members) + return self + + def get_num_pointers(self): + count = 0 + for m in self.members: + count = count + m.get_num_pointers() + return count + + def get_pointer_names(self, marshalled): + names = [] + for m in self.members: + names = names + m.get_pointer_names(marshalled) + return names + + def get_nw_offset(self, member, prefix = "", postfix = ""): + fixed = self.get_fixed_nw_offset(member) + v = [] + container = self + while container != None: + members = container.members + container = None + for m in members: + if m == member: + break + if m.contains_member(member): + container = m.member_type + break + if m.is_switch() and m.has_switch_member(member): + break + if not m.is_fixed_nw_size(): + v.append(prefix + m.name + postfix) + if len(v) > 0: + return str(fixed) + " + " + (" + ".join(v)) + else: + return str(fixed) + + def lookup_member(self, name): + dot = name.find('.') + rest = None + if dot >= 0: + rest = name[dot+1:] + name = name[:dot] + + member = None + if self.members_by_name.has_key(name): + member = self.members_by_name[name] + else: + for m in self.members: + if m.is_switch(): + member = m.lookup_case_member(name) + if member != None: + break + if member != None: + break + + if member == None: + raise Exception, "No member called %s found" % name + + if rest != None: + return member.member_type.lookup_member(rest) + + return member + +class StructType(ContainerType): + def __init__(self, name, members, attribute_list): + Type.__init__(self) + self.name = name + self.members = members + self.members_by_name = {} + for m in members: + self.members_by_name[m.name] = m + for attr in attribute_list: + self.attributes[attr[0][1:]] = attr[1:] + + def __str__(self): + if self.name == None: + return "anonymous struct" + else: + return "struct %s" % self.name + + def c_type(self): + if self.has_attr("ctype"): + return self.attributes["ctype"][0] + return codegen.prefix_camel(self.name) + +class MessageType(ContainerType): + def __init__(self, name, members, attribute_list): + Type.__init__(self) + self.name = name + self.members = members + self.members_by_name = {} + for m in members: + self.members_by_name[m.name] = m + self.reverse_members = {} # ChannelMembers referencing this message + for attr in attribute_list: + self.attributes[attr[0][1:]] = attr[1:] + + def __str__(self): + if self.name == None: + return "anonymous message" + else: + return "message %s" % self.name + + def c_name(self): + if self.name == None: + cms = self.reverse_members.keys() + if len(cms) != 1: + raise "Unknown typename for message" + cm = cms[0] + channelname = cm.channel.member_name + if channelname == None: + channelname = "" + else: + channelname = channelname + "_" + if cm.is_server: + return "msg_" + channelname + cm.name + else: + return "msgc_" + channelname + cm.name + else: + return codegen.prefix_camel("Msg", self.name) + + def c_type(self): + if self.has_attr("ctype"): + return self.attributes["ctype"][0] + if self.name == None: + cms = self.reverse_members.keys() + if len(cms) != 1: + raise "Unknown typename for message" + cm = cms[0] + channelname = cm.channel.member_name + if channelname == None: + channelname = "" + if cm.is_server: + return codegen.prefix_camel("Msg", channelname, cm.name) + else: + return codegen.prefix_camel("Msgc", channelname, cm.name) + else: + return codegen.prefix_camel("Msg", self.name) + +class ChannelMember(Containee): + def __init__(self, name, message_type, value): + Containee.__init__(self) + self.name = name + self.message_type = message_type + self.value = value + + def resolve(self, channel): + self.channel = channel + self.message_type = self.message_type.resolve() + self.message_type.reverse_members[self] = 1 + + return self + + def __repr__(self): + return "%s (%s)" % (str(self.name), str(self.message_type)) + +class ChannelType(Type): + def __init__(self, name, base, members, attribute_list): + Type.__init__(self) + self.name = name + self.base = base + self.member_name = None + self.members = members + for attr in attribute_list: + self.attributes[attr[0][1:]] = attr[1:] + + def __str__(self): + if self.name == None: + return "anonymous channel" + else: + return "channel %s" % self.name + + def is_fixed_nw_size(self): + return False + + def get_client_message(self, name): + return self.client_messages_byname[name] + + def get_server_message(self, name): + return self.server_messages_byname[name] + + def resolve(self): + if self.base != None: + self.base = self.base.resolve() + + server_messages = self.base.server_messages[:] + server_messages_byname = self.base.server_messages_byname.copy() + client_messages = self.base.client_messages[:] + client_messages_byname = self.base.client_messages_byname.copy() + + # Set default member_name, FooChannel -> foo + self.member_name = self.name[:-7].lower() + else: + server_messages = [] + server_messages_byname = {} + client_messages = [] + client_messages_byname = {} + + server_count = 1 + client_count = 1 + + server = True + for m in self.members: + if m == "server": + server = True + elif m == "client": + server = False + elif server: + m.is_server = True + m = m.resolve(self) + if m.value: + server_count = m.value + 1 + else: + m.value = server_count + server_count = server_count + 1 + server_messages.append(m) + server_messages_byname[m.name] = m + else: + m.is_server = False + m = m.resolve(self) + if m.value: + client_count = m.value + 1 + else: + m.value = client_count + client_count = client_count + 1 + client_messages.append(m) + client_messages_byname[m.name] = m + + self.server_messages = server_messages + self.server_messages_byname = server_messages_byname + self.client_messages = client_messages + self.client_messages_byname = client_messages_byname + + return self + +class ProtocolMember: + def __init__(self, name, channel_type, value): + self.name = name + self.channel_type = channel_type + self.value = value + + def resolve(self, protocol): + self.channel_type = self.channel_type.resolve() + self.channel_type.member_name = self.name + return self + + def __repr__(self): + return "%s (%s)" % (str(self.name), str(self.channel_type)) + +class ProtocolType(Type): + def __init__(self, name, channels): + Type.__init__(self) + self.name = name + self.channels = channels + + def __str__(self): + if self.name == None: + return "anonymous protocol" + else: + return "protocol %s" % self.name + + def is_fixed_nw_size(self): + return False + + def resolve(self): + count = 1 + for m in self.channels: + m = m.resolve(self) + if m.value: + count = m.value + 1 + else: + m.value = count + count = count + 1 + + return self + +int8 = IntegerType(8, True) +uint8 = IntegerType(8, False) +int16 = IntegerType(16, True) +uint16 = IntegerType(16, False) +int32 = IntegerType(32, True) +uint32 = IntegerType(32, False) +int64 = IntegerType(64, True) +uint64 = IntegerType(64, False) diff -Nru spice-gtk-0.9/spice-common/python_modules/spice_parser.py spice-gtk-0.12/spice-common/python_modules/spice_parser.py --- spice-gtk-0.9/spice-common/python_modules/spice_parser.py 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/python_modules/spice_parser.py 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,161 @@ +try: + from pyparsing import Literal, CaselessLiteral, Word, OneOrMore, ZeroOrMore, \ + Forward, delimitedList, Group, Optional, Combine, alphas, nums, restOfLine, cStyleComment, \ + alphanums, ParseException, ParseResults, Keyword, StringEnd, replaceWith +except ImportError: + print "Module pyparsing not found." + exit(1) + + +import ptypes +import sys + +cvtInt = lambda toks: int(toks[0]) + +def parseVariableDef(toks): + t = toks[0][0] + pointer = toks[0][1] + name = toks[0][2] + array_size = toks[0][3] + attributes = toks[0][4] + + if array_size != None: + t = ptypes.ArrayType(t, array_size) + + if pointer != None: + t = ptypes.PointerType(t) + + return ptypes.Member(name, t, attributes) + +bnf = None +def SPICE_BNF(): + global bnf + + if not bnf: + + # punctuation + colon = Literal(":").suppress() + lbrace = Literal("{").suppress() + rbrace = Literal("}").suppress() + lbrack = Literal("[").suppress() + rbrack = Literal("]").suppress() + lparen = Literal("(").suppress() + rparen = Literal(")").suppress() + equals = Literal("=").suppress() + comma = Literal(",").suppress() + semi = Literal(";").suppress() + + # primitive types + int8_ = Keyword("int8").setParseAction(replaceWith(ptypes.int8)) + uint8_ = Keyword("uint8").setParseAction(replaceWith(ptypes.uint8)) + int16_ = Keyword("int16").setParseAction(replaceWith(ptypes.int16)) + uint16_ = Keyword("uint16").setParseAction(replaceWith(ptypes.uint16)) + int32_ = Keyword("int32").setParseAction(replaceWith(ptypes.int32)) + uint32_ = Keyword("uint32").setParseAction(replaceWith(ptypes.uint32)) + int64_ = Keyword("int64").setParseAction(replaceWith(ptypes.int64)) + uint64_ = Keyword("uint64").setParseAction(replaceWith(ptypes.uint64)) + + # keywords + channel_ = Keyword("channel") + enum32_ = Keyword("enum32").setParseAction(replaceWith(32)) + enum16_ = Keyword("enum16").setParseAction(replaceWith(16)) + enum8_ = Keyword("enum8").setParseAction(replaceWith(8)) + flags32_ = Keyword("flags32").setParseAction(replaceWith(32)) + flags16_ = Keyword("flags16").setParseAction(replaceWith(16)) + flags8_ = Keyword("flags8").setParseAction(replaceWith(8)) + channel_ = Keyword("channel") + server_ = Keyword("server") + client_ = Keyword("client") + protocol_ = Keyword("protocol") + typedef_ = Keyword("typedef") + struct_ = Keyword("struct") + message_ = Keyword("message") + image_size_ = Keyword("image_size") + bytes_ = Keyword("bytes") + cstring_ = Keyword("cstring") + switch_ = Keyword("switch") + default_ = Keyword("default") + case_ = Keyword("case") + + identifier = Word( alphas, alphanums + "_" ) + enumname = Word( alphanums + "_" ) + + integer = ( Combine( CaselessLiteral("0x") + Word( nums+"abcdefABCDEF" ) ) | + Word( nums+"+-", nums ) ).setName("int").setParseAction(cvtInt) + + typename = identifier.copy().setParseAction(lambda toks : ptypes.TypeRef(str(toks[0]))) + + # This is just normal "types", i.e. not channels or messages + typeSpec = Forward() + + attributeValue = integer ^ identifier + attribute = Group(Combine ("@" + identifier) + Optional(lparen + delimitedList(attributeValue) + rparen)) + attributes = Group(ZeroOrMore(attribute)) + arraySizeSpecImage = Group(image_size_ + lparen + integer + comma + identifier + comma + identifier + rparen) + arraySizeSpecBytes = Group(bytes_ + lparen + identifier + comma + identifier + rparen) + arraySizeSpecCString = Group(cstring_ + lparen + rparen) + arraySizeSpec = lbrack + Optional(identifier ^ integer ^ arraySizeSpecImage ^ arraySizeSpecBytes ^arraySizeSpecCString, default="") + rbrack + variableDef = Group(typeSpec + Optional("*", default=None) + identifier + Optional(arraySizeSpec, default=None) + attributes - semi) \ + .setParseAction(parseVariableDef) + + switchCase = Group(Group(OneOrMore(default_.setParseAction(replaceWith(None)) + colon | Group(case_.suppress() + Optional("!", default="") + identifier) + colon)) + variableDef) \ + .setParseAction(lambda toks: ptypes.SwitchCase(toks[0][0], toks[0][1])) + switchBody = Group(switch_ + lparen + delimitedList(identifier,delim='.', combine=True) + rparen + lbrace + Group(OneOrMore(switchCase)) + rbrace + identifier + attributes - semi) \ + .setParseAction(lambda toks: ptypes.Switch(toks[0][1], toks[0][2], toks[0][3], toks[0][4])) + messageBody = structBody = Group(lbrace + ZeroOrMore(variableDef | switchBody) + rbrace) + structSpec = Group(struct_ + identifier + structBody + attributes).setParseAction(lambda toks: ptypes.StructType(toks[0][1], toks[0][2], toks[0][3])) + + # have to use longest match for type, in case a user-defined type name starts with a keyword type, like "channel_type" + typeSpec << ( structSpec ^ int8_ ^ uint8_ ^ int16_ ^ uint16_ ^ + int32_ ^ uint32_ ^ int64_ ^ uint64_ ^ + typename).setName("type") + + flagsBody = enumBody = Group(lbrace + delimitedList(Group (enumname + Optional(equals + integer))) + Optional(comma) + rbrace) + + messageSpec = Group(message_ + messageBody + attributes).setParseAction(lambda toks: ptypes.MessageType(None, toks[0][1], toks[0][2])) | typename + + channelParent = Optional(colon + typename, default=None) + channelMessage = Group(messageSpec + identifier + Optional(equals + integer, default=None) + semi) \ + .setParseAction(lambda toks: ptypes.ChannelMember(toks[0][1], toks[0][0], toks[0][2])) + channelBody = channelParent + Group(lbrace + ZeroOrMore( server_ + colon | client_ + colon | channelMessage) + rbrace) + + enum_ = (enum32_ | enum16_ | enum8_) + flags_ = (flags32_ | flags16_ | flags8_) + enumDef = Group(enum_ + identifier + enumBody + attributes - semi).setParseAction(lambda toks: ptypes.EnumType(toks[0][0], toks[0][1], toks[0][2], toks[0][3])) + flagsDef = Group(flags_ + identifier + flagsBody + attributes - semi).setParseAction(lambda toks: ptypes.FlagsType(toks[0][0], toks[0][1], toks[0][2], toks[0][3])) + messageDef = Group(message_ + identifier + messageBody + attributes - semi).setParseAction(lambda toks: ptypes.MessageType(toks[0][1], toks[0][2], toks[0][3])) + channelDef = Group(channel_ + identifier + channelBody + attributes - semi).setParseAction(lambda toks: ptypes.ChannelType(toks[0][1], toks[0][2], toks[0][3], toks[0][4])) + structDef = Group(struct_ + identifier + structBody + attributes - semi).setParseAction(lambda toks: ptypes.StructType(toks[0][1], toks[0][2], toks[0][3])) + typedefDef = Group(typedef_ + identifier + typeSpec + attributes - semi).setParseAction(lambda toks: ptypes.TypeAlias(toks[0][1], toks[0][2], toks[0][3])) + + definitions = typedefDef | structDef | enumDef | flagsDef | messageDef | channelDef + + protocolChannel = Group(typename + identifier + Optional(equals + integer, default=None) + semi) \ + .setParseAction(lambda toks: ptypes.ProtocolMember(toks[0][1], toks[0][0], toks[0][2])) + protocolDef = Group(protocol_ + identifier + Group(lbrace + ZeroOrMore(protocolChannel) + rbrace) + semi) \ + .setParseAction(lambda toks: ptypes.ProtocolType(toks[0][1], toks[0][2])) + + bnf = ZeroOrMore (definitions) + protocolDef + StringEnd() + + singleLineComment = "//" + restOfLine + bnf.ignore( singleLineComment ) + bnf.ignore( cStyleComment ) + + return bnf + + +def parse(filename): + try: + bnf = SPICE_BNF() + types = bnf.parseFile(filename) + except ParseException, err: + print >> sys.stderr, err.line + print >> sys.stderr, " "*(err.column-1) + "^" + print >> sys.stderr, err + return None + + for t in types: + t.resolve() + t.register() + protocol = types[-1] + return protocol diff -Nru spice-gtk-0.9/spice-common/spice1.proto spice-gtk-0.12/spice-common/spice1.proto --- spice-gtk-0.9/spice-common/spice1.proto 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice1.proto 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,934 @@ +/* built in types: + int8, uint8, 16, 32, 64 +*/ + +typedef fixed28_4 int32 @ctype(SPICE_FIXED28_4); + +struct Point { + int32 x; + int32 y; +}; + +struct Point16 { + int16 x; + int16 y; +}; + +struct PointFix { + fixed28_4 x; + fixed28_4 y; +}; + +struct Rect { + int32 top; + int32 left; + int32 bottom; + int32 right; +}; + +enum32 link_err { + OK, + ERROR, + INVALID_MAGIC, + INVALID_DATA, + VERSION_MISMATCH, + NEED_SECURED, + NEED_UNSECURED, + PERMISSION_DENIED, + BAD_CONNECTION_ID, + CHANNEL_NOT_AVAILABLE +}; + +enum32 warn_code { + WARN_GENERAL +} @prefix(SPICE_); + +enum32 info_code { + INFO_GENERAL +} @prefix(SPICE_); + +flags32 migrate_flags { + NEED_FLUSH, + NEED_DATA_TRANSFER +} @prefix(SPICE_MIGRATE_); + +enum32 notify_severity { + INFO, + WARN, + ERROR, +}; + +enum32 notify_visibility { + LOW, + MEDIUM, + HIGH, +}; + +flags32 mouse_mode { + SERVER, + CLIENT, +}; + +enum16 pubkey_type { + INVALID, + RSA, + RSA2, + DSA, + DSA1, + DSA2, + DSA3, + DSA4, + DH, + EC, +}; + +message Empty { +}; + +message Data { + uint8 data[] @end @ctype(uint8_t); +} @nocopy; + +struct ChannelWait { + uint8 channel_type; + uint8 channel_id; + uint64 message_serial; +} @ctype(SpiceWaitForChannel); + +channel BaseChannel { + server: + message { + migrate_flags flags; + } migrate; + + Data migrate_data; + + message { + uint32 generation; + uint32 window; + } set_ack; + + message { + uint32 id; + uint64 timestamp; + uint8 data[] @ctype(uint8_t) @as_ptr(data_len); + } ping; + + message { + uint8 wait_count; + ChannelWait wait_list[wait_count] @end; + } wait_for_channels; + + message { + uint64 time_stamp; + link_err reason; + } @ctype(SpiceMsgDisconnect) disconnecting; + + message { + uint64 time_stamp; + notify_severity severity; + notify_visibility visibilty; + uint32 what; /* error_code/warn_code/info_code */ + uint32 message_len; + uint8 message[message_len] @end @nomarshal; + uint8 zero @end @ctype(uint8_t) @nomarshal; + } notify; + + client: + message { + uint32 generation; + } ack_sync; + + Empty ack; + + message { + uint32 id; + uint64 timestamp; + } @ctype(SpiceMsgPing) pong; + + Empty migrate_flush_mark; + + Data migrate_data; + + message { + uint64 time_stamp; + link_err reason; + } @ctype(SpiceMsgDisconnect) disconnecting; +}; + +struct ChannelId { + uint8 type; + uint8 id; +}; + +channel MainChannel : BaseChannel { + server: + message { + uint16 port; + uint16 sport; + uint32 host_offset @zero; + uint32 host_size; + pubkey_type pub_key_type @minor(1); + uint32 pub_key_offset @minor(1) @zero; + uint32 pub_key_size @minor(1); + uint8 host_data[host_size] @as_ptr @zero_terminated; + uint8 pub_key_data[pub_key_size] @minor(1) @as_ptr @zero_terminated; + } @ctype(SpiceMsgMainMigrationBegin) migrate_begin = 101; + + Empty migrate_cancel; + + message { + uint32 session_id; + uint32 display_channels_hint; + uint32 supported_mouse_modes; + uint32 current_mouse_mode; + uint32 agent_connected; + uint32 agent_tokens; + uint32 multi_media_time; + uint32 ram_hint; + } init; + + message { + uint32 num_of_channels; + ChannelId channels[num_of_channels] @end; + } @ctype(SpiceMsgChannels) channels_list; + + message { + mouse_mode supported_modes; + mouse_mode current_mode @unique_flag; + } mouse_mode; + + message { + uint32 time; + } @ctype(SpiceMsgMainMultiMediaTime) multi_media_time; + + Empty agent_connected; + + message { + link_err error_code; + } @ctype(SpiceMsgMainAgentDisconnect) agent_disconnected; + + Data agent_data; + + message { + uint32 num_tokens; + } @ctype(SpiceMsgMainAgentTokens) agent_token; + + message { + uint16 port; + uint16 sport; + uint32 host_offset @zero; + uint32 host_size; + uint32 cert_subject_offset @zero; + uint32 cert_subject_size; + uint8 host_data[host_size] @as_ptr @zero_terminated; + uint8 cert_subject_data[cert_subject_size] @as_ptr @zero_terminated; + } @ctype(SpiceMsgMainMigrationSwitchHost) migrate_switch_host; + + client: + message { + uint64 cache_size; + } @ctype(SpiceMsgcClientInfo) client_info = 101; + + Empty migrate_connected; + + Empty migrate_connect_error; + + Empty attach_channels; + + message { + mouse_mode mode; + } mouse_mode_request; + + message { + uint32 num_tokens; + } agent_start; + + Data agent_data; + + message { + uint32 num_tokens; + } @ctype(SpiceMsgcMainAgentTokens) agent_token; +}; + +enum32 clip_type { + NONE, + RECTS +}; + +flags32 path_flags { /* TODO: C enum names changes */ + BEGIN = 0, + END = 1, + CLOSE = 3, + BEZIER = 4, +} @prefix(SPICE_PATH_); + +enum32 video_codec_type { + MJPEG = 1, +}; + +flags32 stream_flags { + TOP_DOWN = 0, +}; + +enum32 brush_type { + NONE, + SOLID, + PATTERN, +}; + +flags8 mask_flags { + INVERS, +}; + +enum8 image_type { + BITMAP, + QUIC, + RESERVED, + LZ_PLT = 100, + LZ_RGB, + GLZ_RGB, + FROM_CACHE, +}; + +flags8 image_flags { + CACHE_ME, +}; + +enum8 bitmap_fmt { + INVALID, + 1BIT_LE, + 1BIT_BE, + 4BIT_LE, + 4BIT_BE, + 8BIT /* 8bit indexed mode */, + 16BIT, /* 0555 mode */ + 24BIT /* 3 byte, brg */, + 32BIT /* 4 byte, xrgb in little endian format */, + RGBA /* 4 byte, argb in little endian format */ +}; + +flags8 bitmap_flags { + PAL_CACHE_ME, + PAL_FROM_CACHE, + TOP_DOWN, +}; + +enum8 image_scale_mode { + INTERPOLATE, + NEAREST, +}; + +flags16 ropd { + INVERS_SRC, + INVERS_BRUSH, + INVERS_DEST, + OP_PUT, + OP_OR, + OP_AND, + OP_XOR, + OP_BLACKNESS, + OP_WHITENESS, + OP_INVERS, + INVERS_RES, +}; + +flags8 line_flags { + STYLED = 3, + START_WITH_GAP = 2, +}; + +enum8 line_cap { + ROUND, + SQUARE, + BUTT, +}; + +enum8 line_join { + ROUND, + BEVEL, + MITER, +}; + +flags16 string_flags { + RASTER_A1, + RASTER_A4, + RASTER_A8, + RASTER_TOP_DOWN, +}; + +enum8 resource_type { + INVALID, + PIXMAP +} @prefix(SPICE_RES_TYPE_); + +struct ClipRects { + uint32 num_rects; + Rect rects[num_rects] @end; +}; + +struct PathSegment { + path_flags flags; + uint32 count; + PointFix points[count] @end; +} @ctype(SpicePathSeg); + +struct Path { + uint32 segments_size @bytes_count(num_segments); + PathSegment segments[bytes(segments_size, num_segments)] @ptr_array; +}; + +struct Clip { + clip_type type; + switch (type) { + case RECTS: + ClipRects *rects @outvar(cliprects); + default: + uint64 data @zero; + } u @anon; +}; + +struct DisplayBase { + uint32 surface_id @virtual(0); + Rect box; + Clip clip; +} @ctype(SpiceMsgDisplayBase); + +struct ResourceID { + uint8 type; + uint64 id; +}; + +struct WaitForChannel { + uint8 channel_type; + uint8 channel_id; + uint64 message_serial; +}; + +struct Palette { + uint64 unique; + uint16 num_ents; + uint32 ents[num_ents] @end; +}; + +struct BitmapData { + bitmap_fmt format; + bitmap_flags flags; + uint32 x; + uint32 y; + uint32 stride; + switch (flags) { + case PAL_FROM_CACHE: + uint64 palette_id; + default: + Palette *palette @outvar(bitmap); + } pal @anon; + uint8 *data[image_size(8, stride, y)] @chunk; /* pointer to array, not array of pointers as in C */ +} @ctype(SpiceBitmap); + +struct BinaryData { + uint32 data_size; + uint8 data[data_size] @nomarshal @chunk; +} @ctype(SpiceQUICData); + +struct LZPLTData { + bitmap_flags flags; + uint32 data_size; + switch (flags) { + case PAL_FROM_CACHE: + uint64 palette_id; + default: + Palette *palette @nonnull @outvar(lzplt); + } pal @anon; + uint8 data[data_size] @nomarshal @chunk; +}; + +struct Image { + struct ImageDescriptor { + uint64 id; + image_type type; + image_flags flags; + uint32 width; + uint32 height; + } descriptor; + + switch (descriptor.type) { + case BITMAP: + BitmapData bitmap; + case QUIC: + BinaryData quic; + case LZ_RGB: + case GLZ_RGB: + BinaryData lz_rgb; + case LZ_PLT: + LZPLTData lz_plt; + } u; +}; + +struct Pattern { + Image *pat @nonnull; + Point pos; +}; + +struct Brush { + brush_type type; + switch (type) { + case SOLID: + uint32 color; + case PATTERN: + Pattern pattern; + } u @fixedsize; +}; + +struct QMask { + mask_flags flags; + Point pos; + Image *bitmap; +}; + +struct LineAttr { + line_flags flags; + line_join join_style @zero; + line_cap end_style @zero; + uint8 style_nseg; + fixed28_4 width @zero; + fixed28_4 miter_limit @zero; + fixed28_4 *style[style_nseg]; +}; + +struct RasterGlyphA1 { + Point render_pos; + Point glyph_origin; + uint16 width; + uint16 height; + uint8 data[image_size(1, width, height)] @end; +} @ctype(SpiceRasterGlyph); + +struct RasterGlyphA4 { + Point render_pos; + Point glyph_origin; + uint16 width; + uint16 height; + uint8 data[image_size(4, width, height)] @end; +} @ctype(SpiceRasterGlyph); + +struct RasterGlyphA8 { + Point render_pos; + Point glyph_origin; + uint16 width; + uint16 height; + uint8 data[image_size(8, width, height)] @end; +} @ctype(SpiceRasterGlyph); + +struct String { + uint16 length; + string_flags flags; /* Special: Only one of a1/a4/a8 set */ + switch (flags) { + case RASTER_A1: + RasterGlyphA1 glyphs[length] @ctype(SpiceRasterGlyph) @ptr_array; + case RASTER_A4: + RasterGlyphA4 glyphs[length] @ctype(SpiceRasterGlyph) @ptr_array; + case RASTER_A8: + RasterGlyphA8 glyphs[length] @ctype(SpiceRasterGlyph) @ptr_array; + } u @anon; +}; + +channel DisplayChannel : BaseChannel { + server: + message { + uint32 x_res; + uint32 y_res; + uint32 bits; + } mode = 101; + + Empty mark; + Empty reset; + + message { + DisplayBase base; + Point src_pos; + } copy_bits; + + message { + uint16 count; + ResourceID resources[count] @end; + } @ctype(SpiceResourceList) inval_list; + + message { + uint8 wait_count; + WaitForChannel wait_list[wait_count] @end; + } @ctype(SpiceMsgWaitForChannels) inval_all_pixmaps; + + message { + uint64 id; + } @ctype(SpiceMsgDisplayInvalOne) inval_palette; + + Empty inval_all_palettes; + + message { + uint32 surface_id @virtual(0); + uint32 id; + stream_flags flags; + video_codec_type codec_type; + uint64 stamp; + uint32 stream_width; + uint32 stream_height; + uint32 src_width; + uint32 src_height; + Rect dest; + Clip clip; + } stream_create = 122; + + message { + uint32 id; + uint32 multi_media_time; + uint32 data_size; + uint32 pad_size @zero; + uint8 data[data_size] @end @nomarshal; + /* Ignore: uint8 padding[pad_size] */ + } stream_data; + + message { + uint32 id; + Clip clip; + } stream_clip; + + message { + uint32 id; + } stream_destroy; + + Empty stream_destroy_all; + + message { + DisplayBase base; + struct Fill { + Brush brush @outvar(brush); + uint16 rop_descriptor; + QMask mask @outvar(mask); + } data; + } draw_fill = 302; + + message { + DisplayBase base; + struct Opaque { + Image *src_bitmap; + Rect src_area; + Brush brush; + ropd rop_descriptor; + image_scale_mode scale_mode; + QMask mask @outvar(mask); + } data; + } draw_opaque; + + message { + DisplayBase base; + struct Copy { + Image *src_bitmap; + Rect src_area; + ropd rop_descriptor; + image_scale_mode scale_mode; + QMask mask @outvar(mask); + } data; + } draw_copy; + + message { + DisplayBase base; + struct Blend { + Image *src_bitmap; + Rect src_area; + ropd rop_descriptor; + image_scale_mode scale_mode; + QMask mask @outvar(mask); + } @ctype(SpiceCopy) data; + } draw_blend; + + message { + DisplayBase base; + struct Blackness { + QMask mask @outvar(mask); + } data; + } draw_blackness; + + message { + DisplayBase base; + struct Whiteness { + QMask mask @outvar(mask); + } data; + } draw_whiteness; + + message { + DisplayBase base; + struct Invers { + QMask mask @outvar(mask); + } data; + } draw_invers; + + message { + DisplayBase base; + struct Rop3 { + Image *src_bitmap; + Rect src_area; + Brush brush; + uint8 rop3; + image_scale_mode scale_mode; + QMask mask @outvar(mask); + } data; + } draw_rop3; + + message { + DisplayBase base; + struct Stroke { + Path *path; + LineAttr attr; + Brush brush; + uint16 fore_mode; + uint16 back_mode; + } data; + } draw_stroke; + + message { + DisplayBase base; + struct Text { + String *str; + Rect back_area; + Brush fore_brush @outvar(fore_brush); + Brush back_brush @outvar(back_brush); + uint16 fore_mode; + uint16 back_mode; + } data; + } draw_text; + + message { + DisplayBase base; + struct Transparent { + Image *src_bitmap; + Rect src_area; + uint32 src_color; + uint32 true_color; + } data; + } draw_transparent; + + message { + DisplayBase base; + struct AlphaBlend { + int8 alpha_flags @virtual(0); + uint8 alpha; + Image *src_bitmap; + Rect src_area; + } data; + } draw_alpha_blend; + + client: + message { + uint8 pixmap_cache_id; + int64 pixmap_cache_size; //in pixels + uint8 glz_dictionary_id; + int32 glz_dictionary_window_size; // in pixels + } init = 101; +}; + +flags32 keyboard_modifier_flags { + SCROLL_LOCK, + NUM_LOCK, + CAPS_LOCK +}; + +enum32 mouse_button { + INVALID, + LEFT, + MIDDLE, + RIGHT, + UP, + DOWN, +}; + +flags32 mouse_button_mask { + LEFT, + MIDDLE, + RIGHT +}; + +channel InputsChannel : BaseChannel { + client: + message { + uint32 code; + } @ctype(SpiceMsgcKeyDown) key_down = 101; + + message { + uint32 code; + } @ctype(SpiceMsgcKeyUp) key_up; + + message { + keyboard_modifier_flags modifiers; + } @ctype(SpiceMsgcKeyModifiers) key_modifiers; + + message { + int32 dx; + int32 dy; + mouse_button_mask buttons_state; + } @ctype(SpiceMsgcMouseMotion) mouse_motion = 111; + + message { + uint32 x; + uint32 y; + mouse_button_mask buttons_state; + uint8 display_id; + } @ctype(SpiceMsgcMousePosition) mouse_position; + + message { + mouse_button button; + mouse_button_mask buttons_state; + } @ctype(SpiceMsgcMousePress) mouse_press; + + message { + mouse_button button; + mouse_button_mask buttons_state; + } @ctype(SpiceMsgcMouseRelease) mouse_release; + + server: + message { + keyboard_modifier_flags keyboard_modifiers; + } init = 101; + + message { + keyboard_modifier_flags modifiers; + } key_modifiers; + + Empty mouse_motion_ack = 111; +}; + +enum16 cursor_type { + ALPHA, + MONO, + COLOR4, + COLOR8, + COLOR16, + COLOR24, + COLOR32, +}; + +flags32 cursor_flags { + NONE, /* Means no cursor */ + CACHE_ME, + FROM_CACHE, +}; + +struct CursorHeader { + uint64 unique; + cursor_type type; + uint16 width; + uint16 height; + uint16 hot_spot_x; + uint16 hot_spot_y; +}; + +struct Cursor { + cursor_flags flags; + CursorHeader header; + uint8 data[] @as_ptr(data_size); +}; + +channel CursorChannel : BaseChannel { + server: + message { + Point16 position; + uint16 trail_length; + uint16 trail_frequency; + uint8 visible; + Cursor cursor; + } init = 101; + + Empty reset; + + message { + Point16 position; + uint8 visible; + Cursor cursor; + } set; + + message { + Point16 position; + } move; + + Empty hide; + + message { + uint16 length; + uint16 frequency; + } trail; + + message { + uint64 id; + } @ctype(SpiceMsgDisplayInvalOne) inval_one; + + Empty inval_all; +}; + +enum32 audio_data_mode { + INVALID, + RAW, + CELT_0_5_1, +}; + +enum32 audio_fmt { + INVALID, + S16, +}; + +channel PlaybackChannel : BaseChannel { + server: + message { + uint32 time; + uint8 data[] @as_ptr(data_size); + } @ctype(SpiceMsgPlaybackPacket) data = 101; + + message { + uint32 time; + audio_data_mode mode; + uint8 data[] @as_ptr(data_size); + } mode; + + message { + uint32 channels; + audio_fmt format; + uint32 frequency; + uint32 time; + } start; + + Empty stop; +}; + +channel RecordChannel : BaseChannel { + server: + message { + uint32 channels; + audio_fmt format; + uint32 frequency; + } start = 101; + + Empty stop; + client: + message { + uint32 time; + uint8 data[] @nomarshal @as_ptr(data_size); + } @ctype(SpiceMsgcRecordPacket) data = 101; + + message { + uint32 time; + audio_data_mode mode; + uint8 data[] @as_ptr(data_size); + } mode; + + message { + uint32 time; + } start_mark; +}; + +protocol Spice { + MainChannel main = 1; + DisplayChannel display; + InputsChannel inputs; + CursorChannel cursor; + PlaybackChannel playback; + RecordChannel record; +}; diff -Nru spice-gtk-0.9/spice-common/spice_codegen.py spice-gtk-0.12/spice-common/spice_codegen.py --- spice-gtk-0.9/spice-common/spice_codegen.py 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice_codegen.py 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,219 @@ +#!/usr/bin/env python + +import os +import sys +from optparse import OptionParser +import traceback +from python_modules import spice_parser +from python_modules import ptypes +from python_modules import codegen +from python_modules import demarshal +from python_modules import marshal + +def write_channel_enums(writer, channel, client): + messages = filter(lambda m : m.channel == channel, \ + channel.client_messages if client else channel.server_messages) + if len(messages) == 0: + return + writer.begin_block("enum") + i = 0 + if client: + prefix = [ "MSGC" ] + else: + prefix = [ "MSG" ] + if channel.member_name: + prefix.append(channel.member_name.upper()) + prefix.append(None) # To be replaced with name + for m in messages: + prefix[-1] = m.name.upper() + enum = codegen.prefix_underscore_upper(*prefix) + if m.value == i: + writer.writeln("%s," % enum) + i = i + 1 + else: + writer.writeln("%s = %s," % (enum, m.value)) + i = m.value + 1 + if channel.member_name: + prefix[-1] = prefix[-2] + prefix[-2] = "END" + writer.newline() + writer.writeln("%s" % (codegen.prefix_underscore_upper(*prefix))) + writer.end_block(semicolon=True) + writer.newline() + +def write_enums(writer): + writer.writeln("#ifndef _H_SPICE_ENUMS") + writer.writeln("#define _H_SPICE_ENUMS") + writer.newline() + writer.comment("Generated from %s, don't edit" % writer.options["source"]).newline() + writer.newline() + + # Define enums + for t in ptypes.get_named_types(): + if isinstance(t, ptypes.EnumBaseType): + t.c_define(writer) + + i = 0 + writer.begin_block("enum") + for c in proto.channels: + enum = codegen.prefix_underscore_upper("CHANNEL", c.name.upper()) + if c.value == i: + writer.writeln("%s," % enum) + i = i + 1 + else: + writer.writeln("%s = %s," % (enum, c.value)) + i = c.value + 1 + writer.newline() + writer.writeln("SPICE_END_CHANNEL") + writer.end_block(semicolon=True) + writer.newline() + + for c in ptypes.get_named_types(): + if not isinstance(c, ptypes.ChannelType): + continue + write_channel_enums(writer, c, False) + write_channel_enums(writer, c, True) + + writer.writeln("#endif /* _H_SPICE_ENUMS */") + +parser = OptionParser(usage="usage: %prog [options] ") +parser.add_option("-e", "--generate-enums", + action="store_true", dest="generate_enums", default=False, + help="Generate enums") +parser.add_option("-d", "--generate-demarshallers", + action="store_true", dest="generate_demarshallers", default=False, + help="Generate demarshallers") +parser.add_option("-m", "--generate-marshallers", + action="store_true", dest="generate_marshallers", default=False, + help="Generate message marshallers") +parser.add_option("-P", "--private-marshallers", + action="store_true", dest="private_marshallers", default=False, + help="Generate private message marshallers") +parser.add_option("-M", "--generate-struct-marshaller", + action="append", dest="struct_marshallers", + help="Generate struct marshallers") +parser.add_option("-a", "--assert-on-error", + action="store_true", dest="assert_on_error", default=False, + help="Assert on error") +parser.add_option("-H", "--header", + action="store_true", dest="header", default=False, + help="Generate header") +parser.add_option("-p", "--print-error", + action="store_true", dest="print_error", default=False, + help="Print errors") +parser.add_option("-s", "--server", + action="store_true", dest="server", default=False, + help="Print errors") +parser.add_option("-c", "--client", + action="store_true", dest="client", default=False, + help="Print errors") +parser.add_option("-k", "--keep-identical-file", + action="store_true", dest="keep_identical_file", default=False, + help="Print errors") +parser.add_option("-i", "--include", + action="append", dest="includes", metavar="FILE", + help="Include FILE in generated code") +parser.add_option("--prefix", dest="prefix", + help="set public symbol prefix", default="") +parser.add_option("--ptrsize", dest="ptrsize", + help="set default pointer size", default="4") + +(options, args) = parser.parse_args() + +if len(args) == 0: + parser.error("No protocol file specified") + +if len(args) == 1: + parser.error("No destination file specified") + +ptypes.default_pointer_size = int(options.ptrsize) + +proto_file = args[0] +dest_file = args[1] +proto = spice_parser.parse(proto_file) + +if proto == None: + exit(1) + +codegen.set_prefix(proto.name) +writer = codegen.CodeWriter() +writer.header = codegen.CodeWriter() +writer.set_option("source", os.path.basename(proto_file)) + +writer.public_prefix = options.prefix + +writer.writeln("/* this is a file autogenerated by spice_codegen.py */") +writer.header.writeln("/* this is a file autogenerated by spice_codegen.py */") +if not options.header and not options.generate_enums: + writer.writeln("#ifdef HAVE_CONFIG_H") + writer.writeln("#include ") + writer.writeln("#endif") + +if options.assert_on_error: + writer.set_option("assert_on_error") + +if options.print_error: + writer.set_option("print_error") + +if options.includes: + for i in options.includes: + writer.header.writeln('#include "%s"' % i) + writer.writeln('#include "%s"' % i) + +if options.generate_enums: + write_enums(writer) + +if options.generate_demarshallers: + if not options.server and not options.client: + print >> sys.stderr, "Must specify client and/or server" + sys.exit(1) + demarshal.write_includes(writer) + + if options.server: + demarshal.write_protocol_parser(writer, proto, False) + if options.client: + demarshal.write_protocol_parser(writer, proto, True) + +if options.generate_marshallers or (options.struct_marshallers and len(options.struct_marshallers) > 0): + marshal.write_includes(writer) + +if options.generate_marshallers: + if not options.server and not options.client: + print >> sys.stderr, "Must specify client and/or server" + sys.exit(1) + if options.server: + marshal.write_protocol_marshaller(writer, proto, False, options.private_marshallers) + if options.client: + marshal.write_protocol_marshaller(writer, proto, True, options.private_marshallers) + +if options.struct_marshallers: + for structname in options.struct_marshallers: + t = ptypes.lookup_type(structname) + marshal.write_marshal_ptr_function(writer, t, False) + +if options.generate_marshallers or (options.struct_marshallers and len(options.struct_marshallers) > 0): + marshal.write_trailer(writer) + +if options.header: + content = writer.header.getvalue() +else: + content = writer.getvalue() +if options.keep_identical_file: + try: + f = open(dest_file, 'rb') + old_content = f.read() + f.close() + + if content == old_content: + print "No changes to %s" % dest_file + sys.exit(0) + + except IOError: + pass + +f = open(dest_file, 'wb') +f.write(content) +f.close() + +print "Wrote %s" % dest_file +sys.exit(0) diff -Nru spice-gtk-0.9/spice-common/spice.proto spice-gtk-0.12/spice-common/spice.proto --- spice-gtk-0.9/spice-common/spice.proto 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice.proto 2012-04-21 18:50:39.000000000 +0000 @@ -0,0 +1,1215 @@ +/* built in types: + int8, uint8, 16, 32, 64 +*/ + +typedef fixed28_4 int32 @ctype(SPICE_FIXED28_4); + +struct Point { + int32 x; + int32 y; +}; + +struct Point16 { + int16 x; + int16 y; +}; + +struct PointFix { + fixed28_4 x; + fixed28_4 y; +}; + +struct Rect { + int32 top; + int32 left; + int32 bottom; + int32 right; +}; + +enum32 link_err { + OK, + ERROR, + INVALID_MAGIC, + INVALID_DATA, + VERSION_MISMATCH, + NEED_SECURED, + NEED_UNSECURED, + PERMISSION_DENIED, + BAD_CONNECTION_ID, + CHANNEL_NOT_AVAILABLE +}; + +enum32 warn_code { + WARN_GENERAL +} @prefix(SPICE_); + +enum32 info_code { + INFO_GENERAL +} @prefix(SPICE_); + +flags32 migrate_flags { + NEED_FLUSH, + NEED_DATA_TRANSFER +} @prefix(SPICE_MIGRATE_); + +enum32 notify_severity { + INFO, + WARN, + ERROR, +}; + +enum32 notify_visibility { + LOW, + MEDIUM, + HIGH, +}; + +flags16 mouse_mode { + SERVER, + CLIENT, +}; + +enum16 pubkey_type { + INVALID, + RSA, + RSA2, + DSA, + DSA1, + DSA2, + DSA3, + DSA4, + DH, + EC, +}; + +message Empty { +}; + +message Data { + uint8 data[] @end @ctype(uint8_t); +} @nocopy; + +struct ChannelWait { + uint8 channel_type; + uint8 channel_id; + uint64 message_serial; +} @ctype(SpiceWaitForChannel); + +channel BaseChannel { + server: + message { + migrate_flags flags; + } migrate; + + Data migrate_data; + + message { + uint32 generation; + uint32 window; + } set_ack; + + message { + uint32 id; + uint64 timestamp; + uint8 data[] @ctype(uint8_t) @as_ptr(data_len); + } ping; + + message { + uint8 wait_count; + ChannelWait wait_list[wait_count] @end; + } wait_for_channels; + + message { + uint64 time_stamp; + link_err reason; + } @ctype(SpiceMsgDisconnect) disconnecting; + + message { + uint64 time_stamp; + notify_severity severity; + notify_visibility visibilty; + uint32 what; /* error_code/warn_code/info_code */ + uint32 message_len; + uint8 message[message_len] @end @nomarshal; + } notify; + + Data list; /* the msg body is SpiceSubMessageList */ + + client: + message { + uint32 generation; + } ack_sync; + + Empty ack; + + message { + uint32 id; + uint64 timestamp; + } @ctype(SpiceMsgPing) pong; + + Empty migrate_flush_mark; + + Data migrate_data; + + message { + uint64 time_stamp; + link_err reason; + } @ctype(SpiceMsgDisconnect) disconnecting; +}; + +struct ChannelId { + uint8 type; + uint8 id; +}; + +channel MainChannel : BaseChannel { + server: + message { + uint16 port; + uint16 sport; + uint32 host_size; + uint8 *host_data[host_size] @zero_terminated @marshall @nonnull; + uint32 cert_subject_size; + uint8 *cert_subject_data[cert_subject_size] @zero_terminated @marshall; + } @ctype(SpiceMsgMainMigrationBegin) migrate_begin = 101; + + Empty migrate_cancel; + + message { + uint32 session_id; + uint32 display_channels_hint; + uint32 supported_mouse_modes; + uint32 current_mouse_mode; + uint32 agent_connected; + uint32 agent_tokens; + uint32 multi_media_time; + uint32 ram_hint; + } init; + + message { + uint32 num_of_channels; + ChannelId channels[num_of_channels] @end; + } @ctype(SpiceMsgChannels) channels_list; + + message { + mouse_mode supported_modes; + mouse_mode current_mode @unique_flag; + } mouse_mode; + + message { + uint32 time; + } @ctype(SpiceMsgMainMultiMediaTime) multi_media_time; + + Empty agent_connected; + + message { + link_err error_code; + } @ctype(SpiceMsgMainAgentDisconnect) agent_disconnected; + + Data agent_data; + + message { + uint32 num_tokens; + } @ctype(SpiceMsgMainAgentTokens) agent_token; + + message { + uint16 port; + uint16 sport; + uint32 host_size; + uint8 *host_data[host_size] @zero_terminated @marshall; + uint32 cert_subject_size; + uint8 *cert_subject_data[cert_subject_size] @zero_terminated @marshall; + } @ctype(SpiceMsgMainMigrationSwitchHost) migrate_switch_host; + + Empty migrate_end; + + message { + uint32 name_len; + uint8 name[name_len] @end; + } name; + + message { + uint8 uuid[16]; + } uuid; + + client: + message { + uint64 cache_size; + } @ctype(SpiceMsgcClientInfo) client_info = 101; + + Empty migrate_connected; + + Empty migrate_connect_error; + + Empty attach_channels; + + message { + mouse_mode mode; + } mouse_mode_request; + + message { + uint32 num_tokens; + } agent_start; + + Data agent_data; + + message { + uint32 num_tokens; + } @ctype(SpiceMsgcMainAgentTokens) agent_token; + + Empty migrate_end; +}; + +enum8 clip_type { + NONE, + RECTS +}; + +flags8 path_flags { /* TODO: C enum names changes */ + BEGIN = 0, + END = 1, + CLOSE = 3, + BEZIER = 4, +} @prefix(SPICE_PATH_); + +enum8 video_codec_type { + MJPEG = 1, +}; + +flags8 stream_flags { + TOP_DOWN = 0, +}; + +enum8 brush_type { + NONE, + SOLID, + PATTERN, +}; + +flags8 mask_flags { + INVERS, +}; + +enum8 image_type { + BITMAP, + QUIC, + RESERVED, + LZ_PLT = 100, + LZ_RGB, + GLZ_RGB, + FROM_CACHE, + SURFACE, + JPEG, + FROM_CACHE_LOSSLESS, + ZLIB_GLZ_RGB, + JPEG_ALPHA, +}; + +flags8 image_flags { + CACHE_ME, + HIGH_BITS_SET, + CACHE_REPLACE_ME, +}; + +enum8 bitmap_fmt { + INVALID, + 1BIT_LE, + 1BIT_BE, + 4BIT_LE, + 4BIT_BE, + 8BIT /* 8bit indexed mode */, + 16BIT, /* 0555 mode */ + 24BIT /* 3 byte, brg */, + 32BIT /* 4 byte, xrgb in little endian format */, + RGBA /* 4 byte, argb in little endian format */ +}; + +flags8 bitmap_flags { + PAL_CACHE_ME, + PAL_FROM_CACHE, + TOP_DOWN, +}; + +flags8 jpeg_alpha_flags { + TOP_DOWN, +}; + +enum8 image_scale_mode { + INTERPOLATE, + NEAREST, +}; + +flags16 ropd { + INVERS_SRC, + INVERS_BRUSH, + INVERS_DEST, + OP_PUT, + OP_OR, + OP_AND, + OP_XOR, + OP_BLACKNESS, + OP_WHITENESS, + OP_INVERS, + INVERS_RES, +}; + +/* This *must* remain with values identical to api/winddi.h + LA_STYLED == 0x8 (log_2)=> 3 + LA_STARTGAP == 0x4 (log_2)=> 2 + This is used by the windows driver. + */ +flags8 line_flags { + STYLED = 3, + START_WITH_GAP = 2, +}; + +flags8 string_flags { + RASTER_A1, + RASTER_A4, + RASTER_A8, + RASTER_TOP_DOWN, +}; + +flags32 surface_flags { + PRIMARY +}; + +enum32 surface_fmt { + INVALID, + 1_A = 1, + 8_A = 8, + 16_555 = 16 , + 16_565 = 80, + 32_xRGB = 32, + 32_ARGB = 96 +}; + +flags8 alpha_flags { + DEST_HAS_ALPHA, + SRC_SURFACE_HAS_ALPHA +}; + +enum8 resource_type { + INVALID, + PIXMAP +} @prefix(SPICE_RES_TYPE_); + +struct ClipRects { + uint32 num_rects; + Rect rects[num_rects] @end; +}; + +struct PathSegment { + path_flags flags; + uint32 count; + PointFix points[count] @end; +} @ctype(SpicePathSeg); + +struct Path { + uint32 num_segments; + PathSegment segments[num_segments] @ptr_array; +}; + +struct Clip { + clip_type type; + switch (type) { + case RECTS: + ClipRects rects @outvar(cliprects) @to_ptr; + } u @anon; +}; + +struct DisplayBase { + uint32 surface_id; + Rect box; + Clip clip; +} @ctype(SpiceMsgDisplayBase); + +struct ResourceID { + uint8 type; + uint64 id; +}; + +struct WaitForChannel { + uint8 channel_type; + uint8 channel_id; + uint64 message_serial; +}; + +struct Palette { + uint64 unique; + uint16 num_ents; + uint32 ents[num_ents] @end; +}; + +struct BitmapData { + bitmap_fmt format; + bitmap_flags flags; + uint32 x; + uint32 y; + uint32 stride; + switch (flags) { + case PAL_FROM_CACHE: + uint64 palette_id; + default: + Palette *palette @outvar(bitmap); + } pal @anon; + uint8 data[image_size(8, stride, y)] @chunk @nomarshal; +} @ctype(SpiceBitmap); + +struct BinaryData { + uint32 data_size; + uint8 data[data_size] @nomarshal @chunk; +} @ctype(SpiceQUICData); + +struct LZPLTData { + bitmap_flags flags; + uint32 data_size; + switch (flags) { + case PAL_FROM_CACHE: + uint64 palette_id; + default: + Palette *palette @nonnull @outvar(lzplt); + } pal @anon; + uint8 data[data_size] @nomarshal @chunk; +}; + +struct ZlibGlzRGBData { + uint32 glz_data_size; + uint32 data_size; + uint8 data[data_size] @nomarshal @chunk; +} @ctype(SpiceZlibGlzRGBData); + +struct JPEGAlphaData { + jpeg_alpha_flags flags; + uint32 jpeg_size; + uint32 data_size; + uint8 data[data_size] @nomarshal @chunk; +} @ctype(SpiceJPEGAlphaData); + +struct Surface { + uint32 surface_id; +}; + + +struct Image { + struct ImageDescriptor { + uint64 id; + image_type type; + image_flags flags; + uint32 width; + uint32 height; + } descriptor; + + switch (descriptor.type) { + case BITMAP: + BitmapData bitmap; + case QUIC: + BinaryData quic; + case LZ_RGB: + case GLZ_RGB: + BinaryData lz_rgb; + case JPEG: + BinaryData jpeg; + case LZ_PLT: + LZPLTData lz_plt; + case ZLIB_GLZ_RGB: + ZlibGlzRGBData zlib_glz; + case JPEG_ALPHA: + JPEGAlphaData jpeg_alpha; + case SURFACE: + Surface surface; + } u; +}; + +struct Pattern { + Image *pat @nonnull; + Point pos; +}; + +struct Brush { + brush_type type; + switch (type) { + case SOLID: + uint32 color; + case PATTERN: + Pattern pattern; + } u; +}; + +struct QMask { + mask_flags flags; + Point pos; + Image *bitmap; +}; + +struct LineAttr { + line_flags flags; + switch (flags) { + case STYLED: + uint8 style_nseg; + } u1 @anon; + switch (flags) { + case STYLED: + fixed28_4 *style[style_nseg]; + } u2 @anon; +}; + +struct RasterGlyphA1 { + Point render_pos; + Point glyph_origin; + uint16 width; + uint16 height; + uint8 data[image_size(1, width, height)] @end; +} @ctype(SpiceRasterGlyph); + +struct RasterGlyphA4 { + Point render_pos; + Point glyph_origin; + uint16 width; + uint16 height; + uint8 data[image_size(4, width, height)] @end; +} @ctype(SpiceRasterGlyph); + +struct RasterGlyphA8 { + Point render_pos; + Point glyph_origin; + uint16 width; + uint16 height; + uint8 data[image_size(8, width, height)] @end; +} @ctype(SpiceRasterGlyph); + +struct String { + uint16 length; + string_flags flags; /* Special: Only one of a1/a4/a8 set */ + switch (flags) { + case RASTER_A1: + RasterGlyphA1 glyphs[length] @ctype(SpiceRasterGlyph) @ptr_array; + case RASTER_A4: + RasterGlyphA4 glyphs[length] @ctype(SpiceRasterGlyph) @ptr_array; + case RASTER_A8: + RasterGlyphA8 glyphs[length] @ctype(SpiceRasterGlyph) @ptr_array; + } u @anon; +}; + +channel DisplayChannel : BaseChannel { + server: + message { + uint32 x_res; + uint32 y_res; + uint32 bits; + } mode = 101; + + Empty mark; + Empty reset; + message { + DisplayBase base; + Point src_pos; + } copy_bits; + + message { + uint16 count; + ResourceID resources[count] @end; + } @ctype(SpiceResourceList) inval_list; + + message { + uint8 wait_count; + WaitForChannel wait_list[wait_count] @end; + } @ctype(SpiceMsgWaitForChannels) inval_all_pixmaps; + + message { + uint64 id; + } @ctype(SpiceMsgDisplayInvalOne) inval_palette; + + Empty inval_all_palettes; + + message { + uint32 surface_id; + uint32 id; + stream_flags flags; + video_codec_type codec_type; + uint64 stamp; + uint32 stream_width; + uint32 stream_height; + uint32 src_width; + uint32 src_height; + Rect dest; + Clip clip; + } stream_create = 122; + + message { + uint32 id; + uint32 multi_media_time; + uint32 data_size; + uint8 data[data_size] @end @nomarshal; + } stream_data; + + message { + uint32 id; + Clip clip; + } stream_clip; + + message { + uint32 id; + } stream_destroy; + + Empty stream_destroy_all; + + message { + DisplayBase base; + struct Fill { + Brush brush @outvar(brush); + ropd rop_descriptor; + QMask mask @outvar(mask); + } data; + } draw_fill = 302; + + message { + DisplayBase base; + struct Opaque { + Image *src_bitmap; + Rect src_area; + Brush brush; + ropd rop_descriptor; + image_scale_mode scale_mode; + QMask mask @outvar(mask); + } data; + } draw_opaque; + + message { + DisplayBase base; + struct Copy { + Image *src_bitmap; + Rect src_area; + ropd rop_descriptor; + image_scale_mode scale_mode; + QMask mask @outvar(mask); + } data; + } draw_copy; + + message { + DisplayBase base; + struct Blend { + Image *src_bitmap; + Rect src_area; + ropd rop_descriptor; + image_scale_mode scale_mode; + QMask mask @outvar(mask); + } @ctype(SpiceCopy) data; + } draw_blend; + + message { + DisplayBase base; + struct Blackness { + QMask mask @outvar(mask); + } data; + } draw_blackness; + + message { + DisplayBase base; + struct Whiteness { + QMask mask @outvar(mask); + } data; + } draw_whiteness; + + message { + DisplayBase base; + struct Invers { + QMask mask @outvar(mask); + } data; + } draw_invers; + + message { + DisplayBase base; + struct Rop3 { + Image *src_bitmap; + Rect src_area; + Brush brush; + uint8 rop3; + image_scale_mode scale_mode; + QMask mask @outvar(mask); + } data; + } draw_rop3; + + message { + DisplayBase base; + struct Stroke { + Path *path @marshall @nonnull; + LineAttr attr; + Brush brush; + uint16 fore_mode; + uint16 back_mode; + } data; + } draw_stroke; + + message { + DisplayBase base; + struct Text { + String *str @marshall @nonnull; + Rect back_area; + Brush fore_brush @outvar(fore_brush); + Brush back_brush @outvar(back_brush); + uint16 fore_mode; + uint16 back_mode; + } data; + } draw_text; + + message { + DisplayBase base; + struct Transparent { + Image *src_bitmap; + Rect src_area; + uint32 src_color; + uint32 true_color; + } data; + } draw_transparent; + + message { + DisplayBase base; + struct AlphaBlend { + alpha_flags alpha_flags; + uint8 alpha; + Image *src_bitmap; + Rect src_area; + } data; + } draw_alpha_blend; + + message { + uint32 surface_id; + uint32 width; + uint32 height; + surface_fmt format; + surface_flags flags; + } @ctype(SpiceMsgSurfaceCreate) surface_create; + + message { + uint32 surface_id; + } @ctype(SpiceMsgSurfaceDestroy) surface_destroy; + + client: + message { + uint8 pixmap_cache_id; + int64 pixmap_cache_size; //in pixels + uint8 glz_dictionary_id; + int32 glz_dictionary_window_size; // in pixels + } init = 101; +}; + +flags16 keyboard_modifier_flags { + SCROLL_LOCK, + NUM_LOCK, + CAPS_LOCK +}; + +enum8 mouse_button { + INVALID, + LEFT, + MIDDLE, + RIGHT, + UP, + DOWN, +}; + +flags16 mouse_button_mask { + LEFT, + MIDDLE, + RIGHT +}; + +channel InputsChannel : BaseChannel { + client: + message { + uint32 code; + } @ctype(SpiceMsgcKeyDown) key_down = 101; + + message { + uint32 code; + } @ctype(SpiceMsgcKeyUp) key_up; + + message { + keyboard_modifier_flags modifiers; + } @ctype(SpiceMsgcKeyModifiers) key_modifiers; + + message { + int32 dx; + int32 dy; + mouse_button_mask buttons_state; + } @ctype(SpiceMsgcMouseMotion) mouse_motion = 111; + + message { + uint32 x; + uint32 y; + mouse_button_mask buttons_state; + uint8 display_id; + } @ctype(SpiceMsgcMousePosition) mouse_position; + + message { + mouse_button button; + mouse_button_mask buttons_state; + } @ctype(SpiceMsgcMousePress) mouse_press; + + message { + mouse_button button; + mouse_button_mask buttons_state; + } @ctype(SpiceMsgcMouseRelease) mouse_release; + + server: + message { + keyboard_modifier_flags keyboard_modifiers; + } init = 101; + + message { + keyboard_modifier_flags modifiers; + } key_modifiers; + + Empty mouse_motion_ack = 111; +}; + +enum8 cursor_type { + ALPHA, + MONO, + COLOR4, + COLOR8, + COLOR16, + COLOR24, + COLOR32, +}; + +flags16 cursor_flags { + NONE, /* Means no cursor */ + CACHE_ME, + FROM_CACHE, +}; + +struct CursorHeader { + uint64 unique; + cursor_type type; + uint16 width; + uint16 height; + uint16 hot_spot_x; + uint16 hot_spot_y; +}; + +struct Cursor { + cursor_flags flags; + switch (flags) { + case !NONE: + CursorHeader header; + } u @anon; + uint8 data[] @as_ptr(data_size); +}; + +channel CursorChannel : BaseChannel { + server: + message { + Point16 position; + uint16 trail_length; + uint16 trail_frequency; + uint8 visible; + Cursor cursor; + } init = 101; + + Empty reset; + + message { + Point16 position; + uint8 visible; + Cursor cursor; + } set; + + message { + Point16 position; + } move; + + Empty hide; + + message { + uint16 length; + uint16 frequency; + } trail; + + message { + uint64 id; + } @ctype(SpiceMsgDisplayInvalOne) inval_one; + + Empty inval_all; +}; + +enum16 audio_data_mode { + INVALID, + RAW, + CELT_0_5_1, +}; + +enum16 audio_fmt { + INVALID, + S16, +}; + +message AudioVolume { + uint8 nchannels; + uint16 volume[nchannels] @end; +}; + +message AudioMute { + uint8 mute; +}; + +channel PlaybackChannel : BaseChannel { + server: + message { + uint32 time; + uint8 data[] @as_ptr(data_size); + } @ctype(SpiceMsgPlaybackPacket) data = 101; + + message { + uint32 time; + audio_data_mode mode; + uint8 data[] @as_ptr(data_size); + } mode; + + message { + uint32 channels; + audio_fmt format; + uint32 frequency; + uint32 time; + } start; + + Empty stop; + AudioVolume volume; + AudioMute mute; +}; + +channel RecordChannel : BaseChannel { + server: + message { + uint32 channels; + audio_fmt format; + uint32 frequency; + } start = 101; + + Empty stop; + AudioVolume volume; + AudioMute mute; + client: + message { + uint32 time; + uint8 data[] @nomarshal @as_ptr(data_size); + } @ctype(SpiceMsgcRecordPacket) data = 101; + + message { + uint32 time; + audio_data_mode mode; + uint8 data[] @as_ptr(data_size); + } mode; + + message { + uint32 time; + } start_mark; +}; + +enum16 tunnel_service_type { + INVALID, + GENERIC, + IPP, +}; + +enum16 tunnel_ip_type { + INVALID, + IPv4, +}; + +struct TunnelIpInfo { + tunnel_ip_type type; + switch (type) { + case IPv4: + uint8 ipv4[4]; + } u; +} @ctype(SpiceMsgTunnelIpInfo); + +channel TunnelChannel : BaseChannel { + server: + message { + uint16 max_num_of_sockets; + uint32 max_socket_data_size; + } init = 101; + + message { + uint32 service_id; + TunnelIpInfo virtual_ip; + } service_ip_map; + + message { + uint16 connection_id; + uint32 service_id; + uint32 tokens; + } socket_open; + + message { + uint16 connection_id; + } socket_fin; + + message { + uint16 connection_id; + } socket_close; + + message { + uint16 connection_id; + uint8 data[] @end; + } socket_data; + + message { + uint16 connection_id; + } socket_closed_ack; + + message { + uint16 connection_id; + uint32 num_tokens; + } @ctype(SpiceMsgTunnelSocketTokens) socket_token; + + client: + message { + tunnel_service_type type; + uint32 id; + uint32 group; + uint32 port; + uint8 *name[cstring()] @nocopy; + uint8 *description[cstring()] @nocopy; + switch (type) { + case IPP: + TunnelIpInfo ip @ctype(SpiceMsgTunnelIpInfo); + } u; + } @ctype(SpiceMsgcTunnelAddGenericService) service_add = 101; + + message { + uint32 id; + } @ctype(SpiceMsgcTunnelRemoveService) service_remove; + + message { + uint16 connection_id; + uint32 tokens; + } socket_open_ack; + + message { + uint16 connection_id; + } socket_open_nack; + + message { + uint16 connection_id; + } socket_fin; + + message { + uint16 connection_id; + } socket_closed; + + message { + uint16 connection_id; + } socket_closed_ack; + + message { + uint16 connection_id; + uint8 data[] @end; + } socket_data; + + message { + uint16 connection_id; + uint32 num_tokens; + } @ctype(SpiceMsgcTunnelSocketTokens) socket_token; +}; + +enum32 vsc_message_type { + Init = 1, + Error, + ReaderAdd, + ReaderRemove, + ATR, + CardRemove, + APDU, + Flush, + FlushComplete +} @prefix(VSC_); + +struct VscMessageHeader { + vsc_message_type type; + uint32 reader_id; + uint32 length; +} @ctype(VSCMsgHeader); + +struct VscMessageError { + uint32 code; +} @ctype(VSCMsgError); + +struct VscMessageAPDU { + uint8 data[]; +} @ctype(VSCMsgAPDU); + +struct VscMessageATR { + uint8 data[]; +} @ctype(VSCMsgATR); + +struct VscMessageReaderAdd { + int8 *reader_name[] @zero_terminated @nonnull @end @nomarshal; +} @ctype(VSCMsgReaderAdd); + +channel SmartcardChannel : BaseChannel { + server: + message { + vsc_message_type type; + uint32 reader_id; + uint32 length; + uint8 data[] @end; + } @ctype(SpiceMsgSmartcard) msg = 101; + + client: + message { + VscMessageHeader header; + switch (header.type) { + case ReaderAdd: + VscMessageReaderAdd add; + case ATR: + case APDU: + VscMessageATR atr_data; + case Error: + VscMessageError error; + } u @anon; + } @ctype(SpiceMsgcSmartcard) msg = 101; + + message { + vsc_message_type type; + uint32 reader_id; + uint32 length; + } @ctype(VSCMsgHeader) header = 101; + + message { + uint32 code; + } @ctype(VSCMsgError) error = 101; + + message { + uint8 data[]; + } @ctype(VSCMsgATR) atr = 101; + + message { + int8 reader_name[] @zero_terminated @nonnull; + } @ctype(VSCMsgReaderAdd) reader_add = 101; +} @ifdef(USE_SMARTCARD); + +channel SpicevmcChannel : BaseChannel { +server: + Data data = 101; +client: + Data data = 101; +}; + +channel UsbredirChannel : SpicevmcChannel { +}; + +protocol Spice { + MainChannel main = 1; + DisplayChannel display; + InputsChannel inputs; + CursorChannel cursor; + PlaybackChannel playback; + RecordChannel record; + TunnelChannel tunnel; + SmartcardChannel smartcard; + UsbredirChannel usbredir; +}; diff -Nru spice-gtk-0.9/spice-common/spice-protocol/aclocal.m4 spice-gtk-0.12/spice-common/spice-protocol/aclocal.m4 --- spice-gtk-0.9/spice-common/spice-protocol/aclocal.m4 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/aclocal.m4 2012-04-24 11:20:47.000000000 +0000 @@ -0,0 +1,762 @@ +# generated automatically by aclocal 1.11.3 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, +# Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, +[m4_warning([this file was generated for autoconf 2.68. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software +# Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.11' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.11.3], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.11.3])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 16 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.62])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl +]) + +dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, +# Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, +# 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_MAINTAINER_MODE([DEFAULT-MODE]) +# ---------------------------------- +# Control maintainer-specific portions of Makefiles. +# Default is to disable them, unless `enable' is passed literally. +# For symmetry, `disable' may be passed as well. Anyway, the user +# can override the default with the --enable/--disable switch. +AC_DEFUN([AM_MAINTAINER_MODE], +[m4_case(m4_default([$1], [disable]), + [enable], [m4_define([am_maintainer_other], [disable])], + [disable], [m4_define([am_maintainer_other], [enable])], + [m4_define([am_maintainer_other], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode's default is 'disable' unless 'enable' is passed + AC_ARG_ENABLE([maintainer-mode], +[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST([MAINT])dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, +# Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software +# Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2009, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# (`yes' being less verbose, `no' or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], +[ --enable-silent-rules less verbose build output (undo: `make V=1') + --disable-silent-rules verbose build output (undo: `make V=0')]) +case $enable_silent_rules in +yes) AM_DEFAULT_VERBOSITY=0;; +no) AM_DEFAULT_VERBOSITY=1;; +*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few `make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using `$V' instead of `$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 1 + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff -Nru spice-gtk-0.9/spice-common/spice-protocol/config.h.in spice-gtk-0.12/spice-common/spice-protocol/config.h.in --- spice-gtk-0.9/spice-common/spice-protocol/config.h.in 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/config.h.in 2012-04-24 11:20:48.000000000 +0000 @@ -0,0 +1,25 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Version number of package */ +#undef VERSION diff -Nru spice-gtk-0.9/spice-common/spice-protocol/configure spice-gtk-0.12/spice-common/spice-protocol/configure --- spice-gtk-0.9/spice-common/spice-protocol/configure 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/configure 2012-04-24 11:20:48.000000000 +0000 @@ -0,0 +1,3608 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.68 for spice-protocol 0.10.2. +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='spice-protocol' +PACKAGE_TARNAME='spice-protocol' +PACKAGE_VERSION='0.10.2' +PACKAGE_STRING='spice-protocol 0.10.2' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + +ac_subst_vars='LTLIBOBJS +LIBOBJS +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_maintainer_mode +enable_silent_rules +' + ac_precious_vars='build_alias +host_alias +target_alias' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures spice-protocol 0.10.2 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/spice-protocol] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of spice-protocol 0.10.2:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-silent-rules less verbose build output (undo: `make V=1') + --disable-silent-rules verbose build output (undo: `make V=0') + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +spice-protocol configure 0.10.2 +generated by GNU Autoconf 2.68 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by spice-protocol $as_me 0.10.2, which was +generated by GNU Autoconf 2.68. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + +ac_config_headers="$ac_config_headers config.h" + + +am__api_version='1.11' + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='spice-protocol' + VERSION='0.10.2' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in +yes) AM_DEFAULT_VERBOSITY=0;; +no) AM_DEFAULT_VERBOSITY=1;; +*) AM_DEFAULT_VERBOSITY=0;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + + +ac_config_files="$ac_config_files Makefile spice-protocol.pc spice/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by spice-protocol $as_me 0.10.2, which was +generated by GNU Autoconf 2.68. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +spice-protocol config.status 0.10.2 +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "spice-protocol.pc") CONFIG_FILES="$CONFIG_FILES spice-protocol.pc" ;; + "spice/Makefile") CONFIG_FILES="$CONFIG_FILES spice/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff -Nru spice-gtk-0.9/spice-common/spice-protocol/configure.ac spice-gtk-0.12/spice-common/spice-protocol/configure.ac --- spice-gtk-0.9/spice-common/spice-protocol/configure.ac 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/configure.ac 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,21 @@ +AC_PREREQ([2.57]) + +m4_define([SPICE_MAJOR], 0) +m4_define([SPICE_MINOR], 10) +m4_define([SPICE_MICRO], 2) + +AC_INIT(spice-protocol, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice-protocol) + +AC_CONFIG_MACRO_DIR([m4]) +AM_CONFIG_HEADER([config.h]) + +AM_INIT_AUTOMAKE([dist-bzip2]) +AM_MAINTAINER_MODE + +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) + +AC_OUTPUT([ +Makefile +spice-protocol.pc +spice/Makefile +]) diff -Nru spice-gtk-0.9/spice-common/spice-protocol/COPYING spice-gtk-0.12/spice-common/spice-protocol/COPYING --- spice-gtk-0.9/spice-common/spice-protocol/COPYING 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/COPYING 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,25 @@ +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 copyright holder 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 HOLDER 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 +HOLDER OR CONTRIBUTORS 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. diff -Nru spice-gtk-0.9/spice-common/spice-protocol/INSTALL spice-gtk-0.12/spice-common/spice-protocol/INSTALL --- spice-gtk-0.9/spice-common/spice-protocol/INSTALL 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/INSTALL 2012-04-24 11:20:48.000000000 +0000 @@ -0,0 +1,370 @@ +Installation Instructions +************************* + +Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, +Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + + The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type `make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. + + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX `make' updates targets which have the same time stamps as +their prerequisites, which makes it generally unusable when shipped +generated files such as `configure' are involved. Use GNU `make' +instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff -Nru spice-gtk-0.9/spice-common/spice-protocol/install-sh spice-gtk-0.12/spice-common/spice-protocol/install-sh --- spice-gtk-0.9/spice-common/spice-protocol/install-sh 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/install-sh 2012-04-24 11:20:48.000000000 +0000 @@ -0,0 +1,527 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2011-01-19.21; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + # Protect names problematic for `test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for `test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for `test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru spice-gtk-0.9/spice-common/spice-protocol/Makefile.am spice-gtk-0.12/spice-common/spice-protocol/Makefile.am --- spice-gtk-0.9/spice-common/spice-protocol/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/Makefile.am 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,24 @@ +NULL = +SUBDIRS = spice + +pkgconfigdir = $(datadir)/pkgconfig +pkgconfig_DATA = spice-protocol.pc + +MAINTAINERCLEANFILES = \ + $(srcdir)/INSTALL \ + $(srcdir)/aclocal.m4 \ + $(srcdir)/autoscan.log \ + $(srcdir)/compile \ + $(srcdir)/config.guess \ + $(srcdir)/config.h.in \ + $(srcdir)/config.sub \ + $(srcdir)/configure.scan \ + $(srcdir)/depcomp \ + $(srcdir)/install-sh \ + $(srcdir)/ltmain.sh \ + $(srcdir)/missing \ + $(srcdir)/mkinstalldirs \ + `find "$(srcdir)" -type f -name Makefile.in -print` \ + $(NULL) + +-include $(top_srcdir)/git.mk diff -Nru spice-gtk-0.9/spice-common/spice-protocol/Makefile.in spice-gtk-0.12/spice-common/spice-protocol/Makefile.in --- spice-gtk-0.9/spice-common/spice-protocol/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/Makefile.in 2012-04-24 11:20:49.000000000 +0000 @@ -0,0 +1,768 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(srcdir)/spice-protocol.pc.in $(top_srcdir)/configure AUTHORS \ + COPYING ChangeLog INSTALL NEWS install-sh missing +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = spice-protocol.pc +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(pkgconfigdir)" +DATA = $(pkgconfig_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir dist dist-all distcheck +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +SUBDIRS = spice +pkgconfigdir = $(datadir)/pkgconfig +pkgconfig_DATA = spice-protocol.pc +MAINTAINERCLEANFILES = \ + $(srcdir)/INSTALL \ + $(srcdir)/aclocal.m4 \ + $(srcdir)/autoscan.log \ + $(srcdir)/compile \ + $(srcdir)/config.guess \ + $(srcdir)/config.h.in \ + $(srcdir)/config.sub \ + $(srcdir)/configure.scan \ + $(srcdir)/depcomp \ + $(srcdir)/install-sh \ + $(srcdir)/ltmain.sh \ + $(srcdir)/missing \ + $(srcdir)/mkinstalldirs \ + `find "$(srcdir)" -type f -name Makefile.in -print` \ + $(NULL) + +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @if test ! -f $@; then rm -f stamp-h1; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +spice-protocol.pc: $(top_builddir)/config.status $(srcdir)/spice-protocol.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile $(DATA) config.h +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-pkgconfigDATA + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-pkgconfigDATA + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ + ctags-recursive install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ + distcheck distclean distclean-generic distclean-hdr \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-recursive uninstall uninstall-am uninstall-pkgconfigDATA + + +-include $(top_srcdir)/git.mk + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru spice-gtk-0.9/spice-common/spice-protocol/missing spice-gtk-0.12/spice-common/spice-protocol/missing --- spice-gtk-0.9/spice-common/spice-protocol/missing 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/missing 2012-04-24 11:20:48.000000000 +0000 @@ -0,0 +1,331 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2012-01-06.13; # UTC + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru spice-gtk-0.9/spice-common/spice-protocol/NEWS spice-gtk-0.12/spice-common/spice-protocol/NEWS --- spice-gtk-0.9/spice-common/spice-protocol/NEWS 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/NEWS 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,77 @@ +Major changes in 0.10.1 +======================= +* Add support for a header without sublist and serial (mini header) + +Major changes in 0.10.0 +======================= +* no changes, released to match version with spice + +Major changes in 0.9.1 (same as 0.8.2 in 0.8 branch) +====================== +* Add support for semi-seamless migration + +Major changes in 0.9.0 +====================== +* Add support for generic spicevmc chardev passthrough messages +* Add USB redirection channel + +Major changes in 0.8.1 +====================== +* Add support for volume change +* Add support for async guest io writes and interrupt +* Add support for suspend related guest io writes +* Add support for interrupt indicating guest bug + +Major changes in 0.8.0 +====================== +* Add support for different clipboards (selections) to vd_agent copy paste +* Add support for using different authentication mechanisms (just SASL for now) + +Major changes in 0.7.1 +====================== +* Add some enums for the xorg qxl driver +* Some other small fixes + +Major changes in 0.7.0 +====================== +* Add smartcard channel + +Major changes in 0.6.4 +====================== +* Make controller client protocol menu text UTF8 rather then 16 bit unicode + +Major changes in 0.6.3: +======================= +* Add support for copy and paste to the agent protocol +* Add foreign-menu and external controller client protocol headers + +Major changes in 0.6.2: +======================= +* Skipped to stay in sync with spice + +Major changes in 0.6.1: +======================= +* Added compat flag for 16bpp commands + +Major changes in 0.6.0: +======================= +* Initial messages for clipboard sharing +* Move agent protocol structs from spice to spice-protocol +* Add capabilities to agent protocol + +Major changes in 0.5.3: +======================= + +Network major number changed to 2 to reflect that the network +protocol is now stable and backwards compatible from this point. + +Some vdagent messages for display settings and clipboard sharing +were added. + +Major changes in 0.5.2: +======================= + +This is the first release of the unstable 0.5.x series leading up to 0.6. +This module was split out of spice so that e.g. drivers and qemu can +get the types and constants they need without using the full spice +codebase. diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/barrier.h spice-gtk-0.12/spice-common/spice-protocol/spice/barrier.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/barrier.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/barrier.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,55 @@ +/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + 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 copyright holder 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 HOLDER 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 + HOLDER OR CONTRIBUTORS 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. +*/ + +#ifndef _H_SPICE_BARRIER +#define _H_SPICE_BARRIER + +#ifdef __GNUC__ + +#ifdef __i386__ +#define spice_mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory") +#else +//mfence +#define spice_mb() __asm__ __volatile__ ("lock; addl $0,0(%%rsp)": : :"memory") +#endif + +#else + +#ifdef _WIN64 +//__asm not supported on _WIN64, so use macro instead. +#define spice_mb MemoryBarrier +#else +#define spice_mb() __asm {lock add [esp], 0} +#endif + +#endif + +#endif /* _H_SPICE_BARRIER */ diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/controller_prot.h spice-gtk-0.12/spice-common/spice-protocol/spice/controller_prot.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/controller_prot.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/controller_prot.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,122 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H_CONTROLLER_PROT +#define _H_CONTROLLER_PROT + +#include +#include + +#define CONTROLLER_MAGIC (*(uint32_t*)"CTRL") +#define CONTROLLER_VERSION 1 + + +typedef struct SPICE_ATTR_PACKED ControllerInitHeader { + uint32_t magic; + uint32_t version; + uint32_t size; +} ControllerInitHeader; + +typedef struct SPICE_ATTR_PACKED ControllerInit { + ControllerInitHeader base; + uint64_t credentials; + uint32_t flags; +} ControllerInit; + +enum { + CONTROLLER_FLAG_EXCLUSIVE = 1 << 0, +}; + +typedef struct SPICE_ATTR_PACKED ControllerMsg { + uint32_t id; + uint32_t size; +} ControllerMsg; + +enum { + //extrenal app -> spice client + CONTROLLER_HOST = 1, + CONTROLLER_PORT, + CONTROLLER_SPORT, + CONTROLLER_PASSWORD, + + CONTROLLER_SECURE_CHANNELS, + CONTROLLER_DISABLE_CHANNELS, + + CONTROLLER_TLS_CIPHERS, + CONTROLLER_CA_FILE, + CONTROLLER_HOST_SUBJECT, + + CONTROLLER_FULL_SCREEN, + CONTROLLER_SET_TITLE, + + CONTROLLER_CREATE_MENU, + CONTROLLER_DELETE_MENU, + + CONTROLLER_HOTKEYS, + CONTROLLER_SEND_CAD, + + CONTROLLER_CONNECT, + CONTROLLER_SHOW, + CONTROLLER_HIDE, + + CONTROLLER_ENABLE_SMARTCARD, + + CONTROLLER_COLOR_DEPTH, + CONTROLLER_DISABLE_EFFECTS, + + CONTROLLER_ENABLE_USB, + CONTROLLER_ENABLE_USB_AUTOSHARE, + CONTROLLER_USB_FILTER, + + //spice client -> external app + CONTROLLER_MENU_ITEM_CLICK = 1001, +}; + +#define CONTROLLER_TRUE (1 << 0) + +enum { + CONTROLLER_SET_FULL_SCREEN = CONTROLLER_TRUE, + CONTROLLER_AUTO_DISPLAY_RES = 1 << 1, +}; + +typedef struct SPICE_ATTR_PACKED ControllerValue { + ControllerMsg base; + uint32_t value; +} ControllerValue; + +typedef struct SPICE_ATTR_PACKED ControllerData { + ControllerMsg base; + uint8_t data[0]; +} ControllerData; + +#define CONTROLLER_MENU_ITEM_DELIMITER "\n" +#define CONTROLLER_MENU_PARAM_DELIMITER "\r" + +enum { + CONTROLLER_MENU_FLAGS_SEPARATOR = 1 << 0, + CONTROLLER_MENU_FLAGS_DISABLED = 1 << 1, + CONTROLLER_MENU_FLAGS_POPUP = 1 << 2, + CONTROLLER_MENU_FLAGS_CHECKED = 1 << 3, + CONTROLLER_MENU_FLAGS_GRAYED = 1 << 4, +}; + +#define SPICE_MENU_INTERNAL_ID_BASE 0x1300 +#define SPICE_MENU_INTERNAL_ID_SHIFT 8 + +#include + +#endif diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/end-packed.h spice-gtk-0.12/spice-common/spice-protocol/spice/end-packed.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/end-packed.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/end-packed.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,38 @@ +/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + 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 copyright holder 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 HOLDER 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 + HOLDER OR CONTRIBUTORS 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. +*/ + +/* See start-packed.h for details */ + +#undef SPICE_ATTR_PACKED + +#if defined(__MINGW32__) || !defined(__GNUC__) +#pragma pack(pop) +#endif diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/enums.h spice-gtk-0.12/spice-common/spice-protocol/spice/enums.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/enums.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/enums.h 2012-04-21 18:50:52.000000000 +0000 @@ -0,0 +1,540 @@ +/* this is a file autogenerated by spice_codegen.py */ +#ifndef _H_SPICE_ENUMS +#define _H_SPICE_ENUMS + +/* Generated from spice.proto, don't edit */ + +typedef enum SpiceLinkErr { + SPICE_LINK_ERR_OK, + SPICE_LINK_ERR_ERROR, + SPICE_LINK_ERR_INVALID_MAGIC, + SPICE_LINK_ERR_INVALID_DATA, + SPICE_LINK_ERR_VERSION_MISMATCH, + SPICE_LINK_ERR_NEED_SECURED, + SPICE_LINK_ERR_NEED_UNSECURED, + SPICE_LINK_ERR_PERMISSION_DENIED, + SPICE_LINK_ERR_BAD_CONNECTION_ID, + SPICE_LINK_ERR_CHANNEL_NOT_AVAILABLE, + + SPICE_LINK_ERR_ENUM_END +} SpiceLinkErr; + +typedef enum SpiceWarnCode { + SPICE_WARN_GENERAL, + + SPICE_WARN_CODE_ENUM_END +} SpiceWarnCode; + +typedef enum SpiceInfoCode { + SPICE_INFO_GENERAL, + + SPICE_INFO_CODE_ENUM_END +} SpiceInfoCode; + +typedef enum SpiceMigrateFlags { + SPICE_MIGRATE_NEED_FLUSH = (1 << 0), + SPICE_MIGRATE_NEED_DATA_TRANSFER = (1 << 1), + + SPICE_MIGRATE_FLAGS_MASK = 0x3 +} SpiceMigrateFlags; + +typedef enum SpiceNotifySeverity { + SPICE_NOTIFY_SEVERITY_INFO, + SPICE_NOTIFY_SEVERITY_WARN, + SPICE_NOTIFY_SEVERITY_ERROR, + + SPICE_NOTIFY_SEVERITY_ENUM_END +} SpiceNotifySeverity; + +typedef enum SpiceNotifyVisibility { + SPICE_NOTIFY_VISIBILITY_LOW, + SPICE_NOTIFY_VISIBILITY_MEDIUM, + SPICE_NOTIFY_VISIBILITY_HIGH, + + SPICE_NOTIFY_VISIBILITY_ENUM_END +} SpiceNotifyVisibility; + +typedef enum SpiceMouseMode { + SPICE_MOUSE_MODE_SERVER = (1 << 0), + SPICE_MOUSE_MODE_CLIENT = (1 << 1), + + SPICE_MOUSE_MODE_MASK = 0x3 +} SpiceMouseMode; + +typedef enum SpicePubkeyType { + SPICE_PUBKEY_TYPE_INVALID, + SPICE_PUBKEY_TYPE_RSA, + SPICE_PUBKEY_TYPE_RSA2, + SPICE_PUBKEY_TYPE_DSA, + SPICE_PUBKEY_TYPE_DSA1, + SPICE_PUBKEY_TYPE_DSA2, + SPICE_PUBKEY_TYPE_DSA3, + SPICE_PUBKEY_TYPE_DSA4, + SPICE_PUBKEY_TYPE_DH, + SPICE_PUBKEY_TYPE_EC, + + SPICE_PUBKEY_TYPE_ENUM_END +} SpicePubkeyType; + +typedef enum SpiceClipType { + SPICE_CLIP_TYPE_NONE, + SPICE_CLIP_TYPE_RECTS, + + SPICE_CLIP_TYPE_ENUM_END +} SpiceClipType; + +typedef enum SpicePathFlags { + SPICE_PATH_BEGIN = (1 << 0), + SPICE_PATH_END = (1 << 1), + SPICE_PATH_CLOSE = (1 << 3), + SPICE_PATH_BEZIER = (1 << 4), + + SPICE_PATH_FLAGS_MASK = 0x1b +} SpicePathFlags; + +typedef enum SpiceVideoCodecType { + SPICE_VIDEO_CODEC_TYPE_MJPEG = 1, + + SPICE_VIDEO_CODEC_TYPE_ENUM_END +} SpiceVideoCodecType; + +typedef enum SpiceStreamFlags { + SPICE_STREAM_FLAGS_TOP_DOWN = (1 << 0), + + SPICE_STREAM_FLAGS_MASK = 0x1 +} SpiceStreamFlags; + +typedef enum SpiceBrushType { + SPICE_BRUSH_TYPE_NONE, + SPICE_BRUSH_TYPE_SOLID, + SPICE_BRUSH_TYPE_PATTERN, + + SPICE_BRUSH_TYPE_ENUM_END +} SpiceBrushType; + +typedef enum SpiceMaskFlags { + SPICE_MASK_FLAGS_INVERS = (1 << 0), + + SPICE_MASK_FLAGS_MASK = 0x1 +} SpiceMaskFlags; + +typedef enum SpiceImageType { + SPICE_IMAGE_TYPE_BITMAP, + SPICE_IMAGE_TYPE_QUIC, + SPICE_IMAGE_TYPE_RESERVED, + SPICE_IMAGE_TYPE_LZ_PLT = 100, + SPICE_IMAGE_TYPE_LZ_RGB, + SPICE_IMAGE_TYPE_GLZ_RGB, + SPICE_IMAGE_TYPE_FROM_CACHE, + SPICE_IMAGE_TYPE_SURFACE, + SPICE_IMAGE_TYPE_JPEG, + SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS, + SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB, + SPICE_IMAGE_TYPE_JPEG_ALPHA, + + SPICE_IMAGE_TYPE_ENUM_END +} SpiceImageType; + +typedef enum SpiceImageFlags { + SPICE_IMAGE_FLAGS_CACHE_ME = (1 << 0), + SPICE_IMAGE_FLAGS_HIGH_BITS_SET = (1 << 1), + SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME = (1 << 2), + + SPICE_IMAGE_FLAGS_MASK = 0x7 +} SpiceImageFlags; + +typedef enum SpiceBitmapFmt { + SPICE_BITMAP_FMT_INVALID, + SPICE_BITMAP_FMT_1BIT_LE, + SPICE_BITMAP_FMT_1BIT_BE, + SPICE_BITMAP_FMT_4BIT_LE, + SPICE_BITMAP_FMT_4BIT_BE, + SPICE_BITMAP_FMT_8BIT, + SPICE_BITMAP_FMT_16BIT, + SPICE_BITMAP_FMT_24BIT, + SPICE_BITMAP_FMT_32BIT, + SPICE_BITMAP_FMT_RGBA, + + SPICE_BITMAP_FMT_ENUM_END +} SpiceBitmapFmt; + +typedef enum SpiceBitmapFlags { + SPICE_BITMAP_FLAGS_PAL_CACHE_ME = (1 << 0), + SPICE_BITMAP_FLAGS_PAL_FROM_CACHE = (1 << 1), + SPICE_BITMAP_FLAGS_TOP_DOWN = (1 << 2), + + SPICE_BITMAP_FLAGS_MASK = 0x7 +} SpiceBitmapFlags; + +typedef enum SpiceJpegAlphaFlags { + SPICE_JPEG_ALPHA_FLAGS_TOP_DOWN = (1 << 0), + + SPICE_JPEG_ALPHA_FLAGS_MASK = 0x1 +} SpiceJpegAlphaFlags; + +typedef enum SpiceImageScaleMode { + SPICE_IMAGE_SCALE_MODE_INTERPOLATE, + SPICE_IMAGE_SCALE_MODE_NEAREST, + + SPICE_IMAGE_SCALE_MODE_ENUM_END +} SpiceImageScaleMode; + +typedef enum SpiceRopd { + SPICE_ROPD_INVERS_SRC = (1 << 0), + SPICE_ROPD_INVERS_BRUSH = (1 << 1), + SPICE_ROPD_INVERS_DEST = (1 << 2), + SPICE_ROPD_OP_PUT = (1 << 3), + SPICE_ROPD_OP_OR = (1 << 4), + SPICE_ROPD_OP_AND = (1 << 5), + SPICE_ROPD_OP_XOR = (1 << 6), + SPICE_ROPD_OP_BLACKNESS = (1 << 7), + SPICE_ROPD_OP_WHITENESS = (1 << 8), + SPICE_ROPD_OP_INVERS = (1 << 9), + SPICE_ROPD_INVERS_RES = (1 << 10), + + SPICE_ROPD_MASK = 0x7ff +} SpiceRopd; + +typedef enum SpiceLineFlags { + SPICE_LINE_FLAGS_START_WITH_GAP = (1 << 2), + SPICE_LINE_FLAGS_STYLED = (1 << 3), + + SPICE_LINE_FLAGS_MASK = 0xc +} SpiceLineFlags; + +typedef enum SpiceStringFlags { + SPICE_STRING_FLAGS_RASTER_A1 = (1 << 0), + SPICE_STRING_FLAGS_RASTER_A4 = (1 << 1), + SPICE_STRING_FLAGS_RASTER_A8 = (1 << 2), + SPICE_STRING_FLAGS_RASTER_TOP_DOWN = (1 << 3), + + SPICE_STRING_FLAGS_MASK = 0xf +} SpiceStringFlags; + +typedef enum SpiceSurfaceFlags { + SPICE_SURFACE_FLAGS_PRIMARY = (1 << 0), + + SPICE_SURFACE_FLAGS_MASK = 0x1 +} SpiceSurfaceFlags; + +typedef enum SpiceSurfaceFmt { + SPICE_SURFACE_FMT_INVALID, + SPICE_SURFACE_FMT_1_A, + SPICE_SURFACE_FMT_8_A = 8, + SPICE_SURFACE_FMT_16_555 = 16, + SPICE_SURFACE_FMT_32_xRGB = 32, + SPICE_SURFACE_FMT_16_565 = 80, + SPICE_SURFACE_FMT_32_ARGB = 96, + + SPICE_SURFACE_FMT_ENUM_END +} SpiceSurfaceFmt; + +typedef enum SpiceAlphaFlags { + SPICE_ALPHA_FLAGS_DEST_HAS_ALPHA = (1 << 0), + SPICE_ALPHA_FLAGS_SRC_SURFACE_HAS_ALPHA = (1 << 1), + + SPICE_ALPHA_FLAGS_MASK = 0x3 +} SpiceAlphaFlags; + +typedef enum SpiceResourceType { + SPICE_RES_TYPE_INVALID, + SPICE_RES_TYPE_PIXMAP, + + SPICE_RESOURCE_TYPE_ENUM_END +} SpiceResourceType; + +typedef enum SpiceKeyboardModifierFlags { + SPICE_KEYBOARD_MODIFIER_FLAGS_SCROLL_LOCK = (1 << 0), + SPICE_KEYBOARD_MODIFIER_FLAGS_NUM_LOCK = (1 << 1), + SPICE_KEYBOARD_MODIFIER_FLAGS_CAPS_LOCK = (1 << 2), + + SPICE_KEYBOARD_MODIFIER_FLAGS_MASK = 0x7 +} SpiceKeyboardModifierFlags; + +typedef enum SpiceMouseButton { + SPICE_MOUSE_BUTTON_INVALID, + SPICE_MOUSE_BUTTON_LEFT, + SPICE_MOUSE_BUTTON_MIDDLE, + SPICE_MOUSE_BUTTON_RIGHT, + SPICE_MOUSE_BUTTON_UP, + SPICE_MOUSE_BUTTON_DOWN, + + SPICE_MOUSE_BUTTON_ENUM_END +} SpiceMouseButton; + +typedef enum SpiceMouseButtonMask { + SPICE_MOUSE_BUTTON_MASK_LEFT = (1 << 0), + SPICE_MOUSE_BUTTON_MASK_MIDDLE = (1 << 1), + SPICE_MOUSE_BUTTON_MASK_RIGHT = (1 << 2), + + SPICE_MOUSE_BUTTON_MASK_MASK = 0x7 +} SpiceMouseButtonMask; + +typedef enum SpiceCursorType { + SPICE_CURSOR_TYPE_ALPHA, + SPICE_CURSOR_TYPE_MONO, + SPICE_CURSOR_TYPE_COLOR4, + SPICE_CURSOR_TYPE_COLOR8, + SPICE_CURSOR_TYPE_COLOR16, + SPICE_CURSOR_TYPE_COLOR24, + SPICE_CURSOR_TYPE_COLOR32, + + SPICE_CURSOR_TYPE_ENUM_END +} SpiceCursorType; + +typedef enum SpiceCursorFlags { + SPICE_CURSOR_FLAGS_NONE = (1 << 0), + SPICE_CURSOR_FLAGS_CACHE_ME = (1 << 1), + SPICE_CURSOR_FLAGS_FROM_CACHE = (1 << 2), + + SPICE_CURSOR_FLAGS_MASK = 0x7 +} SpiceCursorFlags; + +typedef enum SpiceAudioDataMode { + SPICE_AUDIO_DATA_MODE_INVALID, + SPICE_AUDIO_DATA_MODE_RAW, + SPICE_AUDIO_DATA_MODE_CELT_0_5_1, + + SPICE_AUDIO_DATA_MODE_ENUM_END +} SpiceAudioDataMode; + +typedef enum SpiceAudioFmt { + SPICE_AUDIO_FMT_INVALID, + SPICE_AUDIO_FMT_S16, + + SPICE_AUDIO_FMT_ENUM_END +} SpiceAudioFmt; + +typedef enum SpiceTunnelServiceType { + SPICE_TUNNEL_SERVICE_TYPE_INVALID, + SPICE_TUNNEL_SERVICE_TYPE_GENERIC, + SPICE_TUNNEL_SERVICE_TYPE_IPP, + + SPICE_TUNNEL_SERVICE_TYPE_ENUM_END +} SpiceTunnelServiceType; + +typedef enum SpiceTunnelIpType { + SPICE_TUNNEL_IP_TYPE_INVALID, + SPICE_TUNNEL_IP_TYPE_IPv4, + + SPICE_TUNNEL_IP_TYPE_ENUM_END +} SpiceTunnelIpType; + +enum { + SPICE_CHANNEL_MAIN = 1, + SPICE_CHANNEL_DISPLAY, + SPICE_CHANNEL_INPUTS, + SPICE_CHANNEL_CURSOR, + SPICE_CHANNEL_PLAYBACK, + SPICE_CHANNEL_RECORD, + SPICE_CHANNEL_TUNNEL, + SPICE_CHANNEL_SMARTCARD, + SPICE_CHANNEL_USBREDIR, + + SPICE_END_CHANNEL +}; + +enum { + SPICE_MSG_MIGRATE = 1, + SPICE_MSG_MIGRATE_DATA, + SPICE_MSG_SET_ACK, + SPICE_MSG_PING, + SPICE_MSG_WAIT_FOR_CHANNELS, + SPICE_MSG_DISCONNECTING, + SPICE_MSG_NOTIFY, + SPICE_MSG_LIST, +}; + +enum { + SPICE_MSGC_ACK_SYNC = 1, + SPICE_MSGC_ACK, + SPICE_MSGC_PONG, + SPICE_MSGC_MIGRATE_FLUSH_MARK, + SPICE_MSGC_MIGRATE_DATA, + SPICE_MSGC_DISCONNECTING, +}; + +enum { + SPICE_MSG_MAIN_MIGRATE_BEGIN = 101, + SPICE_MSG_MAIN_MIGRATE_CANCEL, + SPICE_MSG_MAIN_INIT, + SPICE_MSG_MAIN_CHANNELS_LIST, + SPICE_MSG_MAIN_MOUSE_MODE, + SPICE_MSG_MAIN_MULTI_MEDIA_TIME, + SPICE_MSG_MAIN_AGENT_CONNECTED, + SPICE_MSG_MAIN_AGENT_DISCONNECTED, + SPICE_MSG_MAIN_AGENT_DATA, + SPICE_MSG_MAIN_AGENT_TOKEN, + SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST, + SPICE_MSG_MAIN_MIGRATE_END, + SPICE_MSG_MAIN_NAME, + SPICE_MSG_MAIN_UUID, + + SPICE_MSG_END_MAIN +}; + +enum { + SPICE_MSGC_MAIN_CLIENT_INFO = 101, + SPICE_MSGC_MAIN_MIGRATE_CONNECTED, + SPICE_MSGC_MAIN_MIGRATE_CONNECT_ERROR, + SPICE_MSGC_MAIN_ATTACH_CHANNELS, + SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST, + SPICE_MSGC_MAIN_AGENT_START, + SPICE_MSGC_MAIN_AGENT_DATA, + SPICE_MSGC_MAIN_AGENT_TOKEN, + SPICE_MSGC_MAIN_MIGRATE_END, + + SPICE_MSGC_END_MAIN +}; + +enum { + SPICE_MSG_DISPLAY_MODE = 101, + SPICE_MSG_DISPLAY_MARK, + SPICE_MSG_DISPLAY_RESET, + SPICE_MSG_DISPLAY_COPY_BITS, + SPICE_MSG_DISPLAY_INVAL_LIST, + SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS, + SPICE_MSG_DISPLAY_INVAL_PALETTE, + SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES, + SPICE_MSG_DISPLAY_STREAM_CREATE = 122, + SPICE_MSG_DISPLAY_STREAM_DATA, + SPICE_MSG_DISPLAY_STREAM_CLIP, + SPICE_MSG_DISPLAY_STREAM_DESTROY, + SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL, + SPICE_MSG_DISPLAY_DRAW_FILL = 302, + SPICE_MSG_DISPLAY_DRAW_OPAQUE, + SPICE_MSG_DISPLAY_DRAW_COPY, + SPICE_MSG_DISPLAY_DRAW_BLEND, + SPICE_MSG_DISPLAY_DRAW_BLACKNESS, + SPICE_MSG_DISPLAY_DRAW_WHITENESS, + SPICE_MSG_DISPLAY_DRAW_INVERS, + SPICE_MSG_DISPLAY_DRAW_ROP3, + SPICE_MSG_DISPLAY_DRAW_STROKE, + SPICE_MSG_DISPLAY_DRAW_TEXT, + SPICE_MSG_DISPLAY_DRAW_TRANSPARENT, + SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND, + SPICE_MSG_DISPLAY_SURFACE_CREATE, + SPICE_MSG_DISPLAY_SURFACE_DESTROY, + + SPICE_MSG_END_DISPLAY +}; + +enum { + SPICE_MSGC_DISPLAY_INIT = 101, + + SPICE_MSGC_END_DISPLAY +}; + +enum { + SPICE_MSG_INPUTS_INIT = 101, + SPICE_MSG_INPUTS_KEY_MODIFIERS, + SPICE_MSG_INPUTS_MOUSE_MOTION_ACK = 111, + + SPICE_MSG_END_INPUTS +}; + +enum { + SPICE_MSGC_INPUTS_KEY_DOWN = 101, + SPICE_MSGC_INPUTS_KEY_UP, + SPICE_MSGC_INPUTS_KEY_MODIFIERS, + SPICE_MSGC_INPUTS_MOUSE_MOTION = 111, + SPICE_MSGC_INPUTS_MOUSE_POSITION, + SPICE_MSGC_INPUTS_MOUSE_PRESS, + SPICE_MSGC_INPUTS_MOUSE_RELEASE, + + SPICE_MSGC_END_INPUTS +}; + +enum { + SPICE_MSG_CURSOR_INIT = 101, + SPICE_MSG_CURSOR_RESET, + SPICE_MSG_CURSOR_SET, + SPICE_MSG_CURSOR_MOVE, + SPICE_MSG_CURSOR_HIDE, + SPICE_MSG_CURSOR_TRAIL, + SPICE_MSG_CURSOR_INVAL_ONE, + SPICE_MSG_CURSOR_INVAL_ALL, + + SPICE_MSG_END_CURSOR +}; + +enum { + SPICE_MSG_PLAYBACK_DATA = 101, + SPICE_MSG_PLAYBACK_MODE, + SPICE_MSG_PLAYBACK_START, + SPICE_MSG_PLAYBACK_STOP, + SPICE_MSG_PLAYBACK_VOLUME, + SPICE_MSG_PLAYBACK_MUTE, + + SPICE_MSG_END_PLAYBACK +}; + +enum { + SPICE_MSG_RECORD_START = 101, + SPICE_MSG_RECORD_STOP, + SPICE_MSG_RECORD_VOLUME, + SPICE_MSG_RECORD_MUTE, + + SPICE_MSG_END_RECORD +}; + +enum { + SPICE_MSGC_RECORD_DATA = 101, + SPICE_MSGC_RECORD_MODE, + SPICE_MSGC_RECORD_START_MARK, + + SPICE_MSGC_END_RECORD +}; + +enum { + SPICE_MSG_TUNNEL_INIT = 101, + SPICE_MSG_TUNNEL_SERVICE_IP_MAP, + SPICE_MSG_TUNNEL_SOCKET_OPEN, + SPICE_MSG_TUNNEL_SOCKET_FIN, + SPICE_MSG_TUNNEL_SOCKET_CLOSE, + SPICE_MSG_TUNNEL_SOCKET_DATA, + SPICE_MSG_TUNNEL_SOCKET_CLOSED_ACK, + SPICE_MSG_TUNNEL_SOCKET_TOKEN, + + SPICE_MSG_END_TUNNEL +}; + +enum { + SPICE_MSGC_TUNNEL_SERVICE_ADD = 101, + SPICE_MSGC_TUNNEL_SERVICE_REMOVE, + SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK, + SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK, + SPICE_MSGC_TUNNEL_SOCKET_FIN, + SPICE_MSGC_TUNNEL_SOCKET_CLOSED, + SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK, + SPICE_MSGC_TUNNEL_SOCKET_DATA, + SPICE_MSGC_TUNNEL_SOCKET_TOKEN, + + SPICE_MSGC_END_TUNNEL +}; + +enum { + SPICE_MSG_SMARTCARD_DATA = 101, + + SPICE_MSG_END_SMARTCARD +}; + +enum { + SPICE_MSGC_SMARTCARD_DATA = 101, + + SPICE_MSGC_END_SMARTCARD +}; + +enum { + SPICE_MSG_SPICEVMC_DATA = 101, + + SPICE_MSG_END_SPICEVMC +}; + +enum { + SPICE_MSGC_SPICEVMC_DATA = 101, + + SPICE_MSGC_END_SPICEVMC +}; + +#endif /* _H_SPICE_ENUMS */ diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/error_codes.h spice-gtk-0.12/spice-common/spice-protocol/spice/error_codes.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/error_codes.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/error_codes.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,51 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + 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 copyright holder 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 HOLDER 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 + HOLDER OR CONTRIBUTORS 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. +*/ + +#ifndef _H_SPICE_ERROR_CODES +#define _H_SPICE_ERROR_CODES + +#define SPICEC_ERROR_CODE_SUCCESS 0 +#define SPICEC_ERROR_CODE_ERROR 1 +#define SPICEC_ERROR_CODE_GETHOSTBYNAME_FAILED 2 +#define SPICEC_ERROR_CODE_CONNECT_FAILED 3 +#define SPICEC_ERROR_CODE_SOCKET_FAILED 4 +#define SPICEC_ERROR_CODE_SEND_FAILED 5 +#define SPICEC_ERROR_CODE_RECV_FAILED 6 +#define SPICEC_ERROR_CODE_SSL_ERROR 7 +#define SPICEC_ERROR_CODE_NOT_ENOUGH_MEMORY 8 +#define SPICEC_ERROR_CODE_AGENT_TIMEOUT 9 +#define SPICEC_ERROR_CODE_AGENT_ERROR 10 +#define SPICEC_ERROR_CODE_VERSION_MISMATCH 11 +#define SPICEC_ERROR_CODE_PERMISSION_DENIED 12 +#define SPICEC_ERROR_CODE_INVALID_ARG 13 +#define SPICEC_ERROR_CODE_CMD_LINE_ERROR 14 + +#endif /* _H_SPICE_ERROR_CODES */ + diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/foreign_menu_prot.h spice-gtk-0.12/spice-common/spice-protocol/spice/foreign_menu_prot.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/foreign_menu_prot.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/foreign_menu_prot.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,104 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +#ifndef _H_FOREIGN_MENU_PROT +#define _H_FOREIGN_MENU_PROT + +#include +#include + +#define FOREIGN_MENU_MAGIC (*(uint32_t*)"FRGM") +#define FOREIGN_MENU_VERSION 1 + +typedef struct SPICE_ATTR_PACKED FrgMenuInitHeader { + uint32_t magic; + uint32_t version; + uint32_t size; +} FrgMenuInitHeader; + +typedef struct SPICE_ATTR_PACKED FrgMenuInit { + FrgMenuInitHeader base; + uint64_t credentials; + uint8_t title[0]; //UTF8 +} FrgMenuInit; + +typedef struct SPICE_ATTR_PACKED FrgMenuMsg { + uint32_t id; + uint32_t size; +} FrgMenuMsg; + +enum { + //extrenal app -> spice client + FOREIGN_MENU_SET_TITLE = 1, + FOREIGN_MENU_ADD_ITEM, + FOREIGN_MENU_MODIFY_ITEM, + FOREIGN_MENU_REMOVE_ITEM, + FOREIGN_MENU_CLEAR, + + //spice client -> external app + FOREIGN_MENU_ITEM_EVENT = 1001, + FOREIGN_MENU_APP_ACTIVATED, + FOREIGN_MENU_APP_DEACTIVATED, +}; + +typedef struct SPICE_ATTR_PACKED FrgMenuSetTitle { + FrgMenuMsg base; + uint8_t string[0]; //UTF8 +} FrgMenuSetTitle; + +enum { + FOREIGN_MENU_ITEM_TYPE_CHECKED = 1 << 0, + FOREIGN_MENU_ITEM_TYPE_DIM = 1 << 1, + FOREIGN_MENU_ITEM_TYPE_SEPARATOR = 1 << 2 +}; + +#define FOREIGN_MENU_INVALID_ID 0 + +typedef struct SPICE_ATTR_PACKED FrgMenuAddItem { + FrgMenuMsg base; + uint32_t id; + uint32_t type; + uint32_t position; + uint8_t string[0]; //UTF8 +} FrgMenuAddItem, FrgMenuModItem; + +typedef struct SPICE_ATTR_PACKED FrgMenuRmItem { + FrgMenuMsg base; + uint32_t id; +} FrgMenuRmItem; + +typedef struct FrgMenuMsg FrgMenuRmItems; +typedef struct FrgMenuMsg FrgMenuDelete; + +enum { + FOREIGN_MENU_EVENT_CLICK, + FOREIGN_MENU_EVENT_CHECKED, + FOREIGN_MENU_EVENT_UNCHECKED +}; + +typedef struct SPICE_ATTR_PACKED FrgMenuEvent { + FrgMenuMsg base; + uint32_t id; + uint32_t action; //FOREIGN_MENU_EVENT_? +} FrgMenuEvent; + +typedef struct FrgMenuMsg FrgMenuActivate; +typedef struct FrgMenuMsg FrgMenuDeactivate; + +#include + +#endif diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/ipc_ring.h spice-gtk-0.12/spice-common/spice-protocol/spice/ipc_ring.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/ipc_ring.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/ipc_ring.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,136 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + 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 copyright holder 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 HOLDER 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 + HOLDER OR CONTRIBUTORS 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. +*/ + + +#ifndef _H_SPICE_RING +#define _H_SPICE_RING + +#include + +#define _SPICE_MSB_MASK4(x) \ + (((x) & 0x8) ? 0x8 : \ + ((x) & 0x4) ? 0x4 : \ + ((x) & 0x2) ? 0x2 : \ + ((x) & 0x1) ? 0x1 : 0) + +#define _SPICE_MSB_MASK8(x) \ + (((x) & 0xf0) ? _SPICE_MSB_MASK4((x) >> 4) << 4 : _SPICE_MSB_MASK4(x)) + +#define _SPICE_MSB_MASK16(x) \ + (((x) & 0xff00) ? _SPICE_MSB_MASK8((x) >> 8) << 8 : _SPICE_MSB_MASK8(x)) + +#define _SPICE_MSB_MASK(x) \ + (((x) & 0xffff0000) ? _SPICE_MSB_MASK16((x) >> 16) << 16 : _SPICE_MSB_MASK16(x)) + +#define _SPICE_POWER2_ALIGN(x) _SPICE_MSB_MASK((x) * 2 - 1) + + +#define _SPICE_TOSHIFT_4(x) \ + (((x) & 0x8) ? 3 : \ + ((x) & 0x4) ? 2 : \ + ((x) & 0x2) ? 1 : 0) + +#define _SPICE_TOSHIFT_8(x) \ + (((x) & 0xf0) ? _SPICE_TOSHIFT_4((x) >> 4) + 4 : _SPICE_TOSHIFT_4(x)) + +#define _SPICE_TOSHIFT_16(x) \ + (((x) & 0xff00) ? _SPICE_TOSHIFT_8((x) >> 8) + 8 : _SPICE_TOSHIFT_8(x)) + +#define _SPICE_POWER2_TO_SHIFT(x) \ + (((x) & 0xffff0000) ? _SPICE_TOSHIFT_16((x) >> 16) + 16 : _SPICE_TOSHIFT_16(x)) + + + +#define SPICE_RING_DECLARE(name, el_type, size) \ +typedef struct SPICE_ATTR_PACKED name##_ring_el { \ + union { \ + el_type el; \ + uint8_t data[_SPICE_POWER2_ALIGN(sizeof(el_type))]; \ + } ; \ +} name##_ring_el; \ + \ +typedef struct SPICE_ATTR_PACKED name { \ + uint32_t num_items; \ + uint32_t prod; \ + uint32_t notify_on_prod; \ + uint32_t cons; \ + uint32_t notify_on_cons; \ + name##_ring_el items[_SPICE_POWER2_ALIGN(size)]; \ +} name; + + +#define SPICE_RING_INIT(r) \ + (r)->num_items = sizeof((r)->items) >> \ + _SPICE_POWER2_TO_SHIFT(sizeof((r)->items[0])); \ + (r)->prod = (r)->cons = 0; \ + (r)->notify_on_prod = 1; \ + (r)->notify_on_cons = 0; + + +#define SPICE_RING_INDEX_MASK(r) ((r)->num_items - 1) + +#define SPICE_RING_IS_PACKED(r) (sizeof((r)->items[0]) == sizeof((r)->items[0]).el) + +#define SPICE_RING_IS_EMPTY(r) ((r)->cons == (r)->prod) + +#define SPICE_RING_IS_FULL(r) (((r)->prod - (r)->cons) == (r)->num_items) + +#define SPICE_RING_PROD_ITEM(r) (&(r)->items[(r)->prod & SPICE_RING_INDEX_MASK(r)].el) + +#define SPICE_RING_PROD_WAIT(r, wait) \ + if (((wait) = SPICE_RING_IS_FULL(r))) { \ + (r)->notify_on_cons = (r)->cons + 1; \ + spice_mb(); \ + (wait) = SPICE_RING_IS_FULL(r); \ + } + +#define SPICE_RING_PUSH(r, notify) \ + (r)->prod++; \ + spice_mb(); \ + (notify) = (r)->prod == (r)->notify_on_prod; + + +#define SPICE_RING_CONS_ITEM(r) (&(r)->items[(r)->cons & SPICE_RING_INDEX_MASK(r)].el) + +#define SPICE_RING_CONS_WAIT(r, wait) \ + if (((wait) = SPICE_RING_IS_EMPTY(r))) { \ + (r)->notify_on_prod = (r)->prod + 1; \ + spice_mb(); \ + (wait) = SPICE_RING_IS_EMPTY(r); \ + } + +#define SPICE_RING_POP(r, notify) \ + (r)->cons++; \ + spice_mb(); \ + (notify) = (r)->cons == (r)->notify_on_cons; + + + +#endif /* _H_SPICE_RING */ diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/macros.h spice-gtk-0.12/spice-common/spice-protocol/spice/macros.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/macros.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/macros.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,368 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2010 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +/* This file is to a large extent based on gmacros.h from glib + * Which is LGPL and copyright: + * + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef _H_SPICE_MACROS +#define _H_SPICE_MACROS + +/* We include stddef.h to get the system's definition of NULL */ +#include + +#include + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +#define SPICE_GNUC_PURE __attribute__((__pure__)) +#define SPICE_GNUC_MALLOC __attribute__((__malloc__)) +#else +#define SPICE_GNUC_PURE +#define SPICE_GNUC_MALLOC +#endif + +#if __GNUC__ >= 4 +#define SPICE_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) +#else +#define SPICE_GNUC_NULL_TERMINATED +#endif + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#define SPICE_GNUC_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) +#define SPICE_GNUC_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y))) +#else +#define SPICE_GNUC_ALLOC_SIZE(x) +#define SPICE_GNUC_ALLOC_SIZE2(x,y) +#endif + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) +#define SPICE_GNUC_PRINTF( format_idx, arg_idx ) __attribute__((__format__ (__printf__, format_idx, arg_idx))) +#define SPICE_GNUC_SCANF( format_idx, arg_idx ) __attribute__((__format__ (__scanf__, format_idx, arg_idx))) +#define SPICE_GNUC_FORMAT( arg_idx ) __attribute__((__format_arg__ (arg_idx))) +#define SPICE_GNUC_NORETURN __attribute__((__noreturn__)) +#define SPICE_GNUC_CONST __attribute__((__const__)) +#define SPICE_GNUC_UNUSED __attribute__((__unused__)) +#define SPICE_GNUC_NO_INSTRUMENT __attribute__((__no_instrument_function__)) +#else /* !__GNUC__ */ +#define SPICE_GNUC_PRINTF( format_idx, arg_idx ) +#define SPICE_GNUC_SCANF( format_idx, arg_idx ) +#define SPICE_GNUC_FORMAT( arg_idx ) +#define SPICE_GNUC_NORETURN +#define SPICE_GNUC_CONST +#define SPICE_GNUC_UNUSED +#define SPICE_GNUC_NO_INSTRUMENT +#endif /* !__GNUC__ */ + +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +#define SPICE_GNUC_DEPRECATED __attribute__((__deprecated__)) +#else +#define SPICE_GNUC_DEPRECATED +#endif /* __GNUC__ */ + +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) +# define SPICE_GNUC_MAY_ALIAS __attribute__((may_alias)) +#else +# define SPICE_GNUC_MAY_ALIAS +#endif + +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +#define SPICE_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) +#else +#define SPICE_GNUC_WARN_UNUSED_RESULT +#endif /* __GNUC__ */ + + +/* Guard C code in headers, while including them from C++ */ +#ifdef __cplusplus +# define SPICE_BEGIN_DECLS extern "C" { +# define SPICE_END_DECLS } +#else +# define SPICE_BEGIN_DECLS +# define SPICE_END_DECLS +#endif + +#ifdef __GNUC__ +#define INLINE inline +#else +#define INLINE _inline +#endif /* __GNUC__ */ + +#ifndef FALSE +#define FALSE (0) +#endif + +#ifndef TRUE +#define TRUE (!FALSE) +#endif + +#undef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) + +#undef MIN +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) + +#undef ABS +#define ABS(a) (((a) < 0) ? -(a) : (a)) + +/* Count the number of elements in an array. The array must be defined + * as such; using this with a dynamically allocated array will give + * incorrect results. + */ +#define SPICE_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) + +#define SPICE_ALIGN(a, size) (((a) + ((size) - 1)) & ~((size) - 1)) + +/* Provide convenience macros for handling structure + * fields through their offsets. + */ + +#if defined(__GNUC__) && __GNUC__ >= 4 +# define SPICE_OFFSETOF(struct_type, member) \ + ((long) offsetof (struct_type, member)) +#else +# define SPICE_OFFSETOF(struct_type, member) \ + ((long) ((uint8_t*) &((struct_type*) 0)->member)) +#endif + +#define SPICE_CONTAINEROF(ptr, struct_type, member) \ + ((struct_type *)((uint8_t *)(ptr) - SPICE_OFFSETOF(struct_type, member))) + +#define SPICE_MEMBER_P(struct_p, struct_offset) \ + ((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset))) +#define SPICE_MEMBER(member_type, struct_p, struct_offset) \ + (*(member_type*) SPICE_STRUCT_MEMBER_P ((struct_p), (struct_offset))) + +/* Provide simple macro statement wrappers: + * SPICE_STMT_START { statements; } SPICE_STMT_END; + * This can be used as a single statement, like: + * if (x) SPICE_STMT_START { ... } SPICE_STMT_END; else ... + * This intentionally does not use compiler extensions like GCC's '({...})' to + * avoid portability issue or side effects when compiled with different compilers. + */ +#if !(defined (SPICE_STMT_START) && defined (SPICE_STMT_END)) +# define SPICE_STMT_START do +# define SPICE_STMT_END while (0) +#endif + +/* + * The SPICE_LIKELY and SPICE_UNLIKELY macros let the programmer give hints to + * the compiler about the expected result of an expression. Some compilers + * can use this information for optimizations. + * + * The _SPICE_BOOLEAN_EXPR macro is intended to trigger a gcc warning when + * putting assignments in g_return_if_fail (). + */ +#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) +#define _SPICE_BOOLEAN_EXPR(expr) \ + __extension__ ({ \ + int _g_boolean_var_; \ + if (expr) \ + _g_boolean_var_ = 1; \ + else \ + _g_boolean_var_ = 0; \ + _g_boolean_var_; \ +}) +#define SPICE_LIKELY(expr) (__builtin_expect (_SPICE_BOOLEAN_EXPR(expr), 1)) +#define SPICE_UNLIKELY(expr) (__builtin_expect (_SPICE_BOOLEAN_EXPR(expr), 0)) +#else +#define SPICE_LIKELY(expr) (expr) +#define SPICE_UNLIKELY(expr) (expr) +#endif + +#ifdef _MSC_VER +#define SPICE_UINT64_CONSTANT(x) (x ## UI64) +#define SPICE_INT64_CONSTANT(x) (x ## I64) +#else +#if LONG_MAX == 2147483647L +#define SPICE_UINT64_CONSTANT(x) (x ## ULL) +#define SPICE_INT64_CONSTANT(x) (x ## LL) +#else +#define SPICE_UINT64_CONSTANT(x) (x ## UL) +#define SPICE_INT64_CONSTANT(x) (x ## L) +#endif +#endif + +/* Little/Bit endian byte swapping */ + +#define SPICE_BYTESWAP16_CONSTANT(val) ((uint16_t) ( \ + (uint16_t) ((uint16_t) (val) >> 8) | \ + (uint16_t) ((uint16_t) (val) << 8))) + +#define SPICE_BYTESWAP32_CONSTANT(val) ((uint32_t) ( \ + (((uint32_t) (val) & (uint32_t) 0x000000ffU) << 24) | \ + (((uint32_t) (val) & (uint32_t) 0x0000ff00U) << 8) | \ + (((uint32_t) (val) & (uint32_t) 0x00ff0000U) >> 8) | \ + (((uint32_t) (val) & (uint32_t) 0xff000000U) >> 24))) + +#define SPICE_BYTESWAP64_CONSTANT(val) ((uint64_t) ( \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0x00000000000000ff)) << 56) | \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0x000000000000ff00)) << 40) | \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0x0000000000ff0000)) << 24) | \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0x00000000ff000000)) << 8) | \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0x000000ff00000000)) >> 8) | \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0x0000ff0000000000)) >> 24) | \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0x00ff000000000000)) >> 40) | \ + (((uint64_t) (val) & \ + (uint64_t) SPICE_UINT64_CONSTANT(0xff00000000000000)) >> 56))) + +/* Arch specific stuff for speed + */ +#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__) +# if defined (__i386__) +# define SPICE_BYTESWAP16_IA32(val) \ + (__extension__ \ + ({ register uint16_t __v, __x = ((uint16_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP16_CONSTANT (__x); \ + else \ + __asm__ ("rorw $8, %w0" \ + : "=r" (__v) \ + : "0" (__x) \ + : "cc"); \ + __v; })) +# if !defined (__i486__) && !defined (__i586__) \ + && !defined (__pentium__) && !defined (__i686__) \ + && !defined (__pentiumpro__) && !defined (__pentium4__) +# define SPICE_BYTESWAP32_IA32(val) \ + (__extension__ \ + ({ register uint32_t __v, __x = ((uint32_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP32_CONSTANT (__x); \ + else \ + __asm__ ("rorw $8, %w0\n\t" \ + "rorl $16, %0\n\t" \ + "rorw $8, %w0" \ + : "=r" (__v) \ + : "0" (__x) \ + : "cc"); \ + __v; })) +# else /* 486 and higher has bswap */ +# define SPICE_BYTESWAP32_IA32(val) \ + (__extension__ \ + ({ register uint32_t __v, __x = ((uint32_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP32_CONSTANT (__x); \ + else \ + __asm__ ("bswap %0" \ + : "=r" (__v) \ + : "0" (__x)); \ + __v; })) +# endif /* processor specific 32-bit stuff */ +# define SPICE_BYTESWAP64_IA32(val) \ + (__extension__ \ + ({ union { uint64_t __ll; \ + uint32_t __l[2]; } __w, __r; \ + __w.__ll = ((uint64_t) (val)); \ + if (__builtin_constant_p (__w.__ll)) \ + __r.__ll = SPICE_BYTESWAP64_CONSTANT (__w.__ll); \ + else \ + { \ + __r.__l[0] = SPICE_BYTESWAP32 (__w.__l[1]); \ + __r.__l[1] = SPICE_BYTESWAP32 (__w.__l[0]); \ + } \ + __r.__ll; })) + /* Possibly just use the constant version and let gcc figure it out? */ +# define SPICE_BYTESWAP16(val) (SPICE_BYTESWAP16_IA32 (val)) +# define SPICE_BYTESWAP32(val) (SPICE_BYTESWAP32_IA32 (val)) +# define SPICE_BYTESWAP64(val) (SPICE_BYTESWAP64_IA32 (val)) +# elif defined (__ia64__) +# define SPICE_BYTESWAP16_IA64(val) \ + (__extension__ \ + ({ register uint16_t __v, __x = ((uint16_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP16_CONSTANT (__x); \ + else \ + __asm__ __volatile__ ("shl %0 = %1, 48 ;;" \ + "mux1 %0 = %0, @rev ;;" \ + : "=r" (__v) \ + : "r" (__x)); \ + __v; })) +# define SPICE_BYTESWAP32_IA64(val) \ + (__extension__ \ + ({ register uint32_t __v, __x = ((uint32_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP32_CONSTANT (__x); \ + else \ + __asm__ __volatile__ ("shl %0 = %1, 32 ;;" \ + "mux1 %0 = %0, @rev ;;" \ + : "=r" (__v) \ + : "r" (__x)); \ + __v; })) +# define SPICE_BYTESWAP64_IA64(val) \ + (__extension__ \ + ({ register uint64_t __v, __x = ((uint64_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP64_CONSTANT (__x); \ + else \ + __asm__ __volatile__ ("mux1 %0 = %1, @rev ;;" \ + : "=r" (__v) \ + : "r" (__x)); \ + __v; })) +# define SPICE_BYTESWAP16(val) (SPICE_BYTESWAP16_IA64 (val)) +# define SPICE_BYTESWAP32(val) (SPICE_BYTESWAP32_IA64 (val)) +# define SPICE_BYTESWAP64(val) (SPICE_BYTESWAP64_IA64 (val)) +# elif defined (__x86_64__) +# define SPICE_BYTESWAP32_X86_64(val) \ + (__extension__ \ + ({ register uint32_t __v, __x = ((uint32_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP32_CONSTANT (__x); \ + else \ + __asm__ ("bswapl %0" \ + : "=r" (__v) \ + : "0" (__x)); \ + __v; })) +# define SPICE_BYTESWAP64_X86_64(val) \ + (__extension__ \ + ({ register uint64_t __v, __x = ((uint64_t) (val)); \ + if (__builtin_constant_p (__x)) \ + __v = SPICE_BYTESWAP64_CONSTANT (__x); \ + else \ + __asm__ ("bswapq %0" \ + : "=r" (__v) \ + : "0" (__x)); \ + __v; })) + /* gcc seems to figure out optimal code for this on its own */ +# define SPICE_BYTESWAP16(val) (SPICE_BYTESWAP16_CONSTANT (val)) +# define SPICE_BYTESWAP32(val) (SPICE_BYTESWAP32_X86_64 (val)) +# define SPICE_BYTESWAP64(val) (SPICE_BYTESWAP64_X86_64 (val)) +# else /* generic gcc */ +# define SPICE_BYTESWAP16(val) (SPICE_BYTESWAP16_CONSTANT (val)) +# define SPICE_BYTESWAP32(val) (SPICE_BYTESWAP32_CONSTANT (val)) +# define SPICE_BYTESWAP64(val) (SPICE_BYTESWAP64_CONSTANT (val)) +# endif +#else /* generic */ +# define SPICE_BYTESWAP16(val) (SPICE_BYTESWAP16_CONSTANT (val)) +# define SPICE_BYTESWAP32(val) (SPICE_BYTESWAP32_CONSTANT (val)) +# define SPICE_BYTESWAP64(val) (SPICE_BYTESWAP64_CONSTANT (val)) +#endif /* generic */ + + +#endif /* _H_SPICE_MACROS */ diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/Makefile.am spice-gtk-0.12/spice-common/spice-protocol/spice/Makefile.am --- spice-gtk-0.9/spice-common/spice-protocol/spice/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/Makefile.am 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,23 @@ +NULL = + +spice_protocol_includedir = $(includedir)/spice-1/spice + +spice_protocol_include_HEADERS = \ + barrier.h \ + controller_prot.h \ + end-packed.h \ + enums.h \ + error_codes.h \ + foreign_menu_prot.h \ + ipc_ring.h \ + macros.h \ + protocol.h \ + qxl_dev.h \ + start-packed.h \ + stats.h \ + types.h \ + vd_agent.h \ + vdi_dev.h \ + $(NULL) + +-include $(top_srcdir)/git.mk diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/Makefile.in spice-gtk-0.12/spice-common/spice-protocol/spice/Makefile.in --- spice-gtk-0.9/spice-common/spice-protocol/spice/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/Makefile.in 2012-04-24 11:20:48.000000000 +0000 @@ -0,0 +1,437 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = spice +DIST_COMMON = $(spice_protocol_include_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(spice_protocol_includedir)" +HEADERS = $(spice_protocol_include_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +spice_protocol_includedir = $(includedir)/spice-1/spice +spice_protocol_include_HEADERS = \ + barrier.h \ + controller_prot.h \ + end-packed.h \ + enums.h \ + error_codes.h \ + foreign_menu_prot.h \ + ipc_ring.h \ + macros.h \ + protocol.h \ + qxl_dev.h \ + start-packed.h \ + stats.h \ + types.h \ + vd_agent.h \ + vdi_dev.h \ + $(NULL) + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu spice/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu spice/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-spice_protocol_includeHEADERS: $(spice_protocol_include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(spice_protocol_includedir)" || $(MKDIR_P) "$(DESTDIR)$(spice_protocol_includedir)" + @list='$(spice_protocol_include_HEADERS)'; test -n "$(spice_protocol_includedir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(spice_protocol_includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(spice_protocol_includedir)" || exit $$?; \ + done + +uninstall-spice_protocol_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(spice_protocol_include_HEADERS)'; test -n "$(spice_protocol_includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(spice_protocol_includedir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(spice_protocol_includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-spice_protocol_includeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-spice_protocol_includeHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + ctags distclean distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am \ + install-spice_protocol_includeHEADERS install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-spice_protocol_includeHEADERS + + +-include $(top_srcdir)/git.mk + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/protocol.h spice-gtk-0.12/spice-common/spice-protocol/spice/protocol.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/protocol.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/protocol.h 2012-04-21 18:50:52.000000000 +0000 @@ -0,0 +1,127 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + 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 copyright holder 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 HOLDER 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 + HOLDER OR CONTRIBUTORS 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. +*/ + +#ifndef _H_SPICE_PROTOCOL +#define _H_SPICE_PROTOCOL + +#include +#include +#include + +#define SPICE_MAGIC (*(uint32_t*)"REDQ") +#define SPICE_VERSION_MAJOR 2 +#define SPICE_VERSION_MINOR 2 + +// Encryption & Ticketing Parameters +#define SPICE_MAX_PASSWORD_LENGTH 60 +#define SPICE_TICKET_KEY_PAIR_LENGTH 1024 +#define SPICE_TICKET_PUBKEY_BYTES (SPICE_TICKET_KEY_PAIR_LENGTH / 8 + 34) + +typedef struct SPICE_ATTR_PACKED SpiceLinkHeader { + uint32_t magic; + uint32_t major_version; + uint32_t minor_version; + uint32_t size; +} SpiceLinkHeader; + +enum { + SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION, + SPICE_COMMON_CAP_AUTH_SPICE, + SPICE_COMMON_CAP_AUTH_SASL, + SPICE_COMMON_CAP_MINI_HEADER, +}; + +typedef struct SPICE_ATTR_PACKED SpiceLinkMess { + uint32_t connection_id; + uint8_t channel_type; + uint8_t channel_id; + uint32_t num_common_caps; + uint32_t num_channel_caps; + uint32_t caps_offset; +} SpiceLinkMess; + +typedef struct SPICE_ATTR_PACKED SpiceLinkReply { + uint32_t error; + uint8_t pub_key[SPICE_TICKET_PUBKEY_BYTES]; + uint32_t num_common_caps; + uint32_t num_channel_caps; + uint32_t caps_offset; +} SpiceLinkReply; + +typedef struct SPICE_ATTR_PACKED SpiceLinkEncryptedTicket { + uint8_t encrypted_data[SPICE_TICKET_KEY_PAIR_LENGTH / 8]; +} SpiceLinkEncryptedTicket; + +typedef struct SPICE_ATTR_PACKED SpiceLinkAuthMechanism { + uint32_t auth_mechanism; +} SpiceLinkAuthMechanism; + +typedef struct SPICE_ATTR_PACKED SpiceDataHeader { + uint64_t serial; + uint16_t type; + uint32_t size; + uint32_t sub_list; //offset to SpiceSubMessageList[] +} SpiceDataHeader; + +typedef struct SPICE_ATTR_PACKED SpiceMiniDataHeader { + uint16_t type; + uint32_t size; +} SpiceMiniDataHeader; + +typedef struct SPICE_ATTR_PACKED SpiceSubMessage { + uint16_t type; + uint32_t size; +} SpiceSubMessage; + +typedef struct SPICE_ATTR_PACKED SpiceSubMessageList { + uint16_t size; + uint32_t sub_messages[0]; //offsets to SpicedSubMessage +} SpiceSubMessageList; + +#define SPICE_INPUT_MOTION_ACK_BUNCH 4 + +enum { + SPICE_PLAYBACK_CAP_CELT_0_5_1, + SPICE_PLAYBACK_CAP_VOLUME, +}; + +enum { + SPICE_RECORD_CAP_CELT_0_5_1, + SPICE_RECORD_CAP_VOLUME, +}; + +enum { + SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE, + SPICE_MAIN_CAP_NAME_AND_UUID, +}; + +#include + +#endif /* _H_SPICE_PROTOCOL */ diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/qxl_dev.h spice-gtk-0.12/spice-common/spice-protocol/spice/qxl_dev.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/qxl_dev.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/qxl_dev.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,658 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + 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 copyright holder 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 HOLDER 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 + HOLDER OR CONTRIBUTORS 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. +*/ + + +#ifndef _H_QXL_DEV +#define _H_QXL_DEV + +#include +#include +#include +#include + +#include + +#define REDHAT_PCI_VENDOR_ID 0x1b36 + +/* 0x100-0x11f reserved for spice, 0x1ff used for unstable work */ +#define QXL_DEVICE_ID_STABLE 0x0100 + +enum { + QXL_REVISION_STABLE_V04=0x01, + QXL_REVISION_STABLE_V06=0x02, + QXL_REVISION_STABLE_V10=0x03 +}; + +#define QXL_DEVICE_ID_DEVEL 0x01ff +#define QXL_REVISION_DEVEL 0x01 + +#define QXL_ROM_MAGIC (*(uint32_t*)"QXRO") +#define QXL_RAM_MAGIC (*(uint32_t*)"QXRA") + +enum { + QXL_RAM_RANGE_INDEX, + QXL_VRAM_RANGE_INDEX, + QXL_ROM_RANGE_INDEX, + QXL_IO_RANGE_INDEX, + + QXL_PCI_RANGES +}; + +/* qxl-1 compat: append only */ +enum { + QXL_IO_NOTIFY_CMD, + QXL_IO_NOTIFY_CURSOR, + QXL_IO_UPDATE_AREA, + QXL_IO_UPDATE_IRQ, + QXL_IO_NOTIFY_OOM, + QXL_IO_RESET, + QXL_IO_SET_MODE, /* qxl-1 */ + QXL_IO_LOG, + /* appended for qxl-2 */ + QXL_IO_MEMSLOT_ADD, + QXL_IO_MEMSLOT_DEL, + QXL_IO_DETACH_PRIMARY, + QXL_IO_ATTACH_PRIMARY, + QXL_IO_CREATE_PRIMARY, + QXL_IO_DESTROY_PRIMARY, + QXL_IO_DESTROY_SURFACE_WAIT, + QXL_IO_DESTROY_ALL_SURFACES, + /* appended for qxl-3 */ + QXL_IO_UPDATE_AREA_ASYNC, + QXL_IO_MEMSLOT_ADD_ASYNC, + QXL_IO_CREATE_PRIMARY_ASYNC, + QXL_IO_DESTROY_PRIMARY_ASYNC, + QXL_IO_DESTROY_SURFACE_ASYNC, + QXL_IO_DESTROY_ALL_SURFACES_ASYNC, + QXL_IO_FLUSH_SURFACES_ASYNC, + QXL_IO_FLUSH_RELEASE, + + QXL_IO_RANGE_SIZE +}; + +typedef uint64_t QXLPHYSICAL; +typedef int32_t QXLFIXED; //fixed 28.4 + +typedef struct SPICE_ATTR_PACKED QXLPointFix { + QXLFIXED x; + QXLFIXED y; +} QXLPointFix; + +typedef struct SPICE_ATTR_PACKED QXLPoint { + int32_t x; + int32_t y; +} QXLPoint; + +typedef struct SPICE_ATTR_PACKED QXLPoint16 { + int16_t x; + int16_t y; +} QXLPoint16; + +typedef struct SPICE_ATTR_PACKED QXLRect { + int32_t top; + int32_t left; + int32_t bottom; + int32_t right; +} QXLRect; + +/* qxl-1 compat: append only */ +typedef struct SPICE_ATTR_PACKED QXLRom { + uint32_t magic; + uint32_t id; + uint32_t update_id; + uint32_t compression_level; + uint32_t log_level; + uint32_t mode; /* qxl-1 */ + uint32_t modes_offset; + uint32_t num_pages; + uint32_t pages_offset; /* qxl-1 */ + uint32_t draw_area_offset; /* qxl-1 */ + uint32_t surface0_area_size; /* qxl-1 name: draw_area_size */ + uint32_t ram_header_offset; + uint32_t mm_clock; + /* appended for qxl-2 */ + uint32_t n_surfaces; + uint64_t flags; + uint8_t slots_start; + uint8_t slots_end; + uint8_t slot_gen_bits; + uint8_t slot_id_bits; + uint8_t slot_generation; + uint8_t padding[3]; /* Padding to 32bit align */ +} QXLRom; + +/* qxl-1 compat: fixed */ +typedef struct SPICE_ATTR_PACKED QXLMode { + uint32_t id; + uint32_t x_res; + uint32_t y_res; + uint32_t bits; + uint32_t stride; + uint32_t x_mili; + uint32_t y_mili; + uint32_t orientation; +} QXLMode; + +/* qxl-1 compat: fixed */ +typedef struct SPICE_ATTR_PACKED QXLModes { + uint32_t n_modes; + QXLMode modes[0]; +} QXLModes; + +/* qxl-1 compat: append only */ +typedef enum QXLCmdType { + QXL_CMD_NOP, + QXL_CMD_DRAW, + QXL_CMD_UPDATE, + QXL_CMD_CURSOR, + QXL_CMD_MESSAGE, + QXL_CMD_SURFACE, +} QXLCmdType; + +/* qxl-1 compat: fixed */ +typedef struct SPICE_ATTR_PACKED QXLCommand { + QXLPHYSICAL data; + uint32_t type; + uint32_t padding; +} QXLCommand; + +#define QXL_COMMAND_FLAG_COMPAT (1<<0) +#define QXL_COMMAND_FLAG_COMPAT_16BPP (2<<0) + +typedef struct SPICE_ATTR_PACKED QXLCommandExt { + QXLCommand cmd; + uint32_t group_id; + uint32_t flags; +} QXLCommandExt; + +typedef struct SPICE_ATTR_PACKED QXLMemSlot { + uint64_t mem_start; + uint64_t mem_end; +} QXLMemSlot; + +#define QXL_SURF_TYPE_PRIMARY 0 + +#define QXL_SURF_FLAG_KEEP_DATA (1 << 0) + +typedef struct SPICE_ATTR_PACKED QXLSurfaceCreate { + uint32_t width; + uint32_t height; + int32_t stride; + uint32_t format; + uint32_t position; + uint32_t mouse_mode; + uint32_t flags; + uint32_t type; + QXLPHYSICAL mem; +} QXLSurfaceCreate; + +#define QXL_COMMAND_RING_SIZE 32 +#define QXL_CURSOR_RING_SIZE 32 +#define QXL_RELEASE_RING_SIZE 8 + +SPICE_RING_DECLARE(QXLCommandRing, QXLCommand, QXL_COMMAND_RING_SIZE); +SPICE_RING_DECLARE(QXLCursorRing, QXLCommand, QXL_CURSOR_RING_SIZE); + +SPICE_RING_DECLARE(QXLReleaseRing, uint64_t, QXL_RELEASE_RING_SIZE); + +#define QXL_LOG_BUF_SIZE 4096 + +#define QXL_INTERRUPT_DISPLAY (1 << 0) +#define QXL_INTERRUPT_CURSOR (1 << 1) +#define QXL_INTERRUPT_IO_CMD (1 << 2) +#define QXL_INTERRUPT_ERROR (1 << 3) + +/* qxl-1 compat: append only */ +typedef struct SPICE_ATTR_PACKED QXLRam { + uint32_t magic; + uint32_t int_pending; + uint32_t int_mask; + uint8_t log_buf[QXL_LOG_BUF_SIZE]; + QXLCommandRing cmd_ring; + QXLCursorRing cursor_ring; + QXLReleaseRing release_ring; + QXLRect update_area; + /* appended for qxl-2 */ + uint32_t update_surface; + QXLMemSlot mem_slot; + QXLSurfaceCreate create_surface; + uint64_t flags; +} QXLRam; + +typedef union QXLReleaseInfo { + uint64_t id; // in + uint64_t next; // out +} QXLReleaseInfo; + +typedef struct QXLReleaseInfoExt { + QXLReleaseInfo *info; + uint32_t group_id; +} QXLReleaseInfoExt; + +typedef struct SPICE_ATTR_PACKED QXLDataChunk { + uint32_t data_size; + QXLPHYSICAL prev_chunk; + QXLPHYSICAL next_chunk; + uint8_t data[0]; +} QXLDataChunk; + +typedef struct SPICE_ATTR_PACKED QXLMessage { + QXLReleaseInfo release_info; + uint8_t data[0]; +} QXLMessage; + +typedef struct SPICE_ATTR_PACKED QXLCompatUpdateCmd { + QXLReleaseInfo release_info; + QXLRect area; + uint32_t update_id; +} QXLCompatUpdateCmd; + +typedef struct SPICE_ATTR_PACKED QXLUpdateCmd { + QXLReleaseInfo release_info; + QXLRect area; + uint32_t update_id; + uint32_t surface_id; +} QXLUpdateCmd; + +typedef struct SPICE_ATTR_PACKED QXLCursorHeader { + uint64_t unique; + uint16_t type; + uint16_t width; + uint16_t height; + uint16_t hot_spot_x; + uint16_t hot_spot_y; +} QXLCursorHeader; + +typedef struct SPICE_ATTR_PACKED QXLCursor { + QXLCursorHeader header; + uint32_t data_size; + QXLDataChunk chunk; +} QXLCursor; + +enum { + QXL_CURSOR_SET, + QXL_CURSOR_MOVE, + QXL_CURSOR_HIDE, + QXL_CURSOR_TRAIL, +}; + +#define QXL_CURSUR_DEVICE_DATA_SIZE 128 + +typedef struct SPICE_ATTR_PACKED QXLCursorCmd { + QXLReleaseInfo release_info; + uint8_t type; + union { + struct SPICE_ATTR_PACKED { + QXLPoint16 position; + uint8_t visible; + QXLPHYSICAL shape; + } set; + struct SPICE_ATTR_PACKED { + uint16_t length; + uint16_t frequency; + } trail; + QXLPoint16 position; + } u; + uint8_t device_data[QXL_CURSUR_DEVICE_DATA_SIZE]; //todo: dynamic size from rom +} QXLCursorCmd; + +enum { + QXL_DRAW_NOP, + QXL_DRAW_FILL, + QXL_DRAW_OPAQUE, + QXL_DRAW_COPY, + QXL_COPY_BITS, + QXL_DRAW_BLEND, + QXL_DRAW_BLACKNESS, + QXL_DRAW_WHITENESS, + QXL_DRAW_INVERS, + QXL_DRAW_ROP3, + QXL_DRAW_STROKE, + QXL_DRAW_TEXT, + QXL_DRAW_TRANSPARENT, + QXL_DRAW_ALPHA_BLEND, +}; + +typedef struct SPICE_ATTR_PACKED QXLRasterGlyph { + QXLPoint render_pos; + QXLPoint glyph_origin; + uint16_t width; + uint16_t height; + uint8_t data[0]; +} QXLRasterGlyph; + +typedef struct SPICE_ATTR_PACKED QXLString { + uint32_t data_size; + uint16_t length; + uint16_t flags; + QXLDataChunk chunk; +} QXLString; + +typedef struct SPICE_ATTR_PACKED QXLCopyBits { + QXLPoint src_pos; +} QXLCopyBits; + +typedef enum QXLEffectType +{ + QXL_EFFECT_BLEND = 0, + QXL_EFFECT_OPAQUE = 1, + QXL_EFFECT_REVERT_ON_DUP = 2, + QXL_EFFECT_BLACKNESS_ON_DUP = 3, + QXL_EFFECT_WHITENESS_ON_DUP = 4, + QXL_EFFECT_NOP_ON_DUP = 5, + QXL_EFFECT_NOP = 6, + QXL_EFFECT_OPAQUE_BRUSH = 7 +} QXLEffectType; + +typedef struct SPICE_ATTR_PACKED QXLPattern { + QXLPHYSICAL pat; + QXLPoint pos; +} QXLPattern; + +typedef struct SPICE_ATTR_PACKED QXLBrush { + uint32_t type; + union { + uint32_t color; + QXLPattern pattern; + } u; +} QXLBrush; + +typedef struct SPICE_ATTR_PACKED QXLQMask { + uint8_t flags; + QXLPoint pos; + QXLPHYSICAL bitmap; +} QXLQMask; + +typedef struct SPICE_ATTR_PACKED QXLFill { + QXLBrush brush; + uint16_t rop_descriptor; + QXLQMask mask; +} QXLFill; + +typedef struct SPICE_ATTR_PACKED QXLOpaque { + QXLPHYSICAL src_bitmap; + QXLRect src_area; + QXLBrush brush; + uint16_t rop_descriptor; + uint8_t scale_mode; + QXLQMask mask; +} QXLOpaque; + +typedef struct SPICE_ATTR_PACKED QXLCopy { + QXLPHYSICAL src_bitmap; + QXLRect src_area; + uint16_t rop_descriptor; + uint8_t scale_mode; + QXLQMask mask; +} QXLCopy, QXLBlend; + +typedef struct SPICE_ATTR_PACKED QXLTransparent { + QXLPHYSICAL src_bitmap; + QXLRect src_area; + uint32_t src_color; + uint32_t true_color; +} QXLTransparent; + +typedef struct SPICE_ATTR_PACKED QXLAlphaBlend { + uint16_t alpha_flags; + uint8_t alpha; + QXLPHYSICAL src_bitmap; + QXLRect src_area; +} QXLAlphaBlend; + +typedef struct SPICE_ATTR_PACKED QXLCompatAlphaBlend { + uint8_t alpha; + QXLPHYSICAL src_bitmap; + QXLRect src_area; +} QXLCompatAlphaBlend; + +typedef struct SPICE_ATTR_PACKED QXLRop3 { + QXLPHYSICAL src_bitmap; + QXLRect src_area; + QXLBrush brush; + uint8_t rop3; + uint8_t scale_mode; + QXLQMask mask; +} QXLRop3; + +typedef struct SPICE_ATTR_PACKED QXLLineAttr { + uint8_t flags; + uint8_t join_style; + uint8_t end_style; + uint8_t style_nseg; + QXLFIXED width; + QXLFIXED miter_limit; + QXLPHYSICAL style; +} QXLLineAttr; + +typedef struct SPICE_ATTR_PACKED QXLStroke { + QXLPHYSICAL path; + QXLLineAttr attr; + QXLBrush brush; + uint16_t fore_mode; + uint16_t back_mode; +} QXLStroke; + +typedef struct SPICE_ATTR_PACKED QXLText { + QXLPHYSICAL str; + QXLRect back_area; + QXLBrush fore_brush; + QXLBrush back_brush; + uint16_t fore_mode; + uint16_t back_mode; +} QXLText; + +typedef struct SPICE_ATTR_PACKED QXLBlackness { + QXLQMask mask; +} QXLBlackness, QXLInvers, QXLWhiteness; + +typedef struct SPICE_ATTR_PACKED QXLClip { + uint32_t type; + QXLPHYSICAL data; +} QXLClip; + +typedef struct SPICE_ATTR_PACKED QXLCompatDrawable { + QXLReleaseInfo release_info; + uint8_t effect; + uint8_t type; + uint16_t bitmap_offset; + QXLRect bitmap_area; + QXLRect bbox; + QXLClip clip; + uint32_t mm_time; + union { + QXLFill fill; + QXLOpaque opaque; + QXLCopy copy; + QXLTransparent transparent; + QXLCompatAlphaBlend alpha_blend; + QXLCopyBits copy_bits; + QXLBlend blend; + QXLRop3 rop3; + QXLStroke stroke; + QXLText text; + QXLBlackness blackness; + QXLInvers invers; + QXLWhiteness whiteness; + } u; +} QXLCompatDrawable; + +typedef struct SPICE_ATTR_PACKED QXLDrawable { + QXLReleaseInfo release_info; + uint32_t surface_id; + uint8_t effect; + uint8_t type; + uint8_t self_bitmap; + QXLRect self_bitmap_area; + QXLRect bbox; + QXLClip clip; + uint32_t mm_time; + int32_t surfaces_dest[3]; + QXLRect surfaces_rects[3]; + union { + QXLFill fill; + QXLOpaque opaque; + QXLCopy copy; + QXLTransparent transparent; + QXLAlphaBlend alpha_blend; + QXLCopyBits copy_bits; + QXLBlend blend; + QXLRop3 rop3; + QXLStroke stroke; + QXLText text; + QXLBlackness blackness; + QXLInvers invers; + QXLWhiteness whiteness; + } u; +} QXLDrawable; + +typedef enum QXLSurfaceCmdType { + QXL_SURFACE_CMD_CREATE, + QXL_SURFACE_CMD_DESTROY, +} QXLSurfaceCmdType; + +typedef struct SPICE_ATTR_PACKED QXLSurface { + uint32_t format; + uint32_t width; + uint32_t height; + int32_t stride; + QXLPHYSICAL data; +} QXLSurface; + +typedef struct SPICE_ATTR_PACKED QXLSurfaceCmd { + QXLReleaseInfo release_info; + uint32_t surface_id; + uint8_t type; + uint32_t flags; + union { + QXLSurface surface_create; + } u; +} QXLSurfaceCmd; + +typedef struct SPICE_ATTR_PACKED QXLClipRects { + uint32_t num_rects; + QXLDataChunk chunk; +} QXLClipRects; + +enum { + QXL_PATH_BEGIN = (1 << 0), + QXL_PATH_END = (1 << 1), + QXL_PATH_CLOSE = (1 << 3), + QXL_PATH_BEZIER = (1 << 4), +}; + +typedef struct SPICE_ATTR_PACKED QXLPathSeg { + uint32_t flags; + uint32_t count; + QXLPointFix points[0]; +} QXLPathSeg; + +typedef struct SPICE_ATTR_PACKED QXLPath { + uint32_t data_size; + QXLDataChunk chunk; +} QXLPath; + +enum { + QXL_IMAGE_GROUP_DRIVER, + QXL_IMAGE_GROUP_DEVICE, + QXL_IMAGE_GROUP_RED, + QXL_IMAGE_GROUP_DRIVER_DONT_CACHE, +}; + +typedef struct SPICE_ATTR_PACKED QXLImageID { + uint32_t group; + uint32_t unique; +} QXLImageID; + +typedef union { + QXLImageID id; + uint64_t value; +} QXLImageIDUnion; + +typedef enum QXLImageFlags { + QXL_IMAGE_CACHE = (1 << 0), + QXL_IMAGE_HIGH_BITS_SET = (1 << 1), +} QXLImageFlags; + +typedef enum QXLBitmapFlags { + QXL_BITMAP_DIRECT = (1 << 0), + QXL_BITMAP_UNSTABLE = (1 << 1), + QXL_BITMAP_TOP_DOWN = (1 << 2), // == SPICE_BITMAP_FLAGS_TOP_DOWN +} QXLBitmapFlags; + +#define QXL_SET_IMAGE_ID(image, _group, _unique) { \ + (image)->descriptor.id = (((uint64_t)_unique) << 32) | _group; \ +} + +typedef struct SPICE_ATTR_PACKED QXLImageDescriptor { + uint64_t id; + uint8_t type; + uint8_t flags; + uint32_t width; + uint32_t height; +} QXLImageDescriptor; + +typedef struct SPICE_ATTR_PACKED QXLPalette { + uint64_t unique; + uint16_t num_ents; + uint32_t ents[0]; +} QXLPalette; + +typedef struct SPICE_ATTR_PACKED QXLBitmap { + uint8_t format; + uint8_t flags; + uint32_t x; + uint32_t y; + uint32_t stride; + QXLPHYSICAL palette; + QXLPHYSICAL data; //data[0] ? +} QXLBitmap; + +typedef struct SPICE_ATTR_PACKED QXLSurfaceId { + uint32_t surface_id; +} QXLSurfaceId; + +typedef struct SPICE_ATTR_PACKED QXLQUICData { + uint32_t data_size; + uint8_t data[0]; +} QXLQUICData, QXLLZRGBData, QXLJPEGData; + +typedef struct SPICE_ATTR_PACKED QXLImage { + QXLImageDescriptor descriptor; + union { // variable length + QXLBitmap bitmap; + QXLQUICData quic; + QXLSurfaceId surface_image; + }; +} QXLImage; + +#include + +#endif /* _H_QXL_DEV */ diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/start-packed.h spice-gtk-0.12/spice-common/spice-protocol/spice/start-packed.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/start-packed.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/start-packed.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,64 @@ +/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + 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 copyright holder 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 HOLDER 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 + HOLDER OR CONTRIBUTORS 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. +*/ + +/* Ideally this should all have been macros in a common headers, but + * its not possible to put pragmas into header files, so we have + * to use include magic. + * + * Use it like this: + * + * #include + * + * typedef struct SPICE_ATTR_PACKED { + * ... + * } Type; + * + * #include + * + */ + +#ifdef __GNUC__ + +#define SPICE_ATTR_PACKED __attribute__ ((__packed__)) + +#ifdef __MINGW32__ +#pragma pack(push,1) +#endif + +#else + +#pragma pack(push) +#pragma pack(1) +#define SPICE_ATTR_PACKED +#pragma warning(disable:4200) +#pragma warning(disable:4103) + +#endif diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/stats.h spice-gtk-0.12/spice-common/spice-protocol/spice/stats.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/stats.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/stats.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,67 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + 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 copyright holder 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 HOLDER 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 + HOLDER OR CONTRIBUTORS 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. +*/ + +#ifndef _H_SPICE_STATS +#define _H_SPICE_STATS + +#include + +#define SPICE_STAT_SHM_NAME "/spice.%u" +#define SPICE_STAT_NODE_NAME_MAX 20 +#define SPICE_STAT_MAGIC (*(uint32_t*)"STAT") +#define SPICE_STAT_VERSION 1 + +enum { + SPICE_STAT_NODE_FLAG_ENABLED = (1 << 0), + SPICE_STAT_NODE_FLAG_VISIBLE = (1 << 1), + SPICE_STAT_NODE_FLAG_VALUE = (1 << 2), +}; + +#define SPICE_STAT_NODE_MASK_SHOW (SPICE_STAT_NODE_FLAG_ENABLED | SPICE_STAT_NODE_FLAG_VISIBLE) +#define SPICE_STAT_NODE_MASK_SHOW_VALUE (SPICE_STAT_NODE_MASK_SHOW | SPICE_STAT_NODE_FLAG_VALUE) + +typedef struct SpiceStatNode { + uint64_t value; + uint32_t flags; + uint32_t next_sibling_index; + uint32_t first_child_index; + char name[SPICE_STAT_NODE_NAME_MAX]; +} SpiceStatNode; + +typedef struct SpiceStat { + uint32_t magic; + uint32_t version; + uint32_t generation; + uint32_t num_of_nodes; + uint32_t root_index; + SpiceStatNode nodes[]; +} SpiceStat; + +#endif /* _H_SPICE_STATS */ diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/types.h spice-gtk-0.12/spice-common/spice-protocol/spice/types.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/types.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/types.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,41 @@ +/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2009 Red Hat, Inc. + + 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 copyright holder 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 HOLDER 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 + HOLDER OR CONTRIBUTORS 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. +*/ + +#ifndef _H_SPICE_TYPES +#define _H_SPICE_TYPES + +/* We always want the standard int types + * If they are not in stdint.h on your system, + * include the right one here. */ +#include +#include + +#endif /* _H_SPICE_TYPES */ diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/vd_agent.h spice-gtk-0.12/spice-common/spice-protocol/spice/vd_agent.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/vd_agent.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/vd_agent.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,206 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + 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 copyright holder 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 HOLDER 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 + HOLDER OR CONTRIBUTORS 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. +*/ + +#ifndef _H_VD_AGENT +#define _H_VD_AGENT + +#include + +#include + +enum { + VDP_CLIENT_PORT = 1, + VDP_SERVER_PORT, + VDP_END_PORT +}; + +typedef struct SPICE_ATTR_PACKED VDIChunkHeader { + uint32_t port; + uint32_t size; +} VDIChunkHeader; + +typedef struct SPICE_ATTR_PACKED VDAgentMessage { + uint32_t protocol; + uint32_t type; + uint64_t opaque; + uint32_t size; + uint8_t data[0]; +} VDAgentMessage; + +#define VD_AGENT_PROTOCOL 1 +#define VD_AGENT_MAX_DATA_SIZE 2048 +#define VD_AGENT_CLIPBOARD_MAX_SIZE_DEFAULT 1024 +#define VD_AGENT_CLIPBOARD_MAX_SIZE_ENV "SPICE_CLIPBOARD_MAX_SIZE" + +enum { + VD_AGENT_MOUSE_STATE = 1, + VD_AGENT_MONITORS_CONFIG, + VD_AGENT_REPLY, + VD_AGENT_CLIPBOARD, + VD_AGENT_DISPLAY_CONFIG, + VD_AGENT_ANNOUNCE_CAPABILITIES, + VD_AGENT_CLIPBOARD_GRAB, + VD_AGENT_CLIPBOARD_REQUEST, + VD_AGENT_CLIPBOARD_RELEASE, + VD_AGENT_END_MESSAGE, +}; + +typedef struct SPICE_ATTR_PACKED VDAgentMonConfig { + uint32_t height; + uint32_t width; + uint32_t depth; + int32_t x; + int32_t y; +} VDAgentMonConfig; + +enum { + VD_AGENT_CONFIG_MONITORS_FLAG_USE_POS = (1 << 0), +}; + +typedef struct SPICE_ATTR_PACKED VDAgentMonitorsConfig { + uint32_t num_of_monitors; + uint32_t flags; + VDAgentMonConfig monitors[0]; +} VDAgentMonitorsConfig; + +enum { + VD_AGENT_DISPLAY_CONFIG_FLAG_DISABLE_WALLPAPER = (1 << 0), + VD_AGENT_DISPLAY_CONFIG_FLAG_DISABLE_FONT_SMOOTH = (1 << 1), + VD_AGENT_DISPLAY_CONFIG_FLAG_DISABLE_ANIMATION = (1 << 2), + VD_AGENT_DISPLAY_CONFIG_FLAG_SET_COLOR_DEPTH = (1 << 3), +}; + +typedef struct SPICE_ATTR_PACKED VDAgentDisplayConfig { + uint32_t flags; + uint32_t depth; +} VDAgentDisplayConfig; + +#define VD_AGENT_LBUTTON_MASK (1 << 1) +#define VD_AGENT_MBUTTON_MASK (1 << 2) +#define VD_AGENT_RBUTTON_MASK (1 << 3) +#define VD_AGENT_UBUTTON_MASK (1 << 4) +#define VD_AGENT_DBUTTON_MASK (1 << 5) + +typedef struct SPICE_ATTR_PACKED VDAgentMouseState { + uint32_t x; + uint32_t y; + uint32_t buttons; + uint8_t display_id; +} VDAgentMouseState; + +typedef struct SPICE_ATTR_PACKED VDAgentReply { + uint32_t type; + uint32_t error; +} VDAgentReply; + +enum { + VD_AGENT_SUCCESS = 1, + VD_AGENT_ERROR, +}; + +typedef struct SPICE_ATTR_PACKED VDAgentClipboard { +#if 0 /* VD_AGENT_CAP_CLIPBOARD_SELECTION */ + uint8_t selection; + uint8_t __reserved[sizeof(uint32_t) - 1 * sizeof(uint8_t)]; +#endif + uint32_t type; + uint8_t data[0]; +} VDAgentClipboard; + +enum { + VD_AGENT_CLIPBOARD_NONE = 0, + VD_AGENT_CLIPBOARD_UTF8_TEXT, + VD_AGENT_CLIPBOARD_IMAGE_PNG, /* All clients with image support should support this one */ + VD_AGENT_CLIPBOARD_IMAGE_BMP, /* optional */ + VD_AGENT_CLIPBOARD_IMAGE_TIFF, /* optional */ + VD_AGENT_CLIPBOARD_IMAGE_JPG, /* optional */ +}; + +typedef struct SPICE_ATTR_PACKED VDAgentClipboardGrab { +#if 0 /* VD_AGENT_CAP_CLIPBOARD_SELECTION */ + uint8_t selection; + uint8_t __reserved[sizeof(uint32_t) - 1 * sizeof(uint8_t)]; +#endif + uint32_t types[0]; +} VDAgentClipboardGrab; + +typedef struct SPICE_ATTR_PACKED VDAgentClipboardRequest { +#if 0 /* VD_AGENT_CAP_CLIPBOARD_SELECTION */ + uint8_t selection; + uint8_t __reserved[sizeof(uint32_t) - 1 * sizeof(uint8_t)]; +#endif + uint32_t type; +} VDAgentClipboardRequest; + +typedef struct SPICE_ATTR_PACKED VDAgentClipboardRelease { +#if 0 /* VD_AGENT_CAP_CLIPBOARD_SELECTION */ + uint8_t selection; + uint8_t __reserved[sizeof(uint32_t) - 1 * sizeof(uint8_t)]; +#endif +} VDAgentClipboardRelease; + +enum { + VD_AGENT_CAP_MOUSE_STATE = 0, + VD_AGENT_CAP_MONITORS_CONFIG, + VD_AGENT_CAP_REPLY, + VD_AGENT_CAP_CLIPBOARD, + VD_AGENT_CAP_DISPLAY_CONFIG, + VD_AGENT_CAP_CLIPBOARD_BY_DEMAND, + VD_AGENT_CAP_CLIPBOARD_SELECTION, + VD_AGENT_END_CAP, +}; + +enum { + VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD = 0, + VD_AGENT_CLIPBOARD_SELECTION_PRIMARY, + VD_AGENT_CLIPBOARD_SELECTION_SECONDARY, +}; + +typedef struct SPICE_ATTR_PACKED VDAgentAnnounceCapabilities { + uint32_t request; + uint32_t caps[0]; +} VDAgentAnnounceCapabilities; + +#define VD_AGENT_CAPS_SIZE_FROM_MSG_SIZE(msg_size) \ + (((msg_size) - sizeof(VDAgentAnnounceCapabilities)) / sizeof(uint32_t)) + +#define VD_AGENT_CAPS_SIZE ((VD_AGENT_END_CAP + 31) / 32) + +#define VD_AGENT_CAPS_BYTES (((VD_AGENT_END_CAP + 31) / 8) & ~3) + +#define VD_AGENT_HAS_CAPABILITY(caps, caps_size, index) \ + ((index) < (caps_size * 32) && ((caps)[(index) / 32] & (1 << ((index) % 32)))) + +#define VD_AGENT_SET_CAPABILITY(caps, index) \ + { (caps)[(index) / 32] |= (1 << ((index) % 32)); } + +#include + +#endif /* _H_VD_AGENT */ diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice/vdi_dev.h spice-gtk-0.12/spice-common/spice-protocol/spice/vdi_dev.h --- spice-gtk-0.9/spice-common/spice-protocol/spice/vdi_dev.h 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice/vdi_dev.h 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,82 @@ +/* + Copyright (C) 2009 Red Hat, Inc. + + 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 copyright holder 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 HOLDER 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 + HOLDER OR CONTRIBUTORS 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. +*/ + +#ifndef _H_VDI_DEV +#define _H_VDI_DEV + +#include +#include +#include + +#include + +#define REDHAT_PCI_VENDOR_ID 0x1b36 + +#define VDI_PORT_DEVICE_ID 0x0105 +#define VDI_PORT_REVISION 0x01 + +#define VDI_PORT_INTERRUPT (1 << 0) + +#define VDI_PORT_MAGIC (*(uint32_t*)"VDIP") + +typedef struct SPICE_ATTR_PACKED VDIPortPacket { + uint32_t gen; + uint32_t size; + uint8_t data[512 - 2 * sizeof(uint32_t)]; +} VDIPortPacket; + +SPICE_RING_DECLARE(VDIPortRing, VDIPortPacket, 32); + +enum { + VDI_PORT_IO_RANGE_INDEX, + VDI_PORT_RAM_RANGE_INDEX, +}; + +enum { + VDI_PORT_IO_CONNECTION, + VDI_PORT_IO_NOTIFY = 4, + VDI_PORT_IO_UPDATE_IRQ = 8, + + VDI_PORT_IO_RANGE_SIZE = 12 +}; + +typedef struct SPICE_ATTR_PACKED VDIPortRam { + uint32_t magic; + uint32_t generation; + uint32_t int_pending; + uint32_t int_mask; + VDIPortRing input; + VDIPortRing output; + uint32_t reserv[32]; +} VDIPortRam; + +#include + +#endif /* _H_VDI_DEV */ diff -Nru spice-gtk-0.9/spice-common/spice-protocol/spice-protocol.pc.in spice-gtk-0.12/spice-common/spice-protocol/spice-protocol.pc.in --- spice-gtk-0.9/spice-common/spice-protocol/spice-protocol.pc.in 1970-01-01 00:00:00.000000000 +0000 +++ spice-gtk-0.12/spice-common/spice-protocol/spice-protocol.pc.in 2012-04-11 13:51:02.000000000 +0000 @@ -0,0 +1,9 @@ +prefix=@prefix@ +includedir=@includedir@ + +Name: spice-protocol +Description: SPICE protocol headers +Version: @VERSION@ + +Libs: +Cflags: -I${includedir}/spice-1 diff -Nru spice-gtk-0.9/spice.proto spice-gtk-0.12/spice.proto --- spice-gtk-0.9/spice.proto 2011-12-22 11:22:01.000000000 +0000 +++ spice-gtk-0.12/spice.proto 1970-01-01 00:00:00.000000000 +0000 @@ -1,1196 +0,0 @@ -/* built in types: - int8, uint8, 16, 32, 64 -*/ - -typedef fixed28_4 int32 @ctype(SPICE_FIXED28_4); - -struct Point { - int32 x; - int32 y; -}; - -struct Point16 { - int16 x; - int16 y; -}; - -struct PointFix { - fixed28_4 x; - fixed28_4 y; -}; - -struct Rect { - int32 top; - int32 left; - int32 bottom; - int32 right; -}; - -enum32 link_err { - OK, - ERROR, - INVALID_MAGIC, - INVALID_DATA, - VERSION_MISMATCH, - NEED_SECURED, - NEED_UNSECURED, - PERMISSION_DENIED, - BAD_CONNECTION_ID, - CHANNEL_NOT_AVAILABLE -}; - -enum32 warn_code { - WARN_GENERAL -} @prefix(SPICE_); - -enum32 info_code { - INFO_GENERAL -} @prefix(SPICE_); - -flags32 migrate_flags { - NEED_FLUSH, - NEED_DATA_TRANSFER -} @prefix(SPICE_MIGRATE_); - -enum32 notify_severity { - INFO, - WARN, - ERROR, -}; - -enum32 notify_visibility { - LOW, - MEDIUM, - HIGH, -}; - -flags16 mouse_mode { - SERVER, - CLIENT, -}; - -enum16 pubkey_type { - INVALID, - RSA, - RSA2, - DSA, - DSA1, - DSA2, - DSA3, - DSA4, - DH, - EC, -}; - -message Empty { -}; - -message Data { - uint8 data[] @end @ctype(uint8_t); -} @nocopy; - -struct ChannelWait { - uint8 channel_type; - uint8 channel_id; - uint64 message_serial; -} @ctype(SpiceWaitForChannel); - -channel BaseChannel { - server: - message { - migrate_flags flags; - } migrate; - - Data migrate_data; - - message { - uint32 generation; - uint32 window; - } set_ack; - - message { - uint32 id; - uint64 timestamp; - uint8 data[] @ctype(uint8_t) @as_ptr(data_len); - } ping; - - message { - uint8 wait_count; - ChannelWait wait_list[wait_count] @end; - } wait_for_channels; - - message { - uint64 time_stamp; - link_err reason; - } @ctype(SpiceMsgDisconnect) disconnecting; - - message { - uint64 time_stamp; - notify_severity severity; - notify_visibility visibilty; - uint32 what; /* error_code/warn_code/info_code */ - uint32 message_len; - uint8 message[message_len] @end @nomarshal; - } notify; - - client: - message { - uint32 generation; - } ack_sync; - - Empty ack; - - message { - uint32 id; - uint64 timestamp; - } @ctype(SpiceMsgPing) pong; - - Empty migrate_flush_mark; - - Data migrate_data; - - message { - uint64 time_stamp; - link_err reason; - } @ctype(SpiceMsgDisconnect) disconnecting; -}; - -struct ChannelId { - uint8 type; - uint8 id; -}; - -channel MainChannel : BaseChannel { - server: - message { - uint16 port; - uint16 sport; - uint32 host_size; - uint8 *host_data[host_size] @zero_terminated @marshall @nonnull; - uint32 cert_subject_size; - uint8 *cert_subject_data[cert_subject_size] @zero_terminated @marshall; - } @ctype(SpiceMsgMainMigrationBegin) migrate_begin = 101; - - Empty migrate_cancel; - - message { - uint32 session_id; - uint32 display_channels_hint; - uint32 supported_mouse_modes; - uint32 current_mouse_mode; - uint32 agent_connected; - uint32 agent_tokens; - uint32 multi_media_time; - uint32 ram_hint; - } init; - - message { - uint32 num_of_channels; - ChannelId channels[num_of_channels] @end; - } @ctype(SpiceMsgChannels) channels_list; - - message { - mouse_mode supported_modes; - mouse_mode current_mode @unique_flag; - } mouse_mode; - - message { - uint32 time; - } @ctype(SpiceMsgMainMultiMediaTime) multi_media_time; - - Empty agent_connected; - - message { - link_err error_code; - } @ctype(SpiceMsgMainAgentDisconnect) agent_disconnected; - - Data agent_data; - - message { - uint32 num_tokens; - } @ctype(SpiceMsgMainAgentTokens) agent_token; - - message { - uint16 port; - uint16 sport; - uint32 host_size; - uint8 *host_data[host_size] @zero_terminated @marshall; - uint32 cert_subject_size; - uint8 *cert_subject_data[cert_subject_size] @zero_terminated @marshall; - } @ctype(SpiceMsgMainMigrationSwitchHost) migrate_switch_host; - - Empty migrate_end; - - client: - message { - uint64 cache_size; - } @ctype(SpiceMsgcClientInfo) client_info = 101; - - Empty migrate_connected; - - Empty migrate_connect_error; - - Empty attach_channels; - - message { - mouse_mode mode; - } mouse_mode_request; - - message { - uint32 num_tokens; - } agent_start; - - Data agent_data; - - message { - uint32 num_tokens; - } @ctype(SpiceMsgcMainAgentTokens) agent_token; - - Empty migrate_end; -}; - -enum8 clip_type { - NONE, - RECTS -}; - -flags8 path_flags { /* TODO: C enum names changes */ - BEGIN = 0, - END = 1, - CLOSE = 3, - BEZIER = 4, -} @prefix(SPICE_PATH_); - -enum8 video_codec_type { - MJPEG = 1, -}; - -flags8 stream_flags { - TOP_DOWN = 0, -}; - -enum8 brush_type { - NONE, - SOLID, - PATTERN, -}; - -flags8 mask_flags { - INVERS, -}; - -enum8 image_type { - BITMAP, - QUIC, - RESERVED, - LZ_PLT = 100, - LZ_RGB, - GLZ_RGB, - FROM_CACHE, - SURFACE, - JPEG, - FROM_CACHE_LOSSLESS, - ZLIB_GLZ_RGB, - JPEG_ALPHA, -}; - -flags8 image_flags { - CACHE_ME, - HIGH_BITS_SET, - CACHE_REPLACE_ME, -}; - -enum8 bitmap_fmt { - INVALID, - 1BIT_LE, - 1BIT_BE, - 4BIT_LE, - 4BIT_BE, - 8BIT /* 8bit indexed mode */, - 16BIT, /* 0555 mode */ - 24BIT /* 3 byte, brg */, - 32BIT /* 4 byte, xrgb in little endian format */, - RGBA /* 4 byte, argb in little endian format */ -}; - -flags8 bitmap_flags { - PAL_CACHE_ME, - PAL_FROM_CACHE, - TOP_DOWN, -}; - -flags8 jpeg_alpha_flags { - TOP_DOWN, -}; - -enum8 image_scale_mode { - INTERPOLATE, - NEAREST, -}; - -flags16 ropd { - INVERS_SRC, - INVERS_BRUSH, - INVERS_DEST, - OP_PUT, - OP_OR, - OP_AND, - OP_XOR, - OP_BLACKNESS, - OP_WHITENESS, - OP_INVERS, - INVERS_RES, -}; - -flags8 line_flags { - STYLED = 3, - START_WITH_GAP = 2, -}; - -flags8 string_flags { - RASTER_A1, - RASTER_A4, - RASTER_A8, - RASTER_TOP_DOWN, -}; - -flags32 surface_flags { - PRIMARY -}; - -enum32 surface_fmt { - INVALID, - 1_A = 1, - 8_A = 8, - 16_555 = 16 , - 16_565 = 80, - 32_xRGB = 32, - 32_ARGB = 96 -}; - -flags8 alpha_flags { - DEST_HAS_ALPHA, - SRC_SURFACE_HAS_ALPHA -}; - -enum8 resource_type { - INVALID, - PIXMAP -} @prefix(SPICE_RES_TYPE_); - -struct ClipRects { - uint32 num_rects; - Rect rects[num_rects] @end; -}; - -struct PathSegment { - path_flags flags; - uint32 count; - PointFix points[count] @end; -} @ctype(SpicePathSeg); - -struct Path { - uint32 num_segments; - PathSegment segments[num_segments] @ptr_array; -}; - -struct Clip { - clip_type type; - switch (type) { - case RECTS: - ClipRects rects @outvar(cliprects) @to_ptr; - } u @anon; -}; - -struct DisplayBase { - uint32 surface_id; - Rect box; - Clip clip; -} @ctype(SpiceMsgDisplayBase); - -struct ResourceID { - uint8 type; - uint64 id; -}; - -struct WaitForChannel { - uint8 channel_type; - uint8 channel_id; - uint64 message_serial; -}; - -struct Palette { - uint64 unique; - uint16 num_ents; - uint32 ents[num_ents] @end; -}; - -struct BitmapData { - bitmap_fmt format; - bitmap_flags flags; - uint32 x; - uint32 y; - uint32 stride; - switch (flags) { - case PAL_FROM_CACHE: - uint64 palette_id; - default: - Palette *palette @outvar(bitmap); - } pal @anon; - uint8 data[image_size(8, stride, y)] @chunk @nomarshal; -} @ctype(SpiceBitmap); - -struct BinaryData { - uint32 data_size; - uint8 data[data_size] @nomarshal @chunk; -} @ctype(SpiceQUICData); - -struct LZPLTData { - bitmap_flags flags; - uint32 data_size; - switch (flags) { - case PAL_FROM_CACHE: - uint64 palette_id; - default: - Palette *palette @nonnull @outvar(lzplt); - } pal @anon; - uint8 data[data_size] @nomarshal @chunk; -}; - -struct ZlibGlzRGBData { - uint32 glz_data_size; - uint32 data_size; - uint8 data[data_size] @nomarshal @chunk; -} @ctype(SpiceZlibGlzRGBData); - -struct JPEGAlphaData { - jpeg_alpha_flags flags; - uint32 jpeg_size; - uint32 data_size; - uint8 data[data_size] @nomarshal @chunk; -} @ctype(SpiceJPEGAlphaData); - -struct Surface { - uint32 surface_id; -}; - - -struct Image { - struct ImageDescriptor { - uint64 id; - image_type type; - image_flags flags; - uint32 width; - uint32 height; - } descriptor; - - switch (descriptor.type) { - case BITMAP: - BitmapData bitmap; - case QUIC: - BinaryData quic; - case LZ_RGB: - case GLZ_RGB: - BinaryData lz_rgb; - case JPEG: - BinaryData jpeg; - case LZ_PLT: - LZPLTData lz_plt; - case ZLIB_GLZ_RGB: - ZlibGlzRGBData zlib_glz; - case JPEG_ALPHA: - JPEGAlphaData jpeg_alpha; - case SURFACE: - Surface surface; - } u; -}; - -struct Pattern { - Image *pat @nonnull; - Point pos; -}; - -struct Brush { - brush_type type; - switch (type) { - case SOLID: - uint32 color; - case PATTERN: - Pattern pattern; - } u; -}; - -struct QMask { - mask_flags flags; - Point pos; - Image *bitmap; -}; - -struct LineAttr { - line_flags flags; - switch (flags) { - case STYLED: - uint8 style_nseg; - } u1 @anon; - switch (flags) { - case STYLED: - fixed28_4 *style[style_nseg]; - } u2 @anon; -}; - -struct RasterGlyphA1 { - Point render_pos; - Point glyph_origin; - uint16 width; - uint16 height; - uint8 data[image_size(1, width, height)] @end; -} @ctype(SpiceRasterGlyph); - -struct RasterGlyphA4 { - Point render_pos; - Point glyph_origin; - uint16 width; - uint16 height; - uint8 data[image_size(4, width, height)] @end; -} @ctype(SpiceRasterGlyph); - -struct RasterGlyphA8 { - Point render_pos; - Point glyph_origin; - uint16 width; - uint16 height; - uint8 data[image_size(8, width, height)] @end; -} @ctype(SpiceRasterGlyph); - -struct String { - uint16 length; - string_flags flags; /* Special: Only one of a1/a4/a8 set */ - switch (flags) { - case RASTER_A1: - RasterGlyphA1 glyphs[length] @ctype(SpiceRasterGlyph) @ptr_array; - case RASTER_A4: - RasterGlyphA4 glyphs[length] @ctype(SpiceRasterGlyph) @ptr_array; - case RASTER_A8: - RasterGlyphA8 glyphs[length] @ctype(SpiceRasterGlyph) @ptr_array; - } u @anon; -}; - -channel DisplayChannel : BaseChannel { - server: - message { - uint32 x_res; - uint32 y_res; - uint32 bits; - } mode = 101; - - Empty mark; - Empty reset; - message { - DisplayBase base; - Point src_pos; - } copy_bits; - - message { - uint16 count; - ResourceID resources[count] @end; - } @ctype(SpiceResourceList) inval_list; - - message { - uint8 wait_count; - WaitForChannel wait_list[wait_count] @end; - } @ctype(SpiceMsgWaitForChannels) inval_all_pixmaps; - - message { - uint64 id; - } @ctype(SpiceMsgDisplayInvalOne) inval_palette; - - Empty inval_all_palettes; - - message { - uint32 surface_id; - uint32 id; - stream_flags flags; - video_codec_type codec_type; - uint64 stamp; - uint32 stream_width; - uint32 stream_height; - uint32 src_width; - uint32 src_height; - Rect dest; - Clip clip; - } stream_create = 122; - - message { - uint32 id; - uint32 multi_media_time; - uint32 data_size; - uint8 data[data_size] @end @nomarshal; - } stream_data; - - message { - uint32 id; - Clip clip; - } stream_clip; - - message { - uint32 id; - } stream_destroy; - - Empty stream_destroy_all; - - message { - DisplayBase base; - struct Fill { - Brush brush @outvar(brush); - ropd rop_descriptor; - QMask mask @outvar(mask); - } data; - } draw_fill = 302; - - message { - DisplayBase base; - struct Opaque { - Image *src_bitmap; - Rect src_area; - Brush brush; - ropd rop_descriptor; - image_scale_mode scale_mode; - QMask mask @outvar(mask); - } data; - } draw_opaque; - - message { - DisplayBase base; - struct Copy { - Image *src_bitmap; - Rect src_area; - ropd rop_descriptor; - image_scale_mode scale_mode; - QMask mask @outvar(mask); - } data; - } draw_copy; - - message { - DisplayBase base; - struct Blend { - Image *src_bitmap; - Rect src_area; - ropd rop_descriptor; - image_scale_mode scale_mode; - QMask mask @outvar(mask); - } @ctype(SpiceCopy) data; - } draw_blend; - - message { - DisplayBase base; - struct Blackness { - QMask mask @outvar(mask); - } data; - } draw_blackness; - - message { - DisplayBase base; - struct Whiteness { - QMask mask @outvar(mask); - } data; - } draw_whiteness; - - message { - DisplayBase base; - struct Invers { - QMask mask @outvar(mask); - } data; - } draw_invers; - - message { - DisplayBase base; - struct Rop3 { - Image *src_bitmap; - Rect src_area; - Brush brush; - uint8 rop3; - image_scale_mode scale_mode; - QMask mask @outvar(mask); - } data; - } draw_rop3; - - message { - DisplayBase base; - struct Stroke { - Path *path @marshall @nonnull; - LineAttr attr; - Brush brush; - uint16 fore_mode; - uint16 back_mode; - } data; - } draw_stroke; - - message { - DisplayBase base; - struct Text { - String *str @marshall @nonnull; - Rect back_area; - Brush fore_brush @outvar(fore_brush); - Brush back_brush @outvar(back_brush); - uint16 fore_mode; - uint16 back_mode; - } data; - } draw_text; - - message { - DisplayBase base; - struct Transparent { - Image *src_bitmap; - Rect src_area; - uint32 src_color; - uint32 true_color; - } data; - } draw_transparent; - - message { - DisplayBase base; - struct AlphaBlend { - alpha_flags alpha_flags; - uint8 alpha; - Image *src_bitmap; - Rect src_area; - } data; - } draw_alpha_blend; - - message { - uint32 surface_id; - uint32 width; - uint32 height; - surface_fmt format; - surface_flags flags; - } @ctype(SpiceMsgSurfaceCreate) surface_create; - - message { - uint32 surface_id; - } @ctype(SpiceMsgSurfaceDestroy) surface_destroy; - - client: - message { - uint8 pixmap_cache_id; - int64 pixmap_cache_size; //in pixels - uint8 glz_dictionary_id; - int32 glz_dictionary_window_size; // in pixels - } init = 101; -}; - -flags16 keyboard_modifier_flags { - SCROLL_LOCK, - NUM_LOCK, - CAPS_LOCK -}; - -enum8 mouse_button { - INVALID, - LEFT, - MIDDLE, - RIGHT, - UP, - DOWN, -}; - -flags16 mouse_button_mask { - LEFT, - MIDDLE, - RIGHT -}; - -channel InputsChannel : BaseChannel { - client: - message { - uint32 code; - } @ctype(SpiceMsgcKeyDown) key_down = 101; - - message { - uint32 code; - } @ctype(SpiceMsgcKeyUp) key_up; - - message { - keyboard_modifier_flags modifiers; - } @ctype(SpiceMsgcKeyModifiers) key_modifiers; - - message { - int32 dx; - int32 dy; - mouse_button_mask buttons_state; - } @ctype(SpiceMsgcMouseMotion) mouse_motion = 111; - - message { - uint32 x; - uint32 y; - mouse_button_mask buttons_state; - uint8 display_id; - } @ctype(SpiceMsgcMousePosition) mouse_position; - - message { - mouse_button button; - mouse_button_mask buttons_state; - } @ctype(SpiceMsgcMousePress) mouse_press; - - message { - mouse_button button; - mouse_button_mask buttons_state; - } @ctype(SpiceMsgcMouseRelease) mouse_release; - - server: - message { - keyboard_modifier_flags keyboard_modifiers; - } init = 101; - - message { - keyboard_modifier_flags modifiers; - } key_modifiers; - - Empty mouse_motion_ack = 111; -}; - -enum8 cursor_type { - ALPHA, - MONO, - COLOR4, - COLOR8, - COLOR16, - COLOR24, - COLOR32, -}; - -flags16 cursor_flags { - NONE, /* Means no cursor */ - CACHE_ME, - FROM_CACHE, -}; - -struct CursorHeader { - uint64 unique; - cursor_type type; - uint16 width; - uint16 height; - uint16 hot_spot_x; - uint16 hot_spot_y; -}; - -struct Cursor { - cursor_flags flags; - switch (flags) { - case !NONE: - CursorHeader header; - } u @anon; - uint8 data[] @as_ptr(data_size); -}; - -channel CursorChannel : BaseChannel { - server: - message { - Point16 position; - uint16 trail_length; - uint16 trail_frequency; - uint8 visible; - Cursor cursor; - } init = 101; - - Empty reset; - - message { - Point16 position; - uint8 visible; - Cursor cursor; - } set; - - message { - Point16 position; - } move; - - Empty hide; - - message { - uint16 length; - uint16 frequency; - } trail; - - message { - uint64 id; - } @ctype(SpiceMsgDisplayInvalOne) inval_one; - - Empty inval_all; -}; - -enum16 audio_data_mode { - INVALID, - RAW, - CELT_0_5_1, -}; - -enum16 audio_fmt { - INVALID, - S16, -}; - -message AudioVolume { - uint8 nchannels; - uint16 volume[nchannels] @end; -}; - -message AudioMute { - uint8 mute; -}; - -channel PlaybackChannel : BaseChannel { - server: - message { - uint32 time; - uint8 data[] @as_ptr(data_size); - } @ctype(SpiceMsgPlaybackPacket) data = 101; - - message { - uint32 time; - audio_data_mode mode; - uint8 data[] @as_ptr(data_size); - } mode; - - message { - uint32 channels; - audio_fmt format; - uint32 frequency; - uint32 time; - } start; - - Empty stop; - AudioVolume volume; - AudioMute mute; -}; - -channel RecordChannel : BaseChannel { - server: - message { - uint32 channels; - audio_fmt format; - uint32 frequency; - } start = 101; - - Empty stop; - AudioVolume volume; - AudioMute mute; - client: - message { - uint32 time; - uint8 data[] @nomarshal @as_ptr(data_size); - } @ctype(SpiceMsgcRecordPacket) data = 101; - - message { - uint32 time; - audio_data_mode mode; - uint8 data[] @as_ptr(data_size); - } mode; - - message { - uint32 time; - } start_mark; -}; - -enum16 tunnel_service_type { - INVALID, - GENERIC, - IPP, -}; - -enum16 tunnel_ip_type { - INVALID, - IPv4, -}; - -struct TunnelIpInfo { - tunnel_ip_type type; - switch (type) { - case IPv4: - uint8 ipv4[4]; - } u; -} @ctype(SpiceMsgTunnelIpInfo); - -channel TunnelChannel : BaseChannel { - server: - message { - uint16 max_num_of_sockets; - uint32 max_socket_data_size; - } init = 101; - - message { - uint32 service_id; - TunnelIpInfo virtual_ip; - } service_ip_map; - - message { - uint16 connection_id; - uint32 service_id; - uint32 tokens; - } socket_open; - - message { - uint16 connection_id; - } socket_fin; - - message { - uint16 connection_id; - } socket_close; - - message { - uint16 connection_id; - uint8 data[] @end; - } socket_data; - - message { - uint16 connection_id; - } socket_closed_ack; - - message { - uint16 connection_id; - uint32 num_tokens; - } @ctype(SpiceMsgTunnelSocketTokens) socket_token; - - client: - message { - tunnel_service_type type; - uint32 id; - uint32 group; - uint32 port; - uint8 *name[cstring()] @nocopy; - uint8 *description[cstring()] @nocopy; - switch (type) { - case IPP: - TunnelIpInfo ip @ctype(SpiceMsgTunnelIpInfo); - } u; - } @ctype(SpiceMsgcTunnelAddGenericService) service_add = 101; - - message { - uint32 id; - } @ctype(SpiceMsgcTunnelRemoveService) service_remove; - - message { - uint16 connection_id; - uint32 tokens; - } socket_open_ack; - - message { - uint16 connection_id; - } socket_open_nack; - - message { - uint16 connection_id; - } socket_fin; - - message { - uint16 connection_id; - } socket_closed; - - message { - uint16 connection_id; - } socket_closed_ack; - - message { - uint16 connection_id; - uint8 data[] @end; - } socket_data; - - message { - uint16 connection_id; - uint32 num_tokens; - } @ctype(SpiceMsgcTunnelSocketTokens) socket_token; -}; - -enum32 vsc_message_type { - Init = 1, - Error, - ReaderAdd, - ReaderRemove, - ATR, - CardRemove, - APDU, - Flush, - FlushComplete -} @prefix(VSC_); - -struct VscMessageHeader { - vsc_message_type type; - uint32 reader_id; - uint32 length; -} @ctype(VSCMsgHeader); - -struct VscMessageError { - uint32 code; -} @ctype(VSCMsgError); - -struct VscMessageAPDU { - uint8 data[]; -} @ctype(VSCMsgAPDU); - -struct VscMessageATR { - uint8 data[]; -} @ctype(VSCMsgATR); - -struct VscMessageReaderAdd { - int8 *reader_name[] @zero_terminated @nonnull @end @nomarshal; -} @ctype(VSCMsgReaderAdd); - -channel SmartcardChannel : BaseChannel { - server: - message { - vsc_message_type type; - uint32 reader_id; - uint32 length; - uint8 data[] @end; - } @ctype(SpiceMsgSmartcard) msg = 101; - - client: - message { - VscMessageHeader header; - switch (header.type) { - case ReaderAdd: - VscMessageReaderAdd add; - case ATR: - case APDU: - VscMessageATR atr_data; - case Error: - VscMessageError error; - } u @anon; - } @ctype(SpiceMsgcSmartcard) msg = 101; - - message { - vsc_message_type type; - uint32 reader_id; - uint32 length; - } @ctype(VSCMsgHeader) header = 101; - - message { - uint32 code; - } @ctype(VSCMsgError) error = 101; - - message { - uint8 data[]; - } @ctype(VSCMsgATR) atr = 101; - - message { - int8 reader_name[] @zero_terminated @nonnull; - } @ctype(VSCMsgReaderAdd) reader_add = 101; -} @ifdef(USE_SMARTCARD); - -channel UsbredirChannel : BaseChannel { -server: - Data data = 101; -client: - Data data = 101; -}; - -protocol Spice { - MainChannel main = 1; - DisplayChannel display; - InputsChannel inputs; - CursorChannel cursor; - PlaybackChannel playback; - RecordChannel record; - TunnelChannel tunnel; - SmartcardChannel smartcard; - UsbredirChannel usbredir; -}; diff -Nru spice-gtk-0.9/.tarball-version spice-gtk-0.12/.tarball-version --- spice-gtk-0.9/.tarball-version 2012-01-31 13:32:39.000000000 +0000 +++ spice-gtk-0.12/.tarball-version 2012-04-24 11:26:38.000000000 +0000 @@ -1 +1 @@ -0.9 +0.12 diff -Nru spice-gtk-0.9/THANKS spice-gtk-0.12/THANKS --- spice-gtk-0.9/THANKS 2011-10-10 09:29:00.000000000 +0000 +++ spice-gtk-0.12/THANKS 2012-04-11 13:51:03.000000000 +0000 @@ -5,4 +5,5 @@ Christophe Fergeau Daniel P. Berrange Hans de Goede +Nicolas Prochazka Tiziano Mueller diff -Nru spice-gtk-0.9/vapi/Makefile.in spice-gtk-0.12/vapi/Makefile.in --- spice-gtk-0.9/vapi/Makefile.in 2012-01-31 10:23:00.000000000 +0000 +++ spice-gtk-0.12/vapi/Makefile.in 2012-04-24 11:21:04.000000000 +0000 @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -39,22 +39,24 @@ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/check_python.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/intltool.m4 \ - $(top_srcdir)/m4/ld-version.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/ld-version.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/manywarnings.m4 \ + $(top_srcdir)/m4/spice-compile-warnings.m4 \ + $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = @@ -79,6 +81,12 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(vapidir)" "$(DESTDIR)$(vapidir)" DATA = $(dist_vapi_DATA) $(vapi_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -103,6 +111,7 @@ CELT051_LIBDIR = @CELT051_LIBDIR@ CELT051_LIBS = @CELT051_LIBS@ CFLAGS = @CFLAGS@ +COMMON_CFLAGS = @COMMON_CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ @@ -153,6 +162,10 @@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ @@ -208,8 +221,6 @@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PROTOCOL_CFLAGS = @PROTOCOL_CFLAGS@ -PROTOCOL_LIBS = @PROTOCOL_LIBS@ PULSE_CFLAGS = @PULSE_CFLAGS@ PULSE_LIBS = @PULSE_LIBS@ PYGTK_CFLAGS = @PYGTK_CFLAGS@ @@ -229,7 +240,6 @@ SMARTCARD_CFLAGS = @SMARTCARD_CFLAGS@ SMARTCARD_LIBS = @SMARTCARD_LIBS@ SPICE_CFLAGS = @SPICE_CFLAGS@ -SPICE_COMMON_SRCDIR = @SPICE_COMMON_SRCDIR@ SPICE_GLIB_CFLAGS = @SPICE_GLIB_CFLAGS@ SPICE_GLIB_REQUIRES = @SPICE_GLIB_REQUIRES@ SPICE_GTK_API_VERSION = @SPICE_GTK_API_VERSION@ @@ -238,14 +248,19 @@ SPICE_GTK_REQUIRES = @SPICE_GTK_REQUIRES@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ +STOW = @STOW@ STRIP = @STRIP@ USBREDIR_CFLAGS = @USBREDIR_CFLAGS@ USBREDIR_LIBS = @USBREDIR_LIBS@ +USB_IDS = @USB_IDS@ USE_NLS = @USE_NLS@ VALAC = @VALAC@ VAPIDIR = @VAPIDIR@ VAPIGEN = @VAPIGEN@ VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_LDFLAGS = @WARN_LDFLAGS@ +WARN_PYFLAGS = @WARN_PYFLAGS@ XGETTEXT = @XGETTEXT@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ @@ -283,6 +298,8 @@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ @@ -301,6 +318,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ @@ -383,9 +401,7 @@ @$(NORMAL_UNINSTALL) @list='$(dist_vapi_DATA)'; test -n "$(vapidir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(vapidir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(vapidir)" && rm -f $$files + dir='$(DESTDIR)$(vapidir)'; $(am__uninstall_files_from_dir) install-vapiDATA: $(vapi_DATA) @$(NORMAL_INSTALL) test -z "$(vapidir)" || $(MKDIR_P) "$(DESTDIR)$(vapidir)" @@ -403,9 +419,7 @@ @$(NORMAL_UNINSTALL) @list='$(vapi_DATA)'; test -n "$(vapidir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(vapidir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(vapidir)" && rm -f $$files + dir='$(DESTDIR)$(vapidir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: @@ -462,10 +476,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: diff -Nru spice-gtk-0.9/.version spice-gtk-0.12/.version --- spice-gtk-0.9/.version 2011-09-02 14:57:13.000000000 +0000 +++ spice-gtk-0.12/.version 2012-04-24 11:24:31.000000000 +0000 @@ -1 +1 @@ -0.7.40-d904-dirty +0.12