<commit_before>/*****************************************************************************
 * vlcplugin.h: a VLC plugin for Mozilla
 *****************************************************************************
 * Copyright (C) 2002-2009 the VideoLAN team
 * $Id$
 *
 * Authors: <NAME> <<EMAIL>>
 *          <NAME> <<EMAIL>>
 *          <NAME> <<EMAIL>>
 *
 * 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

/*******************************************************************************
 * Instance state information about the plugin.
 ******************************************************************************/
#ifndef __VLCPLUGIN_H__
#define __VLCPLUGIN_H__

#include <vlc/vlc.h>
#include <pthread.h>
#include <npapi.h>
#include <vector>

#include "control/nporuntime.h"

#if !defined(XP_MACOSX) && !defined(XP_UNIX) && !defined(XP_WIN)
#define XP_UNIX 1
#elif defined(XP_MACOSX)
#undef XP_UNIX
#endif

#ifdef XP_WIN
    /* Windows stuff */
#endif

#ifdef XP_MACOSX
    /* Mac OS X stuff */
#   include <Quickdraw.h>
#endif

#ifdef XP_UNIX
    /* X11 stuff */
#   include <X11/Xlib.h>
#   include <X11/Intrinsic.h>
#   include <X11/StringDefs.h>
#   include <X11/X.h>

#   ifndef __APPLE__
#       include <X11/xpm.h>
#   endif
#endif

#ifndef __MAX
#   define __MAX(a, b)   ( ((a) > (b)) ? (a) : (b) )
#endif
#ifndef __MIN
#   define __MIN(a, b)   ( ((a) < (b)) ? (a) : (b) )
#endif

typedef enum vlc_toolbar_clicked_e {
    clicked_Unknown = 0,
    clicked_Play,
    clicked_Pause,
    clicked_Stop,
    clicked_timeline,
    clicked_Time,
    clicked_Fullscreen,
    clicked_Mute,
    clicked_Unmute
} vlc_toolbar_clicked_t;


// Note that the accessor functions are unsafe, but this is handled in
// the next layer up. 64bit uints can be substituted to taste (shift=6).
template<size_t M> class bitmap
{
private:
    typedef uint32_t bitu_t; enum { shift=5 };
    enum { bmax=M, bpu=1<<shift, mask=bpu-1, units=(bmax+bpu-1)/bpu };
    bitu_t bits[units];
public:
    bool get(size_t idx) const { return bits[idx>>shift]&(1<<(idx&mask)); }
    void set(size_t idx)       { bits[idx>>shift]|=  1<<(idx&mask);  }
    void reset(size_t idx)     { bits[idx>>shift]&=~(1<<(idx&mask)); }
    void toggle(size_t idx)    { bits[idx>>shift]^=  1<<(idx&mask);  }
    size_t maxbit() const      { return bmax; }
    void clear()               { memset(bits,0,sizeof(bits)); }
    bitmap() { clear(); }
    ~bitmap() { }
    bool empty() const { // naive invert() will break this
        for(size_t i=0;i<units;++i)
            if(bits[i]) return false;
        return true;
    }
};

typedef bitmap<libvlc_num_event_types> eventtypes_bitmap_t;


class EventObj: private eventtypes_bitmap_t
{
private:
    typedef libvlc_event_type_t event_t;
    bool have_event(event_t e) const { return e<maxbit()?get(e):false; }<commit_msg>Mozilla: untested compile fix<commit_after>/*****************************************************************************
 * vlcplugin.h: a VLC plugin for Mozilla
 *****************************************************************************
 * Copyright (C) 2002-2009 the VideoLAN team
 * $Id$
 *
 * Authors: <NAME> <<EMAIL>>
 *          <NAME> <<EMAIL>>
 *          <NAME> <<EMAIL>>
 *
 * 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

/*******************************************************************************
 * Instance state information about the plugin.
 ******************************************************************************/
#ifndef __VLCPLUGIN_H__
#define __VLCPLUGIN_H__

#include <vlc/vlc.h>
#include <pthread.h>
#include <npapi.h>
#include <vector>

#include "control/nporuntime.h"

#if !defined(XP_MACOSX) && !defined(XP_UNIX) && !defined(XP_WIN)
#define XP_UNIX 1
#elif defined(XP_MACOSX)
#undef XP_UNIX
#endif

#ifdef XP_WIN
    /* Windows stuff */
#endif

#ifdef XP_MACOSX
    /* Mac OS X stuff */
#   include <Quickdraw.h>
#endif

#ifdef XP_UNIX
    /* X11 stuff */
#   include <X11/Xlib.h>
#   include <X11/Intrinsic.h>
#   include <X11/StringDefs.h>
#   include <X11/X.h>

#   ifndef __APPLE__
#       include <X11/xpm.h>
#   endif
#endif

#ifndef __MAX
#   define __MAX(a, b)   ( ((a) > (b)) ? (a) : (b) )
#endif
#ifndef __MIN
#   define __MIN(a, b)   ( ((a) < (b)) ? (a) : (b) )
#endif

typedef enum vlc_toolbar_clicked_e {
    clicked_Unknown = 0,
    clicked_Play,
    clicked_Pause,
    clicked_Stop,
    clicked_timeline,
    clicked_Time,
    clicked_Fullscreen,
    clicked_Mute,
    clicked_Unmute
} vlc_toolbar_clicked_t;


// Note that the accessor functions are unsafe, but this is handled in
// the next layer up. 64bit uints can be substituted to taste (shift=6).
template<size_t M> class bitmap
{
private:
    typedef uint32_t bitu_t; enum { shift=5 };
    enum { bmax=M, bpu=1<<shift, mask=bpu-1, units=(bmax+bpu-1)/bpu };
    bitu_t bits[units];
public:
    bool get(size_t idx) const { return bits[idx>>shift]&(1<<(idx&mask)); }
    void set(size_t idx)       { bits[idx>>shift]|=  1<<(idx&mask);  }
    void reset(size_t idx)     { bits[idx>>shift]&=~(1<<(idx&mask)); }
    void toggle(size_t idx)    { bits[idx>>shift]^=  1<<(idx&mask);  }
    size_t maxbit() const      { return bmax; }
    void clear()               { memset(bits,0,sizeof(bits)); }
    bitmap() { clear(); }
    ~bitmap() { }
    bool empty() const { // naive invert() will break this
        for(size_t i=0;i<units;++i)
            if(bits[i]) return false;
        return true;
    }
};

typedef bitmap<libvlc_VlmMediaInstanceStatusError+1> eventtypes_bitmap_t;


class EventObj: private eventtypes_bitmap_t
{
private:
    typedef libvlc_event_type_t event_t;
    bool have_event(event_t e) const { return e<maxbit()?get(e):false; }
{'fraction_non_alphanumeric': 0.22055137844611528, 'fraction_numerical': 0.013784461152882205, 'mean_word_length': 3.9064207650273226, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7075119', 'n_tokens_mistral': 2409, 'n_tokens_neox': 2293, 'n_words': 677}