* How to make a new pseudovector type?
@ 2011-07-15 10:31 joakim
2011-07-18 13:46 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: joakim @ 2011-07-15 10:31 UTC (permalink / raw)
To: emacs-devel
In the xwidget branch I use PVEC_OTHER = 0x400000 from enum pvec_type
to represent an xwidget. It works, except the print loop doesnt like to
print PVEC_OTHER(at least I think thats what happening)
So, anyway. pvec_type has 14 entires which are all occupied.
PVEC_TYPE_MASK = 0x7ffe00. 1 bit per type. Should I expand this for a
new type? Do I need a new type or is PVEC_OHER enough but I have missed
something? Is pseudovectors the thing I should actually use if I want
lisp to allocate a structure with mixed c and lisp?
I need 2 new types currently, struct xwidget for the model and struct
xwidget_view for the views. BTW I find it remarkable that 14 types are
sufficient. So theres something I maybe dont understand here.
For reference here is the declaration I use:
struct xwidget{
struct vectorlike_header header;
Lisp_Object plist;//auxilliary data
Lisp_Object type;//the widget type
Lisp_Object buffer; //buffer where xwidget lives
Lisp_Object title;//a title that is used for button labels for instance
//here ends the lisp part.
//"height" is the marker field
int height;
int width;
//for offscreen widgets, unused if not osr
GtkWidget* widget_osr;
GtkContainer* widgetwindow_osr;
};
Heres the other one:
//struct for each xwidget view
struct xwidget_view{
struct vectorlike_header header;
struct xwidget* model;
//here ends the lisp part.
//"redisplayed" is the marker field
int redisplayed; //if touched by redisplay
struct window *w; //TODO should be lisp
int hidden;//if the "live" instance isnt drawn
int initialized;
GtkWidget* widget;
GtkContainer* widgetwindow;
GtkContainer* emacswindow;
int x; int y;
int clip_right; int clip_bottom; int clip_top; int clip_left;
long handler_id;
};
--
Joakim Verona
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to make a new pseudovector type?
2011-07-15 10:31 How to make a new pseudovector type? joakim
@ 2011-07-18 13:46 ` Stefan Monnier
2011-07-18 13:55 ` joakim
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2011-07-18 13:46 UTC (permalink / raw)
To: joakim; +Cc: emacs-devel
> In the xwidget branch I use PVEC_OTHER = 0x400000 from enum pvec_type
> to represent an xwidget.
Don't: create a new PVEC_XWIDGET instead.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to make a new pseudovector type?
2011-07-18 13:46 ` Stefan Monnier
@ 2011-07-18 13:55 ` joakim
2011-07-18 14:19 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: joakim @ 2011-07-18 13:55 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> In the xwidget branch I use PVEC_OTHER = 0x400000 from enum pvec_type
>> to represent an xwidget.
>
> Don't: create a new PVEC_XWIDGET instead.
Cool, but the bitmask is fully utilized. Can I expand the bitmask? (I
need 2 types.) if so, why is it so small to begin with?
>
>
> Stefan
--
Joakim Verona
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to make a new pseudovector type?
2011-07-18 13:55 ` joakim
@ 2011-07-18 14:19 ` Stefan Monnier
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2011-07-18 14:19 UTC (permalink / raw)
To: joakim; +Cc: emacs-devel
>>> In the xwidget branch I use PVEC_OTHER = 0x400000 from enum pvec_type
>>> to represent an xwidget.
>> Don't: create a new PVEC_XWIDGET instead.
> Cool, but the bitmask is fully utilized. Can I expand the bitmask?
Of course.
> (I need 2 types.) if so, why is it so small to begin with?
It's made as large as needed. Actually, it largely doesn't need to be
a bitmask. Last time I looked it's only used at one or two places to
make it marginally quicker to check if something is one of some
particular subset of the possible pseudo-vectors.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-07-18 14:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-15 10:31 How to make a new pseudovector type? joakim
2011-07-18 13:46 ` Stefan Monnier
2011-07-18 13:55 ` joakim
2011-07-18 14:19 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).