Commit graph

90 commits

Author SHA1 Message Date
Behdad Esfahbod
9f9f5317dc [util] Fix pangram 2008-12-24 22:29:59 -05:00
Behdad Esfahbod
52cc31a7fa [util] Add cairo-view 2008-12-23 13:48:52 -05:00
Chris Wilson
449bf0bb7b [script] Silence incorrect compiler warnings
Bah, the compiler failed to do its IPA correctly and wrongly complained
about potential use of uninitialised out-params guarded by the return
value. Silence them!
2008-12-18 12:06:46 +00:00
Chris Wilson
0df43251d4 [replay] Take advantage of unresolved fonts
As Behdad has changed the underlying ft-font to accept unresolved patterns,
take advantage of that to simplify the replay code.
2008-12-18 12:06:35 +00:00
Chris Wilson
aa65e756d4 [script] Avoid creating 0x0 windows
XCreateWindow dies if asked to create a 0x0 window, so don't and use a 1x1
pixel window for a zero-sized surface.
2008-12-18 10:40:14 +00:00
Chris Wilson
9b46d13b6c [trace] Runtime version check.
Check that the application is using cairo >= 1.9 before attempting to
query the mime-data.
2008-12-18 10:40:13 +00:00
Chris Wilson
6f284587a4 [script] Add examples
Add some simple examples to demonstrate CairoScript, courtesy of M Joonas
Philaja.
2008-12-12 12:00:44 +00:00
Chris Wilson
463dc28913 [script] Allocate the interned strings from a permanent pool
Reduce memory fragmentation by allocating the permanent strings from a
single pool.
2008-12-12 12:00:44 +00:00
Chris Wilson
adc9c90d79 [script] Freed object cache.
Cache the last freed object to reduce malloc pressure.
2008-12-12 12:00:44 +00:00
Chris Wilson
1042909796 [script] Replay multiple files.
Iterate over the argument vector and replay each file on the command line.
2008-12-12 12:00:44 +00:00
Chris Wilson
c5c04528b5 [script] Slab allocator
Allocate small objects from a pool and maintain a per-size free-list.
2008-12-12 12:00:44 +00:00
Chris Wilson
83f0e6cf62 [script] Inline the stack push
Frequently to push an object onto the stack all we need is to simply
perform the struct copy - so inline it and only call the out-of-line
function if we need to enlarge the stack.
2008-12-12 12:00:43 +00:00
Chris Wilson
565b3d6ad6 [script] Switch to hyphens.
Using hyphen in the operators is easier to read than underscores.
2008-12-12 12:00:43 +00:00
Chris Wilson
3abfd836a0 [script] Null constructor
Expose 'null', principally for comparison purposes.
2008-12-12 12:00:43 +00:00
M Joonas Pihlaja
7540ac7f23 [script] Reverse direction of bitshift.
Positive shift counts should shift left according to PostScript.
2008-12-12 12:00:43 +00:00
Chris Wilson
4be479cc63 [script] Add simple to integer converter
Simple operator to coerce the type of the object on top of the stack to
integer.
2008-12-12 12:00:43 +00:00
Chris Wilson
6711b591b9 [script] Simple replay.
Basic script executer.
2008-12-12 12:00:42 +00:00
Chris Wilson
177a68ef3e [script] Add a few mathematical constants
Just pi and the sqrt(2) for the moment, more to come on demand.
2008-12-12 12:00:42 +00:00
Chris Wilson
5dfaa22a57 [script] Add repeat operator.
Simple operator to repeat procedure n times.
2008-12-12 12:00:42 +00:00
M Joonas Pihlaja
738cb32745 [script] Fix \t escapes in string literals.
Typo \r -> \t.
2008-12-12 12:00:42 +00:00
M Joonas Pihlaja
265ebd372a [script] Flesh out the relational comparison operators to be more PostScript-like.
The relational comparison operators can now compare strings vs names
by content as well as performing automatic type promotions on the
numeric types.  For other types relational comparisons succeeed
only if the values compare equal according to the eq operator, and
put the interpreter into a type-error state otherwise.
2008-12-12 12:00:42 +00:00
M Joonas Pihlaja
05afec7a8a [script] Implement the ne operator. 2008-12-12 12:00:41 +00:00
M Joonas Pihlaja
1aeb96dc28 [script] Implement PostScript-like semantics for the eq operator.
The eq operator would only work for some types and put the
interpreter in an error state if passed objects it didn't
know how to compare.  It would also not compare strings
by value nor allow strings to be compared to names.
This patch makes any two objects comparable.
2008-12-12 12:00:41 +00:00
M Joonas Pihlaja
620028fd19 [script] Don't segfault when hashing empty strings.
Check for the empty string.
2008-12-12 12:00:41 +00:00
M Joonas Pihlaja
4ba77f7765 [script] Fix dictionary construction to access the right stack slots.
It bound values to themselves and ignored keys.
2008-12-12 12:00:41 +00:00
Chris Wilson
e184bf0d35 Fix compilation with --enable-png=no
Adrian Johnson spotted that the build was broken if the PNG functions were
disabled. Fix.
2008-12-12 10:20:47 +00:00
M Joonas Pihlaja
41cb91d417 [script] Use the in-tree libcairo for csi-replay.
csi-replay was missing the in-tree libcairo.la so the build was
failing while looking for new symbols from the system libcairo.
2008-11-26 23:49:12 +02:00
Chris Wilson
5591cb58fd [script] Only use zlib if available.
Conditionally link against zlib - replaying a script will fail if the
trace uses a compressed format.
2008-11-26 17:43:22 +00:00
Chris Wilson
9432c0c9b8 [script] Link the interpreter against the built library.
Ensure we correctly link against the version of cairo just built.
2008-11-26 17:35:09 +00:00
Chris Wilson
815e5b962e [script] Add a fallback image surface for replay
If we do not have a native windowing surface compiled into the library,
just replay the script to an image surface.
2008-11-26 17:30:29 +00:00
Luo Jinghua
1f44fb97f3 cairo-script: add $(top_builddir)/src to CPPPATH.
$(top_builddir)/src is needed to find cairo-features.h while
building out of tree.
2008-11-25 20:45:03 +08:00
Chris Wilson
1f48b36933 [script] Build fix for ! HAS_FT_FONT
Correct the macro definition used when compiling without FreeType.
2008-11-21 09:35:41 +00:00
Chris Wilson
0d5e533b6c [trace] Correctly push font-face onto the operand stack.
We tried to push a reference to an undefined font-face, now we just copy
from the operand stack.
2008-11-19 17:11:50 +00:00
Chris Wilson
b426346b48 [trace] Construct matrices directly
Avoid building a temporary array by constructing the matrix directly.
2008-11-19 17:11:49 +00:00
Chris Wilson
c41b99268d Conditionally include byteswap.h
Fixup compilation by copying the checks from cairo-wideint-private.h to
conditionally include byteswap.h and provide fallback implementations.
2008-11-19 11:59:21 +00:00
Chris Wilson
91c17d3332 [trace] Simple unbounded cache for symbol lookups.
Reparsing the dwarf info for every lookup is very slow, so cache the
symbol lookups. This initial implementation is unbounded in the simple
belief that the actual number of unique lookups during a program's
lifetime should be fairly small. (Extending to a bounded MRU list is left
as an exercise for the reader.)
2008-11-19 11:59:20 +00:00
Chris Wilson
2839a0e800 [script] Add a simple replay.
A very simple replay program for trace replay.
2008-11-19 11:59:20 +00:00
M Joonas Pihlaja
3b11997a23 [cairo-script] Remove outdated #error to allow compilation to succeed.
The interpreter doesn't depend on the script surface anymore.
2008-11-13 18:06:40 +02:00
Chris Wilson
cdfffc7420 Add CairoScript interpreter
Add a CairoScript interpreter library and use it to replay the test output
for the CairoScript backend. The library is also used by the currently
standalone Sphinx debugger [git://anongit.freedesktop.org/~ickle/sphinx].
The syntax/operator semantics are not yet finalized, but are expected to
mature before the next stable release.
2008-11-13 11:36:55 +00:00
Chris Wilson
5f0aa27445 [trace] Add caller line info.
Use lookup_symbol() on the return address to identify the caller and emit
useful debug info to the trace.
2008-11-13 11:36:42 +00:00
Chris Wilson
4cd6b0c0b9 [trace] Check for an undefined pattern and use index instead. 2008-11-13 11:36:41 +00:00
Chris Wilson
76f249a493 [trace] Detect and report broken traces.
We cannot trace the cairo-script-interpreter as that uses Cairo's private
symbols.
2008-11-13 11:36:40 +00:00
Chris Wilson
01e2021b2b [trace] Trace mark-dirty
Capture the image data on mark dirty and record in the trace.
2008-11-13 11:36:39 +00:00
Chris Wilson
8f3d0b55f5 [trace] Add unstable warning.
Add warning that CairoScript is unfinished and I may radically alter the
format/syntax/language before release.
2008-11-13 11:36:32 +00:00
Chris Wilson
7ad2635ebe [trace] Disable stdout by default.
Don't hog the terminal when we save to a trace file anyway.
2008-11-13 11:36:32 +00:00
Chris Wilson
5badcf6e37 [trace] Use a string literal for the type.
In order that the string is interned and so is only allocated the once.
2008-11-08 11:18:26 +00:00
Chris Wilson
1d0faefbc8 [trace] Record the XID as a number
Don't waste string constants (which get interned) for a simple number!
2008-11-08 11:18:26 +00:00
Chris Wilson
899a159b13 [trace] Remove stray /source
An accidental /source was pushing pushed onto the operand stack and never
used.
2008-11-08 11:18:25 +00:00
Chris Wilson
2554d17598 [surface] Pass a separate closure for the mime-type destroy notifier.
A limitation of the current API was that the destroy notifier was called
on the mime-data block. This prevents the user from passing in a pointer
to a managed block, for example a mime-data block belonging to a
ref-counted object. We can overcome this by allowing the user to specify
the closure to be used with the destroy notifier.
2008-11-07 19:30:33 +00:00
Chris Wilson
ec559822cf [trace] Use the mime-type image representation
When emitting image data, first check to see if we have a pre-compressed
alternate representation.
2008-11-05 18:13:10 +00:00