Sunday, May 29, 2011

Access the DOM of a SVG that is embedded by reference

You can reference SVG files via object, embed, or iframe tag. In each case, you can access the SVG DOM from within the parent document.

Use either the contentDocument property or the (deprecated) getSVGDocument function of the embedding element to access the SVG document, for example: var object = documents.getElementsByTagName('object')[0]; svgDocument = object.contentDocument;

See here for a more elaborate example. Note: For security reasons, the contents of the SVG document can be accessed from the parent document only if both documents are located in the same domain.

PC-Lint: Header files

Options to control the search for included files:
-i or -I
synonym options, simply specify a directory to search for incldued files
-i-
clear list of directories specified with -i options
--i
like -i but directories specified with this option are search after directories specified with -i. Normally used to specify compiler and system include directories.
+fdi
Included files are searched first in the same directory as the including file.
Beware that PC-Lint uses the INCLUDE environment variables. Say you have installed Visual Studio but are linting code for the Embedded Workbench, you might lint a mix of Windows and embOS header files. To avoid this either unset the INCLUDE environment variable or use the -incvar lint option, for example: -incvar(DONT_USE_ENVIRONMENT)

-incvar has to be given on the lint command line, not in a file.

PC-Lint: Read the message documentation carefully

Most messages are parametrized with a string, type, or symbol. Depending on the type of the parameter, the message can be suppressed with either -estring, -etype, or -esym. The message documentation (the endless list at the end of the user manual) exactly documents the type of the parameters of each message. Don't rely on common sense, the name of a type or function might very will be displayed in a string parameter. Caveat: I experienced once that the documentation is wrong in respect to the parameter type, but otherwise I found the documentation to be helpful.

PC-Lint

Creating a PC-Lint configuration is easy: start up the configuration wizard, select the target platform of your code and it creates a configuration for you. Congratulations, 0.01% of the work of configuring PC-Lint is done. Where to turn for help when problems with PC-Lint arise:
  • discussion forum at Gimpel's website
  • the user manual
  • this blog (as soon as I posted a little more)